BBF (Bigger, Better, Faster)
May 5, 2013 update
My robot has incrementally improved as I continued to learn what I could do with the arduino. I followed a lot of your advise and removed all the delays from the main program, yet I still wanted more speed. The local Microcenter store was having a sale on the arduino stuff, so I bought a second unit and connected it in tandem to the first using the I2C protocol.
I still have not used the infrared sensors as I found the range was too limited. The master arduino carries the bluetooth shield and runs the main script. It has 2 modes, MANual and AUTOmatic. Manual mode simply makes the car an expensive RC toy, with all instructions coming from my Android phone via BT. The "microcontroller BT" app from KVNDEV in the Google Play Store was a perfect way to implement this mode. It has a decent dynamic inerface for creating buttons and sliders. But with all this fun gear, I wanted more than just an RC car ;-)
The drive portion of the car came from China (of course):
http://www.ebay.com/itm/4WD-Robot-Smart-Car-Chassis-Kits-car-with-Speed-Encoder-DC-3v-5V-6V-for-Arduino-/180914530167?pt=LH_DefaultDomain_0&hash=item2a1f58a777
It came with 4 DC motors that I drive with 2 Banggood Dual H Bridge DC Stepper Motor Drive Controller Board Modules (L298N) bought from Amazon. I can drive each motor independently if I want, but for now, I just drive each side.
I have 4 optical speed sensors installed, but not connected. I've found that the cheap tires/wheels tend to spin a lot, and measuring distance is a bit worthless with them. Having cheap tires also caused the car to get stuck a lot as it traversed from wood to carpet, and I had to find a way to tell if a "turn" order had been completed, so I installed a compass module. The first module I ordered was a Seeedstudio Grove 3-axis Digital Compass. I had absolutely no luck with the unit - it would never show anything close to a zero-degrees no matter which way you pointed it. I ended up ordering a Sainsmart unit ($15 cheaper) and it works great.
Since it's a bit of a pain to monitor both arduinos via serial port at the same time, I added the SD card shield to the slave arduino. This also gives me the opportunity to log all the processes while it runs in auto mode, giving me some insight to what's going on when something goes wrong. I have a "reset" button on my android that sets the speed to zero and closes the file on the SD card.
The big LED headlights were added after I was playing around with it in the near-dark. The motor controllers already have a red LED, and they look like tail lights.
The following picture is the latest version with both arduinos mounted and compass module installed.
Here are older pics to show the motor drivers and battery location.
It's been a fun ride so far. I've learned a lot about coding, electronics, and I love working with the I2C stuff.
The code to run the car has been included. Opinions and constructive criticizm would be appreciated.
Object avoidance via sonar, scares the cat
- Actuators / output devices: 4 DC drive motors, 2 servos for pan/tilt
- Control method: controlled by android phone via bluetooth (Microcontroller BT from Play Store)
- CPU: 2x arduino unos
- Operating system: C
- Power source: 12V Battery
- Sensors / input devices: DAGU IR Compound Eye, seeedstuido ultrasonic ranger finder, SainSmart HMC5883L Digital Compass Module
- Target environment: indoor