My First Robot (Learning from Failure)

Jun 16, 2014 by     Comments Off    Posted under: Roads & Rails Blog

Mobile Autonomous Mercury Project

 

Early Robot with 3 sensors up front, fed to Grove connectors in Motor Shield.

Mobile Autonomous Mercury with Sensor Grille

 

I recently decided to do my first Arduino robot, using found items and my own design. My father had a very nice looking 1950 Mercury remote control car. It looks good, is quite roomy on the inside and seems to run well. Because it was so cool looking, I decided that maintaining its overall look would be a priority. Removing the remote circuitry left the drive motor, the steering motor, and a DPDT switch I would use to turn the entire robot on and off.

 

The robot design uses 3 ultrasonic rangefinders arranged in a ‘chicken-foot’ pattern: one forward, two angled 45 degrees to each side. (In the final build I believe the angle was 30 or less). This arrangement sat on the bumper and replaced the chrome grill piece.

The initial logic was simply to move the car towards the longest of the three ranges. I chose the Seeed Studio Motor Controller (Model 1) to power the motor and do the steering. The steering motor was similar to a servo but not precisely; as long as the motor is driven, the vehicle steers, and returns to straight forward otherwise. I felt the Motor Controller could do both.

As a bonus, this Motor Controller introduced me to the Grove connectors promoted by Seeed Studio. This is a simple 4-pin connector that has a 5 volt connection, a Ground, and two pins . It has made my build much cleaner and eliminated the need for 2 barrier strips for Ground and 5 volt connections. I did not actually buy Grove components, but instead bought a package of Grove cables and soldered on my cheap ultrasonic sensors. In time I would introduce other components with Grove cables as the design progressed.

Initial tests were good. The first test involved having the car go forward and stop before hitting the wall, a kind of robotic ‘Hello World’. Then the turn code was added, but didn’t work. The problem lay in the Motor Controller trying to run the steering motor.

I tried to get the steering motor to work for about a week before deciding to cut it loose from the Motor Controller output (the Motor Controller can run 2 motors independently) and instead use relays to drive the motor back and forth. It is a typical arrangement: one SPDT to turn power on/off, and a DPDT to determine polarity. Both were connected to a single Grove connector. This solved the steering problem and suddenly my little creation was turning and avoiding obstacles with about 50% accuracy, which was pretty good for a start. What was irritating was the fact that my baby was now hitting walls, which upon observation turned out to be a matter of over-steering.

The chicken foot sensor spread was causing the car to turn right away. The machine has no awareness of the past, and works entirely in the moment. It became important for the machine to wait before turning, and this meant that the program would have to be informed how far the wheels had rolled, and how far they should roll before executing the turn.

At first I thought the forward sensor, pinged additional times, could provide a running count of distance crossed, but in open areas where the maximum range is exceeded would prove difficult to handle. In any case the idea did not work, and I decided to use the method bike computers use to find speed and distance: a reed switch.

Bike computers use a magnet on the wheel and a reed switch on the bicycle fork to count the number of rotations. Knowledge of the wheel circumference and rotations in time gives speed and odometer readings to the rider. Getting the reed switch proved to be easier than getting a magnet that worked, and once they were secured I had to arrange them in the wheel well. I soldered the appropriate connections to a Grove cable and attached this additional sensor to my Arduino. The tiny Radio Shack rare earth magnet slid into my wheel securely after a little cutting to make a pocket for it, and it clicked quite nicely. The two have to be close: I tried mounting a reed switch over the wheel well and determined that the magnet needed to trip it would be too heavy and too strong for my needs. By the way reed switches are often fragile and made of thin glass, so buy 3 if you plan to to use one. Fortunately they are also dirt cheap.

CONCLUSION

After months of experience, it has proven impossible to obtain proper control over either engine or steering, probably due to the low quality of the car. The engine and the motor control shield are also a bad match and produce a terrible whining noise.

I have decided to build my own robot body, rather than use a ready-made one, using geared electrical motors I am familiar with from animation building at the museum. It will be able to rotate in place like a tank, instead of having one set of wheels for steering and another for speed/direction. That will be another blog post.

 

Roads & Rails Photo Gallery

dsc0003 img_5270 matt-dad sam_5050 sam_5749 sam_6207 sam_6219