DIY remote controlled arduino motor shield!

Written by: admin@makezilla

Picture of DIY  remote controlled arduino motor shield!

 

in this instructable you'll learn how to build an arduino dual-motor shield and how to decode an infrared remote and use it to control these motors.

Step 1: Parts and assembly!

Picture of Parts and assembly!DSC_0071.JPGSchematic-Integrated-Sensor-and-L298N-Motor-Shield.jpgDSC_0075.JPGDSC_0074.JPGDSC_0073.JPGurl.jpg

Parts:

- Arduino Uno

- L298 Motor Driver (x1)

- Veroboard (x1)

- Male or female Header Strip (enough to fit your arduino (32)) 

- 1N4007 Diodes (x8)

- 0.1uf and a 22uf capacitor

- Block connectors (x3)

- Jumper Wires

NOTE: 

- E1-2 and E2-3 are connected to +5v they are enable pins so don't connect them to a block connector just to +5v in case we need to add a servo for steering we need enough pwm pins.

- for me i did not use the red ,green led's and 2.2 kohm resistor ,i counted on the Serial communication feedback that i have written.

assembly:

you could either etch a circuit board or just use jumper wires like i did .

i will not go through great details on how to solder the parts ,if you want follow my parts layout in the pictures above,

and solder the headers as shown in the figure that's the easiest way.

first cut them so they match your arduino pins,even if were not using all the pins on the arduino its better to fit headers on all of them so it would look nice and be more stable.

then place the headers like you would any component and solder from beneath.

.

L1 and L2 are connected to arduino pins 5 and 6 respectively which control motor (A) on pins 2,3 of l298 (forwards and backwards).

L3 and L4 are connected to arduino pins 9 and 10 respevtively .which control motor (B)on pins 13,14 of l298(forwards and backwards).

.

.

.

.

When your done with the hardware you can move on to the next step.

 

Step 2: Decode an IR remote.

Picture of Decode an IR remote.                                                        images.png524b36e8757b7f3d6c8b4567.png

the only part you'll need for this step is an IR receiver .

you could either buy it or salvage it from and remote controlled device (tv,dvd ..etc).

pin1 of IR receiver goes to pin 11 of arduino , pin2 to ground ,pin 3 to +5v.

that's everything for the hardware ,now upload the attached file "IR-Decoder" to you arduino and open serial and make sure the baud rate is 9600.

now get a remote and start clicking you should start getting values on the screen.

you need 2 buttons for the forwards direction(increase and decrease speed), 2 buttons for the backwards direction(increase and decrease speed),and 1 button for stop.

you choose whatever buttons you need .

NOTE:Some of you may have noticed that if you press the same button for a long duration you'll get a different value which wont work in the code ,so you have to click the button gradually not continuously .

i found a lot of tv remotes that give you the same values while pressed for a long duration(example: sony),you just need to keep testing remotes.

the code will work fine even if you don't find one but its better and faster this way.

.

.IMPORTANT NOTE:

if you get an error while uploading the file just go to the directory of your arduino and remove librariesRobotIRremote"IRremoteTools.cpp" and librariesRobotIRremote"IRremoteTools.h"

.

now take note of these button values and move on to the next step .

http://www.instructables.com/files/orig/F7W/ZJK4/IEVUQZKG/F7WZJK4IEVUQZKG.txt

 

Step 3: Updating and uploading the code.

now we're done with the IR-Decode file,we don't need it anymore,we only need the values that we noted.

now take these values and place them here but in the code(attached file):

#define upi 0x"value" ...(up increase)

#define upd 0x"value"... (up decrease)

#define Stop 0x"value" ...(stop)

#define downi 0x"value" ...(down increase)

#define downd 0x"value" ..(down decrease)

replace the ones in the quotes " replace" .

if your decoding and you get letters and numbers at the same time you have to place a 0x at the beginning,if you only have numbers don't place it. 

so now connect everything up ,place the shield on the arduino solder the IR Reciever pins as described before on the shield,connect the usb ,upload only the motor-shield-dual-motor-variable-speed file which you modified.

and after uploading open Serial and check if your getting feedback and attach one motor at a time because the arduino alone cant handle two motors so it starts glitching.

after checking everything remove the usb cable connect an external power supply (12-18vdc)

and test both motors at the same time .

note:

if your motors arent rotating in the same direction and you dont want to flip the pins on the arduino or change the pins in the code just reverse the polarity of the motor 

.IMPORTANT NOTE:
if you get an error while uploading the file just go to the directory of your arduino and remove librariesRobotIRremote"IRremoteTools.cpp" and librariesRobotIRremote"IRremoteTools.h" .

UPDATE:

i updated the code so that if your going forwards and u suddenly went backwards without stopping u'll momentarily stop and start reversing and no matter how many times you pressed forwards and backwards without stopping you'll start from initial value or speed 0.


and that's all folks!


hoped you enjoyed this instructable feel free to comment and FOLLOW!

happy instructables :)
 

http://www.instructables.com/files/orig/F6U/93U6/IEX52IBK/F6U93U6IEX52IBK.txt

 

Step 4: update

Picture of update

if i get good feedback on this instructable i'll do a follow up instructable that features a self navigating rc car with diy IR proximity sensors, and i'll also share my arduino code and explain how to modify it if you want to add more sensors for better navigation.

Leave a Reply