I designed this project for a 10-hour workshop for ChickTech.org whose goal is to introduce teenage women to STEM topics. The goals for this project were:
With those goals in mind, here were a couple of the design choices:
Here is the robot that came closest to what I wanted to do: http://mirobot.io. I don't have a laser cutter and shipping from England was prohibitive. I do have a 3D printer, so I guess you can see where this is going . . .
Don't let the lack of a 3D printer deter you. You can locate local hobbyists willing to help you out at https://www.3dhubs.com/.
It took a lot of work, but I'm please with how it turned out. And, I learned quite a bit in the process. Let me know what you think!
There are a number of ways to power, drive, and control robots. You may have different parts on hand that will work, but these are the ones I've tried and found to work well:
*Note: See the last step for a discussion on using regular Arduino or Raspberry Pi boards.
3D-Printed Parts (check out www.3dhubs.com if you don't have access to a printer):
Tools and Supplies:
Before we get too far into construction, lets load the test firmware on to the microcontroller. The test program just draws for boxes so we can check for proper direction and dimension.
To talk to the Trinket Pro, you are going to need:
Lady Ada and the Adafruit team have created a far better set of instructions in the links above than I can provide. Please use them if you are stuck.
Note: The one trick that makes the Trinket different from regular Arduino is that you have to reset the board before uploading the sketch.
Note: Unless specified, the remainder of the screws are 3Mx8mm pan head srews.
Troubleshooting: If the microcontroller lights do not come on, immediately turn the power off and troubleshoot:
Male header pins allow us to connect the 5-pin servo JST connectors to power and the darlington driver (Image 1):
Before the wiring gets to complicated, lets get the servo wired up:
Time to wire power for the darlington driver and steppers, which will be driven directly from the battery:
Note: The red lead of the stepper connector is the power and should match the red leads on the breadboard.
Now we will connect the stepper signal wires from the microcontroller to the input side of the darlington driver:
Hopefully you already uploaded the firmware in Step 2. If not, do it now.
The test firmware just draws a square repeatedly so we can check direction and accuracy.
If you are not seeing lights on the microcontroller, go back and troublshoot power as in Step 8.
If your robot is not moving, double check the power connections to the darlington driver in Step 9.
If your robot is moving erratically, double check the pin connections for the microcontroller and darlington driver in Step 10.
If your robot is moving in an approximate square, it is time to put some paper down and put a pen in it (Image 1).
Your calibration points are:
float wheel_dia=66.25; // mm (increase = spiral out) float wheel_base=112; // mm (increase = spiral in) int steps_rev=128; // 128 for 16x gearbox, 512 for 64x gearbox
I started with a measured wheel diameter of 65 mm and you can see the boxes rotating inward (Image 2).
I increased the diameter to 67, and you can see it was rotating outward (Image 3).
I eventually arrived at a value of 66.25 mm (Image 4). You can see that there is still some inherent error due to gear lash and such. Close enough to do something interesting!
We've added a servo, but haven't done anything with it. It allows you to raise and lower the pen so the robot can move without drawing.
The servo angles can be adjusted either by removing the horn and re-positioning it, or through the software:
int PEN_DOWN = 170; // angle of servo when pen is down int PEN_UP = 80; // angle of servo when pen is up
The pen commands are:
I hope you made is this far without too many curse words. Let me know what you struggled with so I can improve the instructions.
Now it is time to explore. If you look at the test sketch, you will see I have provided you some standard "Turtle" commands:
forward(distance); // millimeters backward(distance); left(angle); // degrees right(angle); penup(); pendown(); done(); // release stepper to save battery
Using these commands, you should be able to do just about anything, from drawing snow flakes or writing your name. If you need some help getting started, check out:
Could this robot be done with a regular Arduino? Yes! I went with the Trinket because of the low cost and small size. If you increase the chassis length, you can fit a regular Arduino on one side and the breadboard on the other (Image 1). It should work pin-for-pin with the test sketch, plus, you now can get to the serial console for debugging!
Could this robot be done with a Rasberry Pi? Yes! This was my first line of investigation because I wanted to program in Python, and be able to control it over the web. Like the full size Arduino above, you just place the Pi on one side, and the breadboard on the other (Image 2). Power becomes the primary concern because four AA is not going to cut it. You need to provide about 1A of current at a stable 5V, otherwise your WiFi module will stop communicating. I've found the Model A is much better on power consumption, but I'm still working out how to supply reliable power. If you figure it out, let me know!