Here we show how you can control a wireless toy car through your PC’s serial port using a pair of ASK transmitter and receiver modules. The received signal is decoded by a P89V51RD2 microcontroller and fed to the motor driver circuitry to move the toy car in forward, backward, right or left direction. All the signals are in RF domain.
Controlling a wireless toy car
Above is the block diagram for PC based wireless toy car control. The different stages of wireless control are:
- Transmission of the control signals from a PC’s serial port
- RF transmitter and receiver
- Decoding of the received signals using the microcontroller
- Motor drivers
Asynchronous serial communication is established between the computer and P89V51RD2 microcontroller through wireless RF link. The microcontroller and computer are both synchronised with each other. The baud rate of data transfer is 1200.
Transmission of the control signal through PC’s serial port
The first part of the project is the transmission of control signals through the serial port of the PC. The control signals are W, S, D, A, Q, E, C, Z and U to control the toy car in forward, backward, right drift, left drift, sharp forward left turn, sharp forward right turn, sharp backward left turn, sharp backward right turn and stop, respectively. Each of the control signals is fed from the keyboard and sent through the serial com port. The signal is then transmitted wirelessly by the ASK transmitter module.
PC’s serial com port
There are many ports available at the base of your PC in order to send data to the connected peripherals. Serial port, parallel port and USB port are some of the ports for connecting to the peripherals.
The serial data port transmits or receives the data serially (1-bit data per TX or RX clock pulse). It is based on IEEE RS-232 standard, which defines voltages and baud rates for serial communication between devices connected to it. Most desktop computers have an RS-232 serial port as it has a very simple circuitry and is cheap and easy to handle.
Windows-based 9-pin serial port DB9 connector has the configuration as shown here.
The RS-232 standard serial port has nine pins having different functions for transmitting and receiving data. Of these, only three pins (pins 2, 3 and 5) are mostly used for sending and receiving data. Only pins 3 and 5 are used in this project. The RS-232 standard has specific voltage levels for data logic 0 and logic 1 (-3 to -15V for logic 1, and +3 to +15V for logic 0). But the microcontroller defines logic 0 and logic 1 by voltage levels 0-0.5V and 4.5-5V, respectively. So you have to convert the RS-232 standard signal level into the microcontroller signal level. For that purpose, we have used a MAX232 converter.
For signal-level conversion, MAX232 requires four capacitors (10μF) and a 5V supply. Since we are using 9V supply, a single voltage source voltage regulator IC 7805 is required to supply power to MAX232. Now, the serial port signal, which is at RS-232 logic, can be converted into 5V TTL-level signal.
The transmitter section built around MAX232 is shown above.
The 5V supply from 7805 voltage regulator IC powers the RF ASK transmitter module through its pin 3. This module actually collects the binary signal from the data pin (which is connected to the MAX232) and modulates this binary signal with amplitude-shift keying (ASK) digital modulation scheme by a carrier frequency of 434 MHz and transmits the data through the antenna. The concept of the ASK signal is shown here.
The ASK receiver module (Fig. 4) receives the 434MHz signal and demodulates it. The baseband signal is a 10-bit digital signal with the first bit as start bit, the following eight bits, as data bits and the last bits as stop bit. The received data is sent to the microcontroller. The RXD pin (p3.0) of P89V51RD2 microcontroller is connected to the data pin of the 434MHz ASK module receiver. So the P89V51RD2 detects the transmitted data at its pin 10 (RXD).
Decoding of the received signal with P89V51RD2
The P89V51RD2 is an 80C51 microcontroller with 64kB flash, 1024 bytes of data RAM, 32 input/ output (I/O) ports, three 16-bit timers/counters and two pins for serial data transmission and reception. Timer 1 is used for serial communication. It is operated with an 11.0592MHz crystal.