Remember our garbage collecting friend WALL·E? Well this guy right here is his younger cousin, and his name is Roll-E. This is officially my first instructable, so please be kind and let me know any mistakes I may make.
No one likes to read long instructables without images so I tried as much as possible to add a lot of images to make building this robot easy. I also made the instructable as short and straight to the point as possible [just four steps].
The instructable is going to be in four parts;
- Electrical Connections
Lets dive in .....
Step 1: Materials
- Arduino Uno (x1) - This would be the brain of our robot.
- Motor Shield (x1) - For driving our geared motors, you could use an L293D chip to do the same thing, if you know how. I chose the motor shield because it is relatively easier to use, plus it gives room to add on more motors for enhanced functionality.
- Geared Motors (x2) - Would move the motor around.Connecting wires - You would need a couple of these.
- Robot Tires (x2) - These would be acting as our wheels.
- Mini Breadboard (x1) - For building our circuit easily without the need to solder.
- Cool looking printed circuit board (pcb) from old electronics - This would be the chasis of our robot, it doesn't serve any intelligent purpose, its just cool looking and upcylces old electronics.
- Balls from roll on deodorant [with ball holder] - This would be our version of an omniwheel :)
- HC-SR04 Ultrasonic sensor - For obstacle avoidance.
- Switch (x1) - For turning robot on or off.
- Connecting wires - For building circuits.
- Hot glue gun - I think you know what this is used for.
Step 2: Assembly
First take your cool looking pcb and mark where you would want your arduino to lie on it, using a marker. Remove any existing components to make room for your arduino.
- Place your Arduino on the pcb, using the screw holes on the Arduino as a guide, mark points on the pcb so you can drill holes on the pcb were you can use any suitable generic screw to attach your arduino board to the pcb. Using a screw allows you to remove and reattach the Arduino from the pcb easily. If you don't have a drill you can make the holes using a screw driver, press the screw driver against the marked part and gently apply pressure while turning the screw driver.
Note: make sure to place an insulating material between the arduino and the pcb to prevent existing connections on the pcb from short circuiting the arduino.
2: Using your hot glue gun, glue the mini breadboard to your desired part of the pcb, note that the ultrasonic sensor would be on the breadboard and nothing should block it, to enable it detect obstacles.
3: Warp connecting wire around terminals of motor, test your connection to make sure motors work then support with hot glue. After doing this attach the tires to the motors.
4: Flip the pcb [with your arduino and breadboard attached] over and hot glue the omni wheel and motors to the back. Refer to the images to have an idea of how to do this.
For a faster build you can forget the screws and just use a hot glue gun to hold everything together. If done correctly the glue can act as an insulator for the arduino.
Step 3: Electrical Connections
You are done with the build for now. However, we would stack the motor shied on the arduino after we have done some initial wiring.
For the electrical connections we have to wire up the HC-SR04 ultrasonic sensor, a button with a pull down resistor to the arduino. Then we would connect our motors to channels M3 and M4 on the motor shield and stack the motor shield unto the arduino, crunching the wires from the ultrasonic sensor and button in arduino pin 13, 12 and 8 respectively.
The connections for the HC-S04 ultrasonic sensor, button and pull down resistor are shown in the images 1 and 2. The 10k-ohm resistor connects the pin to ground, this is done so that the pin would read LOW in the arduino when no voltage is flowing in through the switch.
The motor shield I am using is the version 1 of the Adafruit motor shield, irrespective of the motor shield you are using whether v1 or v2 or a derivative I don't think the connection would vary much from what I did. For the motor connection, just connect the left motor wires to the M4 terminals of the motor shield and the right motor to the M3 terminals[it doesn't really matter what channels you connect them to, I only specified because of my code]. Refer to image 3 and 4.
Ps. Image 4 (Schematic motor connection) is not mine, I didn't have time to sketch one so I obtained it from https://www.safaribooksonline.com/library/view/mak...
After making your connections, stack the motor shield unto the arduino.
Step 4: Code
Before you can run the code you need to install the AFMotor.h library. That is the library for the motor shield. To do this follow the link below it has steps to do this and also has a link where you can download the library files from.
AFMotor.h library install link - https://learn.adafruit.com/adafruit-motor-shield/...
After installing i recommend you check out the dc motor class of the library reference to know how to use it. Follow the link below for the reference.
AF_DCMotor Class reference link - https://learn.adafruit.com/afmotor-library-referen...
I have attached the arduino sketch file for the code below. While running code open serial monitor to track if the code is running as it should.
Thats it guys you are done, please let me know how i can make this instructible better and any problems you may have in the comments box. THANKS