Introduction: Wireless Robot V2 (Support WiFi & Bluetooth)

Step 1: Car Structure

I get The motors ,gear box and tires from two broken car kids toys from Scrap market nearby , they cost me about 10$ and I connect them using din rail and plastic as shown in the pictures.

Step 2: Connection Digram

Using the Serial pins of ATMEGA16 MCU is The Concept of this circuit and it consist from :

1- H-Bridge Motor driver using two L298.
2- Atmega16 MCU.
3- LEDs Driver using ULN2003.
4- Serial Bluetooth Module.
5- Serial-To-Ethernet converter.
6- WiFi Wireless access point.
7- Easy N surveillance IP cam.
8- 12 Volt battery with 7809 & 7805 voltage regulator  for router and IP cam .
9- 6 Volt Battery for motors. 

Step 3: H-Bridge Circuits

two L298 dual H-bridge driver connected as shown in the pictures .
the motors working on 6 volt with 2.4 Amp. maximum current for each.
L298 Data sheet attached.

Step 4: LED Driver

ULN2003 Darlington transistor arrays is a fast solution  and provide 7 output.
The circuit shown in attached picture.
Datasheet attached.

Step 5: Controller Circuit

The source code debugged by ATMEL AVR studio 4 with AVR MKII ISP .
The Scenario of the code depending on:
1-Enabling the RX/TX of ATMEGA16 MCU.
2-Sending the ASCII code from  the PC or Tablet .
3-Translate the ASCII code by the MCU  to a specific output in port A and port C.

The fuse bit  for 16 Mhz external frequency resonator  should be set to :High: 0xC9 , Low: 0xFF as shown in the attached picture. 


ATmega16  16MHz external frequency resonator
Baud Rate 9600 No Parity,1 Stop Bit,Flow Control:None

#include <avr/io.h>
#include <inttypes.h>
#include <util/delay.h>

void USARTInit(uint16_t ubrr_value)

   //Set Baud rate
   UBRRL = ubrr_value;     
   UBRRH = (ubrr_value>>8);

   UCSRC=(1<<URSEL)|(3<<UCSZ0);   // Set Asynchronous mode,No Parity ,1 StopBit 
   UCSRB=(1<<RXEN)|(1<<TXEN);     //Enable The receiver and transmitter


char USARTReadChar()
while(!(UCSRA & (1<<RXC)))
   // do nothing
return UDR;

void USARTWriteChar(char data)
while(!(UCSRA & (1<<UDRE)))
  //do nothing

void main()
char data;
USARTInit(103);  //for 16Mhz and baud 9600 UBRR = 103 and for  baud 19200 UBRR = 51 

if (data==0x71){PORTC=0b10000000;USARTWriteChar('Q');} //q in ascii
if (data==0x77){PORTC=0b00001001;USARTWriteChar('w');} //w in ascii Forward
if (data==0x65){PORTC=0b01000000;USARTWriteChar('e');} //e in ascii
if (data==0x61){PORTC=0b00000011;USARTWriteChar('A');} //a in ascii Left
if (data==0x73){PORTC=0b00000000;USARTWriteChar('s');} //s in ascii Stop
if (data==0x64){PORTC=0b00001100;USARTWriteChar('d');} //d in ascii Right
if (data==0x7A){PORTC=0b00100000;USARTWriteChar('z');} //z in ascii
if (data==0x78){PORTC=0b10000110;USARTWriteChar('x');} //x in ascii Backward
if (data==0x99){PORTC=0b11110000;USARTWriteChar('c');} //c in ascii

if (data==0x69){PORTC=0b00001001;_delay_ms(200);PORTC=0b00000000;} //i in ascii Forward
if (data==0x6A){PORTC=0b00000011;_delay_ms(200);PORTC=0b00000000;} //j in ascii Left
if (data==0x6C){PORTC=0b00001100;_delay_ms(200);PORTC=0b00000000;} //l in ascii Right
if (data==0x6B){PORTC=0b00000110;_delay_ms(200);PORTC=0b00000000;} //k in ascii Back

if (data==0x31){PORTA=0b00000001;USARTWriteChar('1');} //1 in ascii //2 LED On
if (data==0x32){PORTA=0b00000010;USARTWriteChar('2');} //2 in ascii //4 LED on
if (data==0x33){PORTA=0b00000111;USARTWriteChar('3');} //3 in ascii //6 LED on
if (data==0x34){PORTA=0b00001000;USARTWriteChar('4');} //4 in ascii //Red LED on
if (data==0x35){PORTA=0b00010000;USARTWriteChar('5');} //5 in ascii
if (data==0x36){PORTA=0b00100000;USARTWriteChar('6');} //6 in ascii
if (data==0x37){PORTA=0b01000000;USARTWriteChar('7');} //7 in ascii
if (data==0x38){PORTA=0b10000000;USARTWriteChar('8');} //8 in ascii
if (data==0x39){PORTA=0b00000000;USARTWriteChar('9');} //9 in ascii //All Off 
   else {}

Step 6: Serial to Ethernet Converter

I get the module from below website :

VDD to 5 Volt.
GND to negative.
RX to TX of ATmega16.
TX to RX of Atmega16.
CFG :Normal Mode when connected to positive , Configuration mode when connected to negative.

Also RS232 to TTL module required  to configure this module .

You can download all the documents from the mentioned website.

For this Project I configure the setting for the converter  as below:
Work Mode   : TCP/IP clinet.
Module IP     : 
Subnet Mask:
Default gateway :  (Access point IP).
Parity/data/stop  :None /8/1
Destination IP    :  (Laptop IP).
Destination Port: 8234.
Baud Rate    : 9600

Step 7: Com-Redirector Software

Com-Redirector software used to create Virtual com in the Laptop because there is no direct physical connection to the laptop ,you can also use virtual serial ports emulator software from

Putty or hyper terminal software can be used to send information through this virtual serial port.
please watch the video for more information .

Step 8: Serial Bluetooth Module

I get the Slave Mode Serial Bluetooth module from below web site(all document included):
Pass Key:1234

About the software you can download android Bluetooth Controller  software from android market ,its amazing software and easy to use.

Step 9: Switch Selector

in the end I connect a selector switch  to select the wireless  mode (WiFi or Bluetooth).  


srujan7567 made it!(author)2014-02-16

sir can you please say me how to draw the data flow diagram for this robot??

mustafa_saifee made it!(author)2013-12-07

Hey, Sorry to ask but please.. can you mention the links of these items which are sold on online international shopping websites.. the links you mentioned is not delivered in my country(India)...for ex. Amazon, Flipkart, Snapdeal, Ebay.

mohsennoruzi made it!(author)2013-10-20

Hi Husham Samir, you're project wonderful(Wireless Robot V2), i want to create it, can i have pdf and program this project. please send article to my thankyou

dullawa777 made it!(author)2013-09-30

dear sir
nice and great work. i like to test this project, can i get PDF file of this full project?
please can you send it to my email. my Email is thank you,

best regards

gaurav.srm.1017 made it!(author)2013-05-03

instead of using serial to ethernet converter, i'm using serial to usb and usb to ethernet combo. But i still don't know how to send control values from putty to the microcontroller for the controlling part. Can you help me plz?

Husham+Samir made it!(author)2013-05-04

okay explain more how did you connect these two things together and how you connected to MCU.
for putty and how to send Information ,I previously told you to read the below tutorial from extreme electronic , every things mentioned there .

gaurav.srm.1017 made it!(author)2013-05-03

How to send control the rover by putty? what values do i have to input in putty to move the rover? i saw your video but couldn't understand it. Help please!

gaurav.srm.1017 made it!(author)2013-04-20

from where did you download this com redirector software?

Husham+Samir made it!(author)2013-04-20

CD included with the converter

gaurav.srm.1017 made it!(author)2013-04-20

but isn't the software free for download

Husham+Samir made it!(author)2013-04-20

well I get it free when I bought the converter.

gaurav.srm.1017 made it!(author)2013-04-21

Which converter?

gaurav.srm.1017 made it!(author)2013-04-29

I'm sorry to bother you, but can u please send me the com redirector software as a zip file to my mail id.I will be highly grateful to you if you did.

Husham+Samir made it!(author)2013-04-21

Step 6: Serial to Ethernet Converter

gaurav.srm.1017 made it!(author)2013-04-19

I bought a TP-LINK wireless N ADSL2+ modem router for the wi-fi access point. I just want to know how to give a portable power supply for the router that will be placed on the rover.

Husham+Samir made it!(author)2013-04-19

First of all check the DC voltage needed in your wireless TP link.
in my case TP link took 9 volt 1 Amp so I use L7809CT voltage regulator TO-3 type

gaurav.srm.1017 made it!(author)2013-04-24

Can you help me in configuring the router?

Husham+Samir made it!(author)2013-04-25

read the quick manual for this router
set the wireless as access point (AP) and put an SSID name for it.

ayush+aggarwal made it!(author)2013-04-25

I am stuck with pairing of Bluetooth module and mobile android app.
It is asking pass key again and again

Husham+Samir made it!(author)2013-04-25

Hi if you are using the same bluetooth module ,the pass key is 1234
if it didn't work check the web site belong for this bluetooth module.

gaurav.srm.1017 made it!(author)2013-04-21

Will this program work for atmega32?

Husham+Samir made it!(author)2013-04-21

I am not sure but I will say yes.

gaurav.srm.1017 made it!(author)2013-04-21

Are you using two L298ICs' or a single one here

Husham+Samir made it!(author)2013-04-21

Two L298 but each one connected to one motor as seen in the diagram attached in step 3 with attached data sheet

gaurav.srm.1017 made it!(author)2013-04-21

But L298 is a dual H-bridge driver, isn't it. It can run 2 Motors at once, right?

Husham+Samir made it!(author)2013-04-21

yes it its but for higher currents, outputs can be paralleled (Read the data sheet for L298 page7)

gaurav.srm.1017 made it!(author)2013-04-20

Hi sameer, When i'm using your code , its showing assembly failed. Does that mean that there's something wrong with the code or something wrong with what i did?

Husham+Samir made it!(author)2013-04-20

in project type you should chose AVR GCC .
go to below article in and see the pictures in step 5.

gaurav.srm.1017 made it!(author)2013-04-20

Now its showing "Build failed with 23 errors and 2 warnings..."

Husham+Samir made it!(author)2013-04-20

you are using xboard 2.0 from extreme electronic web site and there is a full tutorial explain how to use USART in below :
if you make the above test successfully ,you can just add additional command to make the motors on.
also below tutorial represent your project and its Xboard 2.0
don't confuse your self between two web site ,just use the web site that compatible with your circuit which is extreme electronic and when you finish remove the serial wires and connect them to the serial to Ethernet converter in order to make it wireless.
about the error I test this code again on 14 april-2013 and there is no problem in the code (check my comment in that date and see the build result).
check you might forget the bracket while you copy the code.

ayush+aggarwal made it!(author)2013-04-17

can i use "vpl handy programmer" to burn atmega16 chip.,.,.,
or i have to use any other burner

Husham+Samir made it!(author)2013-04-17

I don't know ,I didn't use this type before but the programmer used with AVR studio to burn ATMEGA MCU
STK500 & STK 600 (Development Kit).
or ISP (in system programer ) like AVR MKII ISP or JTAG MKII

the best suggestion ,the cheapest and the fastest is to buy arduino development kit
and program your MCU directly without a programmer device because there is a USB built in the development kit ,so there is no need to buy a programmer device .
also the code in arduino much easier from AVR studio and you will get better support and solution in the websites .
after programming your MCU you can remove it and put it in your circuit or you can keep it in the development kit and use it as your circuit because its cheap.
search in youtube on (arduino tutorial ) and you will see how many things you will be able to do with this kit.

Husham+Samir made it!(author)2013-04-15

you can use AVR studio to burn your MCU.
check the pictures in step5 for the below articles ,it will give you some guide line:

for the programable device I use AVRISP MKII
if you use arduino development kit you will not need any thing from these ,you can directly connect the usb and burn your MCU.

ayush+aggarwal made it!(author)2013-04-15

Which software should i use to burn avr????

ayush+aggarwal made it!(author)2013-04-14

how to make hex file for atmega
I tried in AVR STUDIO 4, but there are 2 warnings in it.
Is there any other way to burn avr

Husham+Samir made it!(author)2013-04-14

in AVR studio 4 click on build or F7
it will show you 2 warning below (just ignore them ):
Build started 14.4.2013 at 18:56:31
avr-gcc -mmcu=atmega16 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT test1.o -MF dep/test1.o.d -c ../test1.c
In file included from ../test1.c:8:
d:/winavr-20100110/lib/gcc/../../avr/include/util/delay.h:85:3: warning: #warning "F_CPU not defined for "
../test1.c:43: warning: return type of 'main' is not 'int'
avr-gcc -mmcu=atmega16 -Wl, test1.o -o test1.elf
avr-objcopy -O ihex -R .eeprom -R .fuse -R .lock -R .signature test1.elf test1.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex test1.elf test1.eep || exit 0
avr-objdump -h -S test1.elf > test1.lss

AVR Memory Usage
Device: atmega16

Program: 576 bytes (3.5% Full)
(.text + .data + .bootloader)

Data: 0 bytes (0.0% Full)
(.data + .bss + .noinit)

Build succeeded with 2 Warnings...

then click compile (Alt-F7)
then go to build -export make file .
it will generate the HEX file

don't forget to set the fuse bit according to what you have in your circuit (external frequency resonator or crystal clock ) ,any mistake in this step you will lose your MCU.

gaurav.srm.1017 made it!(author)2013-04-11

hello sameer...
I've got a few more questions for you-
1. i'm planning on adding an ultrasonic hurdle detector to my i neet some extra lines of codes for that too...?
2. I'm using a xboard 2.0 from as the pcb board on my rover but it only has a single L298 dual h-bridge driver and i need to control 4 motors...If i add one more L298 driver will it work?
3.Will ur code be compatible with the xboard 2.0?

Husham+Samir made it!(author)2013-04-11

1- yes ,you will need extra code for ultrasonic and it will be more complicated ,so I suggest you to finish the first step then think about ultrasonic.
2-I didn't work with xboard 2.0 ,so I don't know but if there are a free four I/O pin in MCU ,you can connect additional L298 circuit but you have to ask the person who design the board.
3- I don't know but in case you want to try ,just be careful for clocking issue, I am using External frequency resonator (4 pin) not crystal (2 pin) ,so the fuse bit will be different and any mistake in this step you will lose your MCU.

gaurav.srm.1017 made it!(author)2013-04-11

One more question...
Is it necessary to use Cisco Linksys WRT54GL Wireless-G Broadband Linux Router or can i go with any other because i have to hack into it, right?

Husham+Samir made it!(author)2013-04-11

in my case I use TP link wireless router .
you can use any other wireless if you have the (serial to Ethernet converter) ,if you don't have this converter you have to go with the old way by hacking cisco linksys.

gaurav.srm.1017 made it!(author)2013-04-03

here why are the keys i,j,k and l used with a delay function and no write function and q,e,z,c keys in ascii used...

Husham+Samir made it!(author)2013-04-11

when you press button (w) and release this button the motor will move forward and it will not stop till you press and release Button S .this is not good because if you lose the wireless connection with the car and the car already take forward order ,so you will not be able to stop it and the car will keep moving out of control.
if you press (i) button and keep pressing the car will go forward and once you release the button the car will stop after the delay ,so in this case if you lose wireless connection the car will stop automatically.

gaurav.srm.1017 made it!(author)2013-04-02

Hi Samir,
Thanks for your reply. I am doing this as my final year project and i'm quite stuck with this title. Also i'm new in programming and would be highly obliged if u could explain the first few lines of the code.
Thank you

gaurav.srm.1017 made it!(author)2013-03-14

hi. i just wanted to know if this is the full code or just a section of it.??...I'm doing the same project and i have no idea about programming...Please help

Husham+Samir made it!(author)2013-03-15

Hi ,
yes ,this is the full code ,but if you are new in programming I suggest you to start with arduino development kit in order to not stuck in hardware connection problem ,also the code for arduino much easier for serial port setting from this one ,
just search for (arduino serial port) in youtube ,you will find amazing tutorials ,it will able you to finish the electronic and software code part within one day. .

sunshiine made it!(author)2013-01-17

Thanks so much for sharing your robot! I hope your day shines!

Husham+Samir made it!(author)2013-01-18

You're welcome.

techbitar made it!(author)2013-01-12

Nice project!

Husham+Samir made it!(author)2013-01-17

Thank you.

Thien_Luong made it!(author)2013-01-16

very good
thank you

About This Instructable




Bio: Electrical Engineer
More by Husham Samir:Using MikroTik Router Board 433 & Arduino To Control Two LEDsArduino Keypad Door LockTemperature Data Logger
Add instructable to: