In robotics, wireless robots are commonly used for applications that need to be operated remotely. Typically, these robots are controlled with a remote control that connects to the robot using wireless technology such as RF, Zigbee, Bluetooth, Wi-Fi, or a mobile network. In this tutorial, you will design a wireless robot that will connect to the remote control using the 434 MHz RF module. The remote control will have a keyboard to control the movement of the robot. Keyboards are one of the commonly used human-machine interfaces (HMI) and play an important role in small embedded systems where human interaction or input is required. Matrix keyboards are well known for their simple architecture and ease of interface. Therefore, in this project, a matrix keyboard is used to control the movement of the robot. The remote also houses a character LCD that will display the current direction the robot is moving. By direction, here we mean the forward, backward, left or right side of the robot.
The robot is built on a caster and a two-wheeled body. There are two geared DC motors connected to the wheels which are controlled by the L293D motor driver IC. The motor driver IC interfaces with the RF decoder, so the driver IC is operated by the RF data passed through the remote control. While the robot's control circuit (mounted on its body) is basically an RF receiver coupled to the motor driver circuit, the remote control is built around the Atmega 32 AVR microcontroller. Program code for the AVR controller is written, compiled, and transferred to the controller using AVR Studio.

Fig. 1: AVR-based keyboard-controlled wireless robot prototype
Required components –
Fig. 2: List of required components for AVR-based keyboard-controlled wireless robot
Block diagram –
The wireless robot remote control circuit can be represented by the following block diagram –
Fig. 3: Block diagram of AVR-based keyboard-controlled wireless robot
The control circuit circuit mounted on the robot can be represented by the following block diagram –

Fig. 4: Block diagram of AVR-based keyboard-controlled wireless robot control circuit
Circuit Connections –
There are two electronic circuits that make up this project – one is the remote control built with an AVR Atmega 32 controller, RF transmitter, RF encoder, 16X2 character LCD and 4X3 matrix keyboard. The other is the control circuit or receiver circuit assembled on the robot which is built using RF receiver, RF decoder, L293D motor driver IC and geared DC motors.
The remote circuit has the following circuit connections –
Fig. 5: Image showing remote control circuit of AVR based keyboard controlled wireless robot
AVR Atmega 32 – This is an 8-bit AVR RISC based microcontroller. It comes in a 40-pin package and has 2 KB of RAM, 32 KB of flash memory, 1 KB EEPROM, 32 general purpose input and output (GPIO) pins, 8 10-bit ADC channels, one SPI, one UART and an on-chip TWI interface. The controller has three built-in timers, of which 2 are 8-bit timers and one is a 16-bit timer. The controller operates up to a clock frequency of 16 MHz. By executing powerful instructions in a single clock cycle, the Atmega 32 achieves transfer rates approaching 1 MIPS per MHz, allowing system designers to optimize power consumption relative to processing speed. The controller is available in a 40-pin Dual Inline Package (DIP). Check out the pin diagram and pin configuration of this AVR Controller here.
22 GPIO pins of the controller are used in the remote control, of which 11 pins are used to interface with the character LCD, 7 pins are used to interface the matrix keyboard and 4 pins are used to connect with the encoder IC data pins.
16X2 LCD: The 16X2 LCD display is used to display the current moving direction of the robot. The direction of movement is expressed as forward, backward, left or right side of the robot. The interfaces with the AVR microcontroller by connecting its data pins to the controller's B port. Character LCD data pins DB0 to DB7 interface with AVR Atmega 32 pins PB0 to PB7, respectively. The RS, RW and E pins of the LCD are connected to the PD0, PD1 and PD2 pins of the AVR respectively. Character LCD circuit connections to the AVR controller are summarized in the following table –
Fig. 6: Table listing the circuit connections between the AVR ATMega32 and the Character LCD
4X3 Matrix Keyboard – A 4X3 keyboard is used for human input on the remote control. The keyboard has 12 buttons arranged in 4 rows and 3 columns. This is a numeric keypad used to control the robot's movement. The rows and columns of the keyboard interface with the AVR controller in the following scheme –
Fig. 7: Table listing circuit connections between the AVR ATMega32 and the keyboard
This matrix keyboard operates by steering between a single row and column at the press of a button. Any one of the rows or columns is transformed into digital output, while the remaining others (rows or columns) are transformed into digital input. Suppose rows are defined as digital output and columns as digital input. Now, the controller cycles through the lines generated in the digital output, setting them to HIGH or LOW one after the other and simultaneously checks the reception of the same logic in the columns. So, at a time, a single row is set to HIGH or LOW while other rows are set inversely and upon pressing a key the same logic is received in a single column. This unique combination of row and column allows you to identify the key pressed.
HT12E Decoder IC – The HT12E IC converts the parallel data from the controller into serial data to pass it to the RF transmitter. The IC HT12E encoder belongs to the 212 series of encoders. It is paired with 212 series decoders with the same number of addresses and data format. The HT12E is capable of encoding 12 bits, of which 8 are address bits and 4 are data bits. Thus, the encoded signal is a 12-bit serialized parallel data composed of 4-bit data to be transferred appended to the address byte. The data pins D0, D1, D2 and D3 of the IC are connected to the PC0, PC1, PC2 and PC3 pins of the AVR controller respectively. All the address pins of the encoder IC are connected to ground, so it has an address byte of 0x00. Pin 17 of the IC is connected to pin 2 of the RF transmitter. Thus, the serialized data is passed from pin 17 of the IC to the data input pin of the RF transmitter.
The HT12E has a transmit enable pin that is active low. When a trigger signal is received at the TE pin, the programmed addresses/data are transmitted along with the header bits via an RF or infrared transmission medium. The HT12E starts a 4-word transmission cycle after receiving a transmission enable. This cycle is repeated as long as the TE is kept low. As soon as TE returns to high level, the encoder output completes its final cycle and then stops.
RF Transmitter – The RF transmitter is used to transmit the control signals for controlling the motor. The RF transmitter module is a small PCB subassembly. The RF module, as the name suggests, operates on Radio Frequency. The corresponding frequency range varies between 30 kHz and 300 GHz. In this RF system, digital data is represented as variations in the amplitude of the carrier wave. This type of modulation is known as Amplitude Shift Keying (ASK). This RF module operates at a frequency of 433 MHz and uses the ASK modulation technique. The pin configuration of the transmitter module is as follows
Fig. 8: Table listing RF transmitter pin configuration
Serialized data from the encoder is received at pin 2 of the module and passed to the antenna from pin 4 of the module.
Power Supply – All components of the remote circuit require 5V DC to operate. Power is drawn from a battery and regulated to 5V DC using 7805 IC. The 7805 is a three-terminal voltage regulator IC. Pin 1 of the IC is connected to the battery anode and pin 2 is connected to ground. The voltage output is taken from pin 3 of the IC. An LED along with a 10K Ω pull-up resistor is also connected between the common ground and the output pin to get a visual cue of power continuity.
The robot control circuit has the following circuit connections –
Fig. 9: Control circuit image of AVR-based keyboard-controlled wireless robot
RF Receiver – The RF receiver detects the radio signal that carries engine control signals. The RF receiver module has 8 pins and the following pin configuration –
Figure 10: Table listing RF receiver pin configuration
The RF receiver passes the serial data received by RF frequency from pin 2 to pin 16 of the decoder IC.
HT12D Decoder – The detected signal from the RF receiver is passed to the HT12D decoder. It converts serial data back to parallel data after separating data and addresses. The HT12D belongs to the 212 series of decoders and can be paired with the 212 series of encoders with the same number of addresses and data format. The HT12D is capable of decoding 12 bits, of which 8 are address bits and 4 are data bits. The 4-bit data is latch type and when passed to the output data pins it remains unchanged until new data is received.
Serial data received by the RF receiver is output in parallel from its data pins as is. The data pins of the decoder IC interface with the input pins of the L293D motor driver IC. Thus, the digital logic on the decoder data pins controls the rotation of the DC motors. All address pins of the decoder IC are connected to ground to match the address byte with 0x00 the same as the transmitter circuit.
L293D DC Motor Driver IC – The L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current amplifiers in that they receive a low current control signal and supply a higher current signal. This higher current signal is used to drive the motors. It has 16 pins with the following pin configuration:
Fig. 11: Table listing the pin configuration of the L293D motor driver IC
There are two DC motors used to make the robotic car. DC motors interface between pins 3 and 6 and pins 14 and 11 of the motor driver IC.
IC L293D controls DC motors according to the following truth tables:
Fig. 12: Truth table of L293D motor driver IC
Pins 4, 5, 13 and 12 of the L293D are grounded while pins 1, 16 and 9 are connected to 5 VDC and pin 8 is connected to 12 VDC. Pins 2, 7, 10 and 15 of the motor driver IC are connected to data pins D0, D1, D2 and D3 of the decoder IC. The DC motor connected to the right wheel is connected to pins 11 and 14, while the motor connected to the left wheel is connected to pins 3 and 6 of the motor driver IC.
Geared DC Motors – In this robot, 12V DC geared motors are attached to the wheels. Geared DC motors are available with a wide range of RPM and Torque, which allows a robot to move based on the control signal it receives from the motor driver IC.
Power Source – In the receiver circuit, the motor driver IC needs 12 VDC while the RF receiver and decoder IC needs 5 VDC for its operation. The robot receives power from a 12V NIMH battery. The battery power is regulated to 5V and 12V using 7805 and 7812 ICs. Pin 1 of both voltage regulator ICs is connected to the battery anode and pin 2 of both ICs is connected to ground. The respective voltage outputs are taken from pin 3 of the respective voltage regulator ICs. An LED along with a 10K Ω pull-up resistor is also connected between the common ground and the output pin to get a visual cue of power continuity. Despite using a 12V battery, the 7812 is used to provide a regulated and stable power supply to the motor driver IC.
How the circuit works –
When the battery is connected to the robot, it is ready to receive RF data. The RF data directly controls the robot and there is no controller used in the robot's electronics. As the robot is powered, its RF receiver circuit pairs with the remote control's RF transmitter circuit and waits for user input. The remote control also works with a battery and as the battery is attached to the remote control, first some messages flash on its LCD display indicating the application of the project. Now the user can press the keyboard keys to move the robot in different directions. The following keys are assigned for robot navigation –
Fig. 13: Table listing key assignments for remote control of the Arduino Robot
When a key is pressed on the remote control, it is detected by the program code and the direction assigned to that pin is displayed on the LCD. At the same time, motor control signals are passed to the decoder IC by the AVR controller. The robot is moved forward, backward, left or right by implementing the following input logic on the motor driver pins –
Fig. 14: Logic table of L293D motor driver IC for Arduino robot
The input pins of the motor driver IC are connected to the AVR pins and by changing the digital logic on the AVR pins, the respective logic is implemented on the input pins of the motor driver IC. Thus, the user can navigate the robot with the help of the matrix keyboard.
Programming guide –
Only the remote control is controller based. The controller used in the remote control is AVR Atmega 32. ATmega32 microcontroller can be programmed and loaded with executable code with the help of AVR Studio 4 and GCC compiler. Check out the following guide on programming AVR controllers using AVR Studio –
Working with AVR Studio
In the program code, the library for digital input and output is imported followed by importing the library for delay generation. Next, the constants representing the matrix keyboard connections are declared and the functions to obtain user input from the keyboard are declared. Constants representing LCD connections are defined and functions used to display messages on the LCD are declared. Functions to control the robot's movement are then declared.

Fig. 15: Screenshot of AVR code for keyboard-controlled wireless robot
The main function is called and first some initial messages are displayed on the LCD.
Fig. 16: Screenshot of main function in AVR code for keyboard-controlled wireless robot
Inside the main function, an infinite while loop is called in which functions to read user input are called. Based on user input, functions to display the direction of movement on the LCD display and functions to send the motor control signal to the pins connected to the decoder IC are called.
Fig. 17: Screenshot of infinite while loop in AVR code for keyboard-controlled wireless robot
This completes the remote control AVR code. Check out the full code in the code section. The robot control circuit is a simple RF receiver coupled to the L293D motor driver IC and has no code involved. So, get your hands dirty quickly. It will be fun to make this keyboard-controlled wireless AVR robot.
Project source code
###
//Program to
#include
#include
#define F_CPU 1000000
#define USART_BAUDRATE 9600
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE*16UL))) - 1)
#define pad DOOR
#define r1 PA0
#define r2 PA1
#define r3 PA2
#define r4 PA3
#define c1 PA4
#define c2 PA5
#define c3 PA6
// Function prototype to check key pressed from keypad
void check1(void);
void check2(void);
void check3(void);
void check4(void);
#define LCD_DATA PORTB //LCD data port
#define ctrl PORTD
#define in PD2 //enable signal
#define rw PD1 //read/write signal
#define rs PD0 //resister select signal
#define CONTROL_OUTPUT PORTC // output port for wireless transmission
void LCD_cmd(unsigned char cmd);
void init_LCD(void);
void LCD_write(unsigned char data);
void move_forward ;
void move_backward ;
void turn_left ;
void turn_right ;
unsigned int press;
int main
{
unsigned char value;
DDRC=0x0f; //LCD_DATA port as output port
DDRB=0xFF; //signal
DDRA = 0X0F;
DDRD = 0X07;
pad = 0xF0;
init_LCD; //initialization of LCD
_delay_ms(50);
LCD_write_string("EngineersGarage");
_delay_ms(1000);
LCD_cmd(0x01);
LCD_write_string("Keypad Cntrld");
LCD_cmd(0xC0);
LCD_write_string("Wireless Robot");
while(1)
{
PORT=0xF0; //set all the input to one
value=PINA; //get the PORTD value in variable “value”
if(value!=0xf0) //if any key is pressed value changed
{
check1;
check2;
check3;
check4;
}
}
return 0;
}
void check1(void)
{
pad =0b11111110;
_delay_us(10);
if(bit_is_clear(PINA,c2))
{
move_forward ;
}
}
void check2(void)
{
pad=0b11111101;
_delay_us(10);
if(bit_is_clear(PINA,c3))
{
turn_right;
}
}
void check3(void)
{
pad=0b11111011;
_delay_us(10);
if(bit_is_clear(PINA,c2))
{
move_backward ;
}
}
void check4(void)
{
pad =0b11110111;
_delay_us(10);
if(bit_is_clear(PINA,c2))
{
robo_stop;
}
}
void init_LCD(void)
{
LCD_cmd(0x38); //initialization of 16X2 LCD in 8bit mode
_delay_ms(1);
LCD_cmd(0x01); //clear LCD
_delay_ms(1);
LCD_cmd(0x0E); //cursor ON
_delay_ms(1);
LCD_cmd(0x80); // ---8 go to first line and --0 is for 0th position
_delay_ms(1);
return;
}
void LCD_cmd(unsigned char cmd)
{
LCD_DATA=cmd;
ctrl =(0<
Circuit diagrams
| Circuit Diagram-Remote-Controlled-Keyboard-Controlled-AVR-ATMega32-Wireless Robot |
 |
| Circuit-Diagram-Keyboard-Controlled-AVR-ATMega32-Wireless-Robot |
 |
Project video