Mini Robot Cart – Part One
This is the third robot cart I have built and arguably the best and most versatile. I wanted to see what I could fit in the small Jiffy Box and still work as robot cart. (actually the term robot is technically incorrect, remote control would be better in this instance) In my opinion it was successful because the grandkids had fun playing with it for over 2 hours, taking pics, turning the lights on and off, driving it in the dark.
The brains of the cart is a RaspberryPi Zero. Which sets itself up as a WiFi HotSpot. Connect to this via a web browser, camera video is displayed and cart movement can be controlled. The LED lights can be turned on and off and pics taken and displayed (up to 9). The cart also plays 1 of 29 audio files randomly selected at random times.
The motors were the 2nd slowest I could find. Previous carts had moved too quickly. Probably the motors are too slow because it takes a long time to get anywhere. But the motors do not use much current (5V 22mA no load each) and are well within the spec of the motor driver. (200mA)
Each motor has an encoder which can be used to tell exectly how far the motor has moved. With a 4.3cm diameter wheel I calculate one encoder pulse represents 0.07mm of travel. In reality it is not that accurate.
Originally I programmed the Pi to record encoder pulses which could then be played back. ie you move the cart in a certain pattern which the cart can then repeat by itself. It was not very successful. Many factors like wheel slippage on surface, possible missed encoder pulses, slight variation in motor movement. Testing with no load showed encoder pulses can vary by as much as 5% over the same time period.
Motor Speed Variation
Testing with no load revealled the motor speed was different by 6.5% between the two motors purchased. When running on the floor the cart would turn slightly in one direction when it was supposed to be moving forward. So, in the final design the encoder pulses were used to vary the speed of one motor to match the other. It does this continually and for each motor.
A secondary problem with the motors is they are horizontally opposed, one moves clockwise, the other counter clockwise. There was a noticed speed difference between clockwise and counter clockwise in the same motor. The orientation of the motors was chosen to produce the least diffence in speed when the cart is moving forward.
Both motors sound very different too. One is much more noisly than the other.
The battery (7.2V 900mAH) was chosen, mainly due to its size. It fitted neatly in the available space. It has more than enough power to run the device for over 2 hours as the grandkids playing with the cart demonstrated. Peak power usage is around 340mA when the motors are running, 270mA when a web page is connected, 140mA no page connected. (IMHO the Raspberry Pi is great device but a power hog).
Charging the battery was an issue, having to remove the panel of the case to get access. The two jumper pins on the side near the wheel allow access to charge the battery without the panel removal. They also allow powering of the unit via an external supply for bench testing of software.
A Pololu 5V 2.5A power supply board was used to convert the battery 7.2V to a level acceptable to the Pi, sound amplifier and other bits.
Part Two Parts List.
Part Three Software.