Remote Contol Car

Goals

My initial goal with this project was to modify a remote control car to be controlled by an Arduino. After that was accomplished I decided to make the car a sort of test bed for trying out various types of sensors.

Circuit Bending Attempts

In the beginning I wanted to be able to control the car with both the Arduino and the 49 Mhz remote it came with. This model was made to be able to run on top of water so I had to crack open the plastic housing protecting the main circuit board. I discovered that I could indeed inject a signal to make the car’s circuit board run the wheels. I managed to find the four places I needed to tap to get the car’s wheels moving forward and backward with a +5v signal.

Original Circuit Board

As I soldered on wires for the signal injection I kept testing the car kept working using the remote control. The points on the circuit board I found were inputs to the base of transistors used in the control circuity. All but one point had fairly large surface area for me to attach the small wire. The last point however had me trying to attach to a SMD resistor or the transistor itself. I ended up burning and short circuiting the transistor and the resistor. The failure was a combination of the fact the board was very cheaply made and that I may have had too much heat from my iron. I replaced the transistor with a through hole version, but the solder pads of the cheap board came loose eventually. It was all for naught anyways since the one troublesome connection point, when it did work move the wheels slower than the other places.

Circuit Connections

H-Bridge

After giving up on the circuit bending approach, I threw away the broken board and decided to go with building a h-bridge circuit. I tried a circuit described on the Robot Room website. It did get the wheels moving, but only after giving them a bit of a nudge. It was not delivering enough current to the wheels. The problem was likely the batteries as well as the limitations of the transistors I was using.

Battery

I chose to get rid of the three AA batteries that the toy came with and instead use a Tenergy 9.6V 2000mAh NiMH battery that I ordered from Amazon. I also ordered a charger and a Tamiya battery connector so I could leave the battery unmodified for use with the charger. Another reason for choosing a 9.6V versus 7.2V battery was because of the voltage requirements of the motor shield I eventually ended up buying.

Battery

Physical Modifications

I had to modify the toy car body to make space for the battery. I used my Dremel tool to cut out the old 3 AA battery holder. I had to use some pliers to pull out the metal contacts to make it much easier to just slice through the plastic. When I finished I tried closing the top with the battery and found that the battery is a bit too thick. The screws used to connect the two halves of the body were long enough that I could screw them into their holes and pull the two parts of the car together. But this solution does leave a small gap.

Body cut away

I also replaced the cheap on/off switch with a much better DPDT one that I had in my parts box. I had to dremel away some the plastic near the switch to make it fit. I soldered the Tamiya connector and some 16 or so gauge or so wire to the switch. Using the gap in the body to my advantage I have the Tamiya connectors for the battery and switch fished out the back of the body so I can disconnect them during charging.

Better switch

The car originally had a hole where it's antenna was routed out of the body. I made an identical hole with a drill on the other side of the body and used both wholes to route the motor wires to the outside.

There was originally a roundish covering, for looks, over the place where the battery compartment was accessed. I got rid of this and then cut off the screw hole for the covering to make a flat place to stick a small breadboard. I added some velcro to the top of the old battery compartment so I can attach my Arduino.

Motor Shield

I purchased a Seeed Studio motor shield from Radio Shack because it was the same price as they sell online. It uses a fairly powerful full bridge motor controller with a nice big heat sink attached. This sits atop my $9 Arduino from the Borderless Electronics IndieGogo campaign. The controller has so far proven very capable and the heat sink does get a bit warm with extended use, so you know a fair bit of power is being routed to the motors. It is unclear to me how the thing ever moved with 3 AA batteries. My only reservation with this shield is the use of Grove connectors.

http://www.seeedstudio.com/wiki/Motor_Shield_V1.0

Motor Shield Battery

Grove Connectors

The limiting factor of the motor shield is the use of the so called Grove connectors. I wanted to order some from Seeedstudio but they were out of stock. So I tried ordering a housing and tins from Digikey. I saw in a Seedstudio message board that the matching connector was something like Digikey part A100021-ND. When I got the housings in the mail I tried inserting one and found it did not fit, it appears to be the exact same connector used on the old CDROM audio cables. But I found that if I cut off the protruding part from the front bottom and extend the square bevel on each side down I can make it fit snuggly in the connector onto the board.

Sensors

I first put three photo resistors on the car, two in the front and one at the back. The two on the front are intended to be able to control forward direction, left or right. The one on the back will allow the car to back up, or might get used for ambient light level sampling for the front two.

I had a bunch of CDROM audio cables laying around and thought I could use them with the Grove connectors. But despite them being the right width and despite sanding down the height they still did not go into the board's connector enough to make a electrical connection. I ended up pushing the crimped pins out of the white CDROM connector. I just plug these female pins into the Grove connectors individual male pins and then into the breadboard. I utilized the black flat connector end to plug the photo resistors into them. They are fastened down with black electrical tape on the front of the car body. The photoresistors are using a 10K resistor in the connection to ground.

I bought a HC-SR04 ultrasonic distance measuring circuit from Ebay. I created a custom cable using a 4 pin flat connector to a connector to go into a Grove socket on the motor shield. I attached the sensor to the front of the car using hobby wire fished through the four screw holes on the board.

Control Logic

My first algorithm for the car was a simple follow the light algorithm. It looks at the average of light levels for each sensor over the last 10 cycles. If the light levels increase over a tolerance from the average for a sensor then a particular function will get called, for instance turn left for the left photo resistor. Using a flashlight works, but also chopping your hand in front can make it move as it changes the average light level. But this method of acting on sensor input works best in a dark room, where the average light level can fall down quickly. Due to averaging on each sensor independently, after awhile the car will stop reacting since the light source has become the average light level. I was able to somewhat direct the cars movement with a flashlight in a darkened garage, but it found it much harder to control in a room with regular lighting.

My first attempt at using the ultrasonic sensor just had the car stop whenever the distance it measured was lower than a certain threshold. I found that to counteract the momentum of the car, I had to throw it into reverse for a short period of time to perform braking before the car actually stops.

I also created calibration routine that runs the car through various motor driver speeds and durations of travel in order to calculate the car's real linear speed. But that work was probably useless as since these are just DC motors and not steppers, I have no real fidelty of control over them.

Code

I have been using the Ino command line tool to interface to the Arduino instead of the IDE since I can use vim and work faster. My code on Github is therefore an Ino project and needs it to compile. I have tried to organized the code for the project with the intention of adding more sensors.