Introduction: The Wireless,Obstacle Detecting,Beeping Robot Using Arduinos!
This is a wirelessly controlled, autonomous obstacle detecting robot !
A while back I had made this Instructable and wanted to make some major upgrades ever since.
The following are the robot's features :-
1.He's wirelessly controlled using 433MHz Tx/Rx modules.
2.He has the capability to sense an object in front of him and override the controllers command until the object i detected.
3.Has a piezo buzzer to tell you when there is an obstacle in front and also for a start up beep.
4.Two LED headlights for navigation in the dark.
5.A 5 LED Larrson scanner running on an ATTiny 85....because why not? :p
6.Controlled by a single joystick remote with push-buttons for added functions.
So let's get building !
Step 1: Parts & Tools Required
Here's a list of the parts and tools required for each component of the project :
The Remote :
>Joystick
>Pushbuttons
>Solid Core Wire Roll
>Female header strips
>Arduino Board
>433MHz Tx Module
>9v Battery
>Perf board to solder everything on
The Motor Shield : (You can skip this if you buy a ready made motorshield...I needed these to solder mine!!)
>Breadboard for prototyping before soldering
>3 X 16 pin IC Sockets
>2 X 100uF Electrolytic Capacitors
>2 X L293D Motor Driver ICs
>12 X 100 Ohm Resistors
>Roll of connecting wires
>Male and Female header strips
>Perf board for finally soldering everything on.
The Larson Scanner :
>5 X Red LEDs
>ATTiny 85 for the Larson Scanner (Optional)
>5 X 220Ohm Resistors
>2 X 74HC595 8-bit Shift Register IC
Headlights :
>2 X White LEDs
>2 X 100 ohm resistors
>10K Ohm resistor
>2N2222A NPN Transistor
>Heatshrink
Microcontroller and Chassis:
> 4 wheel drive robot chassis.
> Two Arduinos or clones (One each for the Tx and Rx)
> HCR04 Ultrasonic Sensor
> Roll of Wires
>Male header strips
>Male and Female Jumper Cables
>12 X 0.1uF Ceramic Capacitors
Batteries :
>9V AA Battery Pack for the motors,Rx,Arduino,etc.
>9V battery for the Tx remote.
Tools and Misc stuff :
>Soldering Iron
>Solder Wire
>Laptop with the Arduino IDE installed
>Glue Gun
>An Old Mini Cassette Case to mount the HCSR04 module...or something similar.
Links :
>4 wheel drive chassis : here
>Tx/Rx modules : here
The rest of the components I bought from local electronic component stores since they are very cheap!
Step 2: Assembling the Chassis
I ordered the 4 wheel drive chassis from hobbyking a while back.
It wasn't too difficult to assemble (about 30 mins to assemble the whole thing) .The chassis had 2 levels which worked well since
I wanted to separate the power source from the electronics.
The chassis also had many mounting holes on the top level which made it very easy to mount the HCSR04 module , the other sensors and the Arduino.
I've attached the assembly instructions that came with the chassis in the pdf file below
Also make sure you solder three 0.1uF ceramic capacitors for each motor (as shown in the picture) as this reduces noise and voltage spikes!
Attachments
Step 3: Making the Motor Shield : Overview
There are a ton of motor shield schematics that are just a google search away thanks to the awesome open-source community.
Looking at one of the motorshield schematics I found (the adafruit one) I saw that most of the components required were readily available at my local electronics shop and after doing a bit of calculating saw that I could solder one for a third of the cost!
I also realised that I could save a few pwm pins on the Arduino (4 in total) by modifying the shield connections a bit. Instead of connecting the 4 enable pins of the L293Ds to 4 Digital pins on the Arduino, I directly bypassed them to +5V via a 10K Ohm resistor.
This meant that I could save 4 pwm pins on the Arduino...however you lose the ability to control the speed of the rotation of the motors (I didn't need to so it was fine! ).
Another thing that's different from the shield schematic is that instead of a 10K resistannce bus I have soldered 10 individual 10K Ohm resistors since none of the shops had a resistance bus. (Go for the resistance bus if you get it....much easier to solder!)
So get your soldering irons heated...we have a motor shield to build!
Note : You can skip over to Step 6 if you have a ready made motor shield!!!!
Step 4: Making the Motor Shield : Adding the Resistors and Motor Driver Connections
Now take seven 10K Ohm resistors and solder one each to pins 1 to 7 of the 8 bit shift register (74HC595).....the other end of the resistor go to ground.
Take one more 10K Ohm resistor and solder one side to pin 15 of the shift register...the other side going to ground.
Take another 10K Ohm resistor and solder one end to pin 10 and the other to pin 13 of the shift register.
Next connect pin 16 of the shift register to 5V and pins 8 and 10 to ground.
Then connect Input pins of the motor drivers to the respective pins of the shift register as shown in the attached schematic.
Step 5: Making the Motor Shield :Adding the Power Switch and Rx
The Arduino and motors and headlights are powered by the 9V AA batter pack.
This power is supplied through the Arduino Vin pin...the +ve of the supply is connected to the Vin pin and ground is connected to the Arduino ground,
The pin 8 of both the motor driver ICs is also connected to the Vin pin as they supply power to the motors.Two 100uF electrolytic capacitors are connected to the pin 8 of both the motor drivers. (Electrolytic capacitors are polarized...make sure the +ve terminal is connected to pin 8 and -ve terminal to ground!!!!!)
Connecting the Rx Module :-
Now finally solder the Rx module on to the perf board.
Connect the ground pins of the Rx to the Arduino ground and the Vcc pins to the Arduino 5V pin.
Connect the Data pin (Pin 6 when the module is facing towards you ) to the Digital pin 2 on the Arduino.
Headlights :-
Solder on the 2N2222A NPN Transistor as follows :
Connect the base of the NPN transistor to the Analog pin 3 (D 16) via a 1K Ohm resistor.
Connect the emitter pin to the Arduino ground.
The collector pin is connected to the cathode (shorter terminal ) of the white LED via a 100 Ohm resistor.
The Anode (longer terminal) is connected to the Arduino 5V.
Your motor shield is now ready!
Step 6: Making the Remote
For making the remote I used a perf board of 12.5cm X 9.5cm .
I used female headers for the remote since my Arduino clone had male header pins.
First make 4 sets of female headers :
>one of 10 pins
> two of 8 pins
> one of 6 pins
Solder these on to the perf board leaving a space of 18 holes in between (see picture)
Next solder the Joystick in place.
It has three pins for each pot ( 6 in total)...After you have soldered the joytick, connect the first pin to 5V,the third pin to ground and the middle pin to Analog 0 on the Arduino.
Do the same for the other three pins...except connect the middle pin to Analog pin 1.
Solder on the Tx module next....
>Ground pin to Arduino ground
>Vcc pin to Arduino 5V
>Data pin to Digital pin 3.
Next solder the 3 push buttons (you could add more if you like)
Connect one terminal of each to the Arduino ground and the other terminals to Digital pins 2,4 and 7 respectively.
Optional :- I added a green power indication LED to Digital pin 12 since he Arduino is connected upside down.
Your controlling remote is now built!
Step 7: Adding the HCSR04 Ultrasonic Module and Headlights
Now to mount the Ultrasonic module I used part of a mini cassette holder.Then to fix it to the chassis I used a few pieces of salvaged metal and a bit of hot glue.
The Ultrasonic module is connected to the arduino using the Male to Female jumper wires.
Headlights :
The constructions for the headlights is pretty easy....here are some pics.
Step 8: The Code
The code for the Remote and the Robot are attached below.It is fairly easy to undertand and well commented.
Upload the TxCode.txt to the Arduino on the remote and the RxCode.txt to the Arduino on the robot.
NOTE :You will need to download and install VirtualWire and Adafruit MotorShield Libraries. Links are provided below.
Download Links :
>VirtualWire
>Adafruit
Attachments
Step 9: The Larson Scanner
The larson scanner was made using the ATTiny 85 and another shift register.
The connections are fairly simple and easy...the pictures and schematic diagram will serve better than any explanation.
Uploading code on to the ATTiny 85 :
For uploading code on the ATTiny 85 I used the Arduino as ISP method using a shield I made.
There are many good tutorials on how to upload code on to the ATTiny 85 using this method like this one.
The use of the shift register makes it possible to control 5 LEDs with only 3 pins...which is a big advantage.
Note : In order to upload code to the ATTiny85 using Arduino as ISP, I needed an older version of the Arduino IDE (I used version 022)
Attachments
Step 10: Videos and More Pictures!!!
Step 11: This Is the Droid You're Looking For!!
I've entered my robot into 3 instructables contests :
>The Arduino Contest
>The Robot Contest
>The Full Spectrum Contest
So please vote for this instructable!!!
Cheers!

Participated in the
Arduino Contest

Participated in the
Full Spectrum Laser Contest

Participated in the
Robot Contest
23 Comments
8 years ago on Introduction
hi i m making the one like you, can u send me the code in which the following modifications are done.....
only two wheel drive
headlights
turn indicators
and well commented... thanks in advanced...
mail id= "onkartarar@gmail.com"
plz send me immediately...
8 years ago on Introduction
hi i have modified the code to use the version 2 of the adafruit motor controller i have it stacked on top of the arduino uno and it has 4 dc motors attached accordingly to the controller. reviever: i have grd to grad on arduino i have 5v to 5v and the data out pin goes to digital pin 2, on the remote side i have the transmitter data pin goes to digital pin 3 and the grid and 5v accordingly, i have my joystick on the a0 and a1 for x and y and the grd and 5v accordingly, i have modified code to work with the motorcontoller v2 instead of motor.setSpeed() it is motor->setSpeed only difference but the code won't work, can you help me with the way i have it set up? u can email me at nealat06@gmail.com
8 years ago on Introduction
nice work keep up the good work.
8 years ago on Introduction
Hi, I am wondering which kind of arduino board are you using?
Reply 8 years ago on Introduction
I've used the Arduino Uno here but any other Arduino board should be fine!
8 years ago on Introduction
If i want to use pwm for motors so how is the code modified for tx and rx.
8 years ago on Step 8
Hi, I just got into contact with 433mhz-devices and thus looked for material to learn with. That way I found your how-to, which is very useful and easy to understand.
Since I also control my motors attached to an arduino remotely via 433mhz, there´s on issue I cannot solve. As soon as I press and keep one button for forward pressed the motors move but stop every few milliseconds/seconds then continue. I would like them to keep running until I release a button.
Do you know a solution? Does your code have the same problems?
Reply 8 years ago on Introduction
Hey, I'm glad you liked the instructable.....In the code I've used the motors move forward as long as it gets the forward command from the remote....in this case I've used a joystick instead of buttons though the principle remains the same.
9 years ago on Introduction
Great Job. Very nice.
Take a look on my instructables too. https://www.instructables.com/id/PINGBot-Explorer-R...
Reply 9 years ago on Introduction
Thanks :)
I liked your robot very much!...I had planned on using a servo to sweep the distance sensor myself but couldn't since the Servo cannot be used if one is using the VirtualWire and AFMotor libraries.
Reply 9 years ago on Introduction
In this case I advise you to use a dual_H-bridge to drive the DC-Motors instead of AF_Motor Shield.
https://www.instructables.com/id/Dual-H-Bridge-L298-Breakout-Board-Homemade/
You will save pins on Arduino board.
Reply 9 years ago on Introduction
Yeah...but that would need 4 pins for 2 motors....that would still be the same number of pins as the L293D if I'm not mistaken.
I tried that on the first version of the robot here .
9 years ago
Very cool. Voted
Reply 9 years ago on Introduction
Thanks :)
9 years ago on Introduction
I've got a little RC truck I'd love to do this with. Thanks for posting this!
Reply 9 years ago on Introduction
Thanks....would love to see some pics once your truck is finished :)
9 years ago on Introduction
got my votes
Reply 9 years ago on Introduction
Thank you :)
9 years ago on Introduction
This is a nice effort. My opinion is to use ir receiver and an ordinary remote for wireless action. It is much cheaper and range is also decent. And you should pay a little attention to neatness aswell. Makes debugging easier. Overall good effort.
Reply 9 years ago on Introduction
Thanks!...I've tried using IR for wireless control on smaller robots and the range with IR is a lot less than what you can achieve with RF modules.Plus the IR sensor is more affected by obstacles compared to these RF modules.
Haha yeah the board could be much more neater...the wiring is a big mess :p