Hi,
This is my first project, a basic object avoiding robot based on the Start Here tutorial, but using Arduino.
It uses an IR sensor to detect objects and decides which way is best to go, when it goes somewhere dark it will turn around.
I've made some changes to the code and the build of the robot, changed the build to make it a little bit tidier, but also needed to make it a bit easier for the robot to turn. Main reason to change the build though was that everything was stuck together using foamtape, which was fine, but this included the arduino. I'm planning to use the arduino on my next project, but still want to be able to easily switch it back to this bot, so have made it sit in a little box so it's easier for me to swap it round.
My (inefficient) code is attached, and list of components below:
- Small Servo (9g) - SparkFun
- Arduino Uno R3
- AdaFruit motorshield for Arduino
- 120:1 Gearmotor (x2)
- 2x wheels (bottom of coke-cans)
- Infrared Ranger (GP2Y0A21)
- 1x 9v battery (to power Arduino)
- 4x 1.2v 2900mAh NiMh AA batteries (to power motorshield)
- A low resistance LDR
- A lot of wires and an on/off switch
Current problems/Next steps:
- One of the motors tends to spin faster than the other, I'm trying to correct this through the code, but want to find out whether there is a hardware or wiring solution to this issue as well.
-- Still correcting this in the code, which seems to work well now
- The distance returned by the IR sensor is not in a specific unit of measurement, I'd like to correct this to measure cm's, but am not sure how the voltage that goes through is different from when the robot is connected to my pc via USB versus when it's driving around autonomously.
-- Drew up the graph of the distances the IR measures and their metric equivalents, so I at least now know that the robot will change direction when something comes in closer than 15 centimeters
- The 9v battery powering the Arduino board only has about 15minutes of good life in it, not sure if this is something to do with the nature of the battery, Arduino, or my code.
-- Soo, none of those! Based on the comments I'm blaming my servo, but have also got a new rechargable 9v which seems to last a while longer
- Planning to add some tactile push button switches to detect when the robot drives into something, just waiting for these to come through in the post now...
-- Am actually not going to bother as the LDR is pretty much fulfilling this function now
So I'm basically considering this project to be done now (I know it is actually not completely done and there's lots of other things I want to try to do with it, but I also want to move on to a new walker-type robot project, I'll put a link in here once I've decided what it's going to be and do and stuff.
Navigate around avoiding obstacles via IR, and is "afraid of the dark", moves away from dark places using an LDR
- Control method: autonomous
- CPU: Arduino Uno R3
- Programming language: Arduino Processing
- Target environment: indoor
This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/project-1-object-avoiding-robot-thats-afraid-of-the-dark