Small Robot – Assignment 6
I have been wanting to make a robot for quite some time, so this was a perfect opportunity. Its fairly simple, it just does its best to stay a set distance away from things in front of it. It will backup or move forward accordingly. He also gets scared when its dark, and spins in circles. I’m sure there was a lot I could have done better, but it was quick dirty, and a lot of fun.
1 Sharp IR Sensor
2 DC Motors
1 Arduino Mini Pro
4 AA Batteries
1 Photo resistor
1 H-Bridge (I have a few of this one, but a L 293 H Bridge is the same)
2 Wheels (I used gears I laser cut,but they didn’t have enough traction, so I hot-glued mat board to them)
Some Wood for the frame.
More info and pics after the jump…
Construction is pretty simple, its a simple wood frame, with a breadboard hot-glued to it. The hardest part is the wheels, I didn’t feel like buying any, so I laser cut gears, so it would serve a dual purose, they are cut to fit the drive side of the dc motors we got, Solarbotics G3’s I believe.
The circuit is kind of a mess in this diagram, but here’s a general rundown. The H-Bridge takes in raw power for the motors, and 5v to power itself. It then accepts input from 4 arduino pins to control the motors. The IR sensor is hooked up to analog 0, the photo resistor to analog 1, motor one (via the H-bridge) pins 2+3, and motor 2 (via h-bridge) pins 4+5. The H-Bridge allows 2 motors to be controlled independently of each other, and in what ever direction is desired. (If you are lost on that bit, there are some great tutorials online).
Arduino Sketch: mti_assign_6
I use simple conditionals to check the robots distance from whatever is in front of it, and to have the robot respond accordingly. I’m not the greatest at explaining my code, but if there are any questions, let me know.