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 :
>Solid Core Wire Roll
>Female header strips
>433MHz Tx Module
>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
>2 X White LEDs
>2 X 100 ohm resistors
>10K Ohm resistor
>2N2222A NPN Transistor
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
>9V AA Battery Pack for the motors,Rx,Arduino,etc.
>9V battery for the Tx remote.
Tools and Misc stuff :
>Laptop with the Arduino IDE installed
>An Old Mini Cassette Case to mount the HCSR04 module...or something similar.
>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!
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.
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.
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 :
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)
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!!!