This tutorial was extracted from Erich Styger blog http://mcuoneclipse.wordpress.com with his agreement.
I have the Arduino Motor Shield working, the Ultrasonic module is pinging around, Christmas brought some small DC toy motors, and a bag of plastic gears is on my desk. All the good ingredients for a small robot: the Freedom Robot!
Warning: Multiple Coke bottles have been destroyed, and a FRDM box got hurt during his experiment! Do not try yourself if you cannot handle it.:-)
What I have in mind is to build a small autonomous robot wandering around in th house. Well, ok, at least on table or on the floor of my office. At least it should move . Similar to the many robots on ‘Let’s make Robots!‘ web site which I enjoyed watching.
Budget
After all the Christmas expenses I wanted to do things with a small budget: this means re-using as much as possible, or recycle material available in the house. A given is already the FRDM-KL25Z board for about $15. I want the robot to do something ‘useful’, so I want to re-use the HC-SR04 ultrasonic sensor (around $10). And I have that Arduino Motor Shield available, although it adds another $25. So that would already make $50 of purchased parts.
To build an autonomous robot I’m missing wheels, a chassis, motors and batteries. And for this I want to recycle existing material.
Motors
Small DC motors are very cheap (around $2). But even better: they are in many toys and that way can be recycled. I have several around from old toys.
The challenge is more that I do not have a data sheet available. Experimenting with them showed that they work well in the 3V-8V range.
Wheels
Looking around for ’round things which could be used for wheels’, I was first thinking of using old CD’s. I made some experiments, but the two DC motors did not give enough torque. So I abandoned the idea and switched to a ‘small wheel + gear’ model. And a bunch of plastic wheel parts were available:
As wheels I have found that the plastic caps of soda bottles would be an option. So I have made my decision to use the caps as wheels:
I simply drilled a hole into the center of the cap, slightly smaller than the inner tooth wheel of the plastic gear. Then pressed the inner tooth wheel into the cap. To compensate the distance, I used a metal ring.
Make sure you have several caps available. I destroyed several ones until I have found the ‘perfect’ fit. Alternatively it is possible to glue the tooth wheel to the cap.
Then the wheel gets put on a metal rod:
Chassis
Question: What could be the chassis for a Freedom Robot?
Answer: The Freedom Box!
Actually, the FRDM-KL25Z cannibalized the box of the FRDM-KL05 board :
The metal rod is going through the box. And a second rod with gears gets added. Both rods get drilled through the box.
The two DC motors get mounted on top of the box.Two rubber bands help to keep the motors in place:
Two wheels are not enough: something else is missing to stabilize the chassis. One way is to use a third wheel, or to use a ball or similar which rolls on the ground. I have found that the plastic caps are usable too: they are cheap and available, and serve as a ‘ground slider’ if there is not much friction:
With a cap I draw a circle and cut it out. To attach the cap, I have cut the top-most part of an (empty!) bottle:
Then the cab gets mounted:
Power Supply
For an autonomous robot, batteries are needed. The Arduino Motor shield has a dedicated motor power supply connector, and it can pass the motor voltage to the FRDM-KL25Z board.
In general it is a good idea to separate the motor power from the microcontroller. To keep things simple, I used only one battery.
But this would only give 3.3V to the FRDM-KL25Z, and no 5V which are needed for both the motor shield and the ultrasonic sensor. The FRDM-KL25Z has a coin battery holder, but again: no 5V .
The best option I have found is to give 5V through the USB connector (either OpenSDA or KL25Z). For this an old L7805CVpositive voltage regulator from STM was right at hand. To connect it to the Freedom board, a USB cable got hurt for writing this article:
As battery a LiPo with two cells (7.4V) is used to power the motors, and the L7805CV generates the 5V for the Freedom board:
Battery Compartment
Why not place the battery inside the freedom box? The black ‘inlet’ box could be easily used for this:
Remember that the two metal rods for the gears are going through the outer box? Well, that means that I need to cut some parts of the black inner box to make it fit again:
The result is a U-shaped inner box, with that U just fitting above and blow the two metal rods:
That way the inter box fits into the outer box:
While the sliding of the cap on the underground is desirable, it is not good for the wheels. For this I pulled rubber bands over the wheels:
I loved the look and feel of the original caps. I feel that the rubber bands ruined the look .
Finishing Robot
Two rubber band safety belts keep the Freedom board in place:
The Motor Shield and the Ultrasonic Module get stacked onto the Freedom board. And the battery fits easily in the inner box compartement:
With this, here is it: the Freedom Robot:
Oh, yes, one more thing: my daughter thought that this way the robot is *much* better:
Summary
It might not be the most robust and advanced robot, but creating it in an afternoon was not too hard, including programming a small demo application. So this might be even something for junior programming and robotics projects. The most expensive part is the Arduino Motor Shield. I was just lacy to build a cheaper one (time is money too).
As always, there are multiple ways for improvements:
- Use motors with built-in gears: more expensive, but simpler to use
- Build a 4-wheel chassis
- Use toy rubber tires
- Add a position/wheel/quadrature encoder/decoder
- Use the accelerometer to detect obstacles (running into it), or use it to sense the ground
- Separate battery pack for the microcontroller
- Adding more sensors
- Improving the moving options
- Experiment with beer caps instead of soft drink ones
- Try different post-it