Open Source Turtle Robot (OSTR) : Instructables
Open Source Turtle Robot (OSTR) : Instructables
by MakersBox
including mechanical engineering, electrical engineering, and computer science. This project was designed as the basis
for a two-day workshop for high school age students to introduce them to engineering principles and giving them a
jumping o point for exploring their interests further. There is something for everyone here, even if it is just for the art it
creates.
back to William Walter’s robotics work in the 1940s which investigated complex behaviors in simple systems. Turtle
robots are generally slow moving with tight turning radiuses and can trace a design that shows their behavior over time.
What is Open Source? If you can look past licences and lawyers, Open Source is a philosophy
that ideas should be shared, and if you use an idea you attribute the originator, and if you improve on it, you should share
your improvement. Every part of this project, from the circuit board to the 3D designs, are available for study, replicating,
and improving. Not only that, but it was designed and programmed used Open Source programs like Arduino and KiCad.
All you would have to do is use a computer running Linux (an Open Source operating system) and print the parts on a
RepRap based 3D printer (an Open Source project), and you would have Open Source Turtles All the Way Down . This
project is certi ed as Open Source Hardware by the OSHWA.
This project is just the latest iteration of my “Low-Cost, Arduino Compatible Robot”, which in turn is based on the work of
others. The concept of two wheel drive with pen in the center is from the Mirobot. Improvements over the Arduino
version include a printed circuit board for ease of construction and robustness, infrared sensors for obstacle detection,
and a more compact and sti chassis for more accurate movement and lower printing cost. Rewiring port assignments
and rmware improvements help remove stuttering caused by Arduino’s digialWrite() ine ciencies.
In keeping with the engineering elds we are exploring, this project is broken into three distinct sections:
Disambiguation: I've published a couple of di erent drawing robots and it is getting confusing. Here is a breakdown.
https://youtu.be/ExhSeAjVGYc
Step 1: Parts
The current Bill of Materials with part numbers and URLs is located at: https://github.com/aspro648/OSTR/. A number of
components like resistors and capacitors are generic, so substitutions are acceptable. In general, the cost is about $60-80.
A kit for this project is available on Tindie.com. Purchasing the kit will save you the time and expense of ordering from
several di erent vendors and avoid the minimum PCB order premium. You will also be helping me develop and share
other projects in my workshops!
Electronics:
Electromechanical:
Chassis
2 wheels
Caster
Hardware:
Electrical Engineers deal with the application of electronics, electricity, and electromagnetism. The eld is broad and has
many sub-disciplines:
Power: Generation, transmission, and distribution of electricity, which could include solar, wind, and
hydroelectric applications.
Control: Electrical control of dynamic systems such as aircraft, automotive, or industrial automation.
Microelectronic: Dealing with the design and manufacture of the circuitry inside microchips used in
computers and cell phones.
Signal Processing: Dealing with the transmission and analysis of electrical signals such as in radar,
communication, or audio.
Instrumentation: Design and use of sensor systems to measure physical properties.
As part of an engineering team, Electrical Engineers need to work closely with Mechanical Engineers to ensure motors
and sensors meet system requirements. They may also work with Firmware engineers to help troubleshoot and repair
electronics as they are developed and tested with software.
A well designed circuit should be "build-able" by an experienced hobbiest based on the bill of materials and the PCB
silkscreen. For those of you who like to charge ahead, this graphic should be enough to get you past any quirks in the
design.
For the rest of us mere mortals, follow along and I'll discuss assembly in detail.
1. They are relatively heat resistant while you are getting into your soldering groove and the iron is coming
up to temp,
2. They have no polarity, so orientation is not critical, and
3. They are the lowest component on the board so sit tight when soldering when the board is ipped on it's
back.
Since these are our rst components, we'll cover them a little more in depth starting out. There are three pairs of two
di erent values:
Bend the leads to the width of the pads and insert the resistor.
The front end of the robot contains two sets of devices for detecting and indicating obstacles, one for the left side, and
one for right. From the outer edge working inward, we have an:
IR Detector (black),
IR Emitter (clear), and
LED (colored).
They each have polarity, so must be put in the correct orientation. I've tried to make it easy and have all devices with the
same orientation. Long leg goes through the square pad. Bend the legs so the device points toward the edge of the
board.
Match the holes with the leads and gently press them in.
Solder them in place and clip the leads.
The IC Socket is a small bit of insurance against putting the chip in backwards. It also allows a chip to be replaced if
needed (never had to on these boards yet).
The two stepper motors are connected using the white JST headers. They have two slot on one side that face outward.
There is also a small locating pin that ts in a hole in the circuit board.
Power from the two battery holders are connected via the two black terminal headers. The openings face outward as
well.
The control from the board comes from a microcontroller inserted in to two rows of 14 pin headers.
The servo is connected via a 3-pin header. There is a pin for power (+), ground (-), and signal (s).
Fold the leads at to the body so the speaker will be vertical when mounted (we ran out of board space!).
Insert the speaker and solder a single lead.
Flip the board and verify the arrangement is suitable.
Solder the remaining lead and clip ush with board.
The single IC on the board is a Darlington array, which is used to control the power going to the motors. From the
manufacture, IC pins are splayed slightly outward and need to be bent to 90 degrees to t in the holes.
The Adafruit ItsyBitsy connects to the motor board via two 14-pin female headers.
Cut the headers to length and insert them into the sockets with the short ends upward.
Place the ItsyBitsy onto the pins.
Ensure the the top (USB, microchip, and reset pin) are upward!
USB connector toward the edge.
Mechanical Engineers use physics, math, and material science to help design, build, and maintain mechanical systems.
Like Electrical Engineering, it is a broad eld with many sub categories:
Mechanics: Not the one who works on your car, but someone who studies forces and motion including
static and dynamic forces as well as uid dynamics.
Mechatronics and Robotics: The combination of mechanics and electronics in systems as small as the
drive ejection on the CD player and up to large industrial robots.
Structural Analysis: Dealing with how material and parts handle force and stresses.
Thermodynamics: Studying energy creation, ow, and transfer in systems such as engines, power plants,
and ventilation.
As part of an engineering team, Mechanical engineers would be responsible for designing the chassis and drivetrain of
the mechanical systems, working closely with the Electrical Engineers to understand the size and forces involved. They
would use computer assisted drafting (CAD) to create drawing and oversee their manufacture and testing of parts by a
machine shop or using 3D printing.
The Turtle Robot chassis was designed using CAD and 3D printed. The quick turnaround for 3D parts means an engineer
can rapidly test and modify parts to meet the system requirements or explore new ideas.
A current copy of printable STLs are located on Thingaverse. You will need:
1 Chassis
2 Wheels
1 Caster
1 Pen Collar
1 Nameplate (optional).
Again, a kit for this project is available on Tindie.com if you don't have access to 3D printing.
A "chassis" is the fame of a motor vehicle or other wheeled conveyance, and in this case the robot's chassis forms the
platform for the electronics, motors, and servos.
Time to get familiar with your hardware. We will be using three di erent types of Phillips screws you will have to be able
to identify:
In order to attach parts, we are going to embed M3 nuts into the chassis.
Integrating the electrical components like motors and batteries with the chassis will fall into the ME's domain.
Attach the battery holders using two M3 at-head screws and thread the wires through the openings
under the motor mounts.
Attach the circuit board to the chassis using #2x1/4 thread-forming screws.
If the screws wont start, remove the PCB and use the tip of the screw driver to open them
up a bit.
The servo is used to raise and lower the pen for drawing.
Place the arm on the hub and gently rotate the stepper counter-clockwise looking down on it until it
reaches the stop.
Remove the arm and position it facing left (this will be the down position).
Insert the small thread-forming screw and tighten.
Insert the servo in the mount with the hub end upward and attach using two larger thread-forming
screws.
Before we mount the stepper motors, check the t of the wheels on the shaft. These should slid on fairly tightly if your
printer is calibrated correctly.
If they are too tight, use a jewelers le to open up clearance. You can also heat the hub with a hair drier,
but do so sparingly to avoid warping the rim.
If they are too loose, you can use an M3 round-head screw to hold the wheel to the shaft (after the motor
is mounted).
We are going to pass the wires of the stepper (and servo) under the body to help with wire management.
Start with the left side and thread the wires for the stepper (and servo) through the opening with wires
Slip the o-ring into the rim groove and stretch it to snap in place.
Gently press the wheel on to the stepper shaft as far as it will go.
If the wheel is too loose on the shaft, you can drill a hole and thread a M3 round-head screw in the hub.
promoted the term "software engineering" during her The ItsyBitsy board
work on the Apollo program. The term "engineering"
was used to acknowledge that the work should be taken
just as seriously as other contributions toward the
advancement of technology. A software engineer is
responsible for writing and maintaining software used
to control electrical hardware devices such as cell
phones or systems in automobiles.
controlling the robot was designed and manufactured
Educational requirements vary, but include degrees in by Adafruit Industries in New York, a company founded
computer science, information systems, information by Limor Fried, also known as Lady Ada, a MIT graduate.
technology, or software engineering. A software Her company promotes Open Source DIY electronic
engineer would be expected to have familiarity with projects. Visit http://Adafruit.com for inspiration on your
electronics and mechanical systems. next project. The ItsyBitsy can be removed from the
robot and placed in a breadboard or other project and
As part of a robotics engineering team, the software reprogrammed to do your bidding.
engineer would be responsible for writing the code that
The current design uses the Adafruit ItsyBitsy microcontroller family, which come in a number of avors. These are the
ones that will work with the robot
The 32U4 is inexpensive, but it is a bit more di cult for beginners to use and limits you to using the Arduino IDE to
program it. Follow the link above to learn how to set it up. Firmware is located on Github, but I have not done too much
Open Source Turtle Robot (OSTR): Page 27
work on it other than to test basic functionality. Check the V1 rmware folder for C examples.
The M4 version is slightly more expensive, but is powerful enough to run Python which makes it the perfect platform for
beginners.
If you bought a kit from Tindie, the ItsyBitsy will come with the correct version of CircuitPython and be preloaded with
rmware and examples. You only need to install the Mu editor as outlined below:
Follow the Adafruit instructions to install the Mu editor. It recognizes the ItsyBitsy automatically and gives
us access to serial console and plotting.
The rmware was written to work with Circuit Python 4.1. Depending on when are where you get your
Itsy from, you may need to update it. Follow these instructions.
Download and unzip the Turtle Firmware and copy it onto your ItsyBitsy.
If all has gone well, the RGB LED on the ItsyBitsy should turn magenta while the current Python script is running.
If the board is plugged into the Robot Base, you should also hear some beeps.
If the batteries are installed and the power switch is on, the robot should exercise the servo motor twice
and then begin to draw squares.
If these do not happen, don't panic! Skip ahead to the trouble shooting section. If all else false, ask for help! I've done my
best to ensure your success, but if you have trouble you can help me improve it by helping me gure out why.
Because of variations in assembly and alignment, the robot must be calibrated so that it can move precise distances and
angles. This is controlled by two parameters, the diameter of the wheel and the distance between the wheels. While we
can measure these, they need to be tweaked a bit to get more precision.
The Python code to make the calibration squares is called "wheel_calibration.py" and is executed by the main " code.py"
script. Calibration parameters, if they need adjusting, are located in "calibration.py"
Remove the cap and slide the pen collar from the tip side.
Insert pen in holder with servo arm straight up.
Ensure the pen is just barely above the paper in this position.
If the pen binds in the shaft, us a le to remove any roughness.
Draw a square:
If the robot is turning too sharply (box is rotating clockwise), decrease wheel_base value.
If robot is not turning sharply enough (box is rotating counter-clockwise), increase wheel_base value.
Because of rounding errors in the stepping code and slop in the gears of the inexpensive steppers, you
will never get it perfect, so don't spend too much e ort on it.
The servo raises and lowers the pen. At the beginning of can try changing the min_pulse and max_pulse
the wheel calibration script, it raises and lowers the parameters.
servo twice. If it is not traveling between vertical and
horizontal, we can adjust the parameters in If you are unable to achieve the positions you want, you
calibration.py. may have to remove the servo, unscrew and remove the
horn, and readjust it's position.
If it does not appear to be moving a full 90 degrees, you
We are using IR because it is easy and inexpensive. The downside is that detection distance is short (several inches),
varies by surface re ectance, and is subject to interference from other IR sources like the sun.
This is a pretty complex project, and will likely give you ts at some point. I like to tell workshop participants that they
need to have:
Wheels do not move or stop moving during run for calibration step:
You have the left and right steppers plugged in to the opposite headers.
Ensure pen is free in barrel and will drop below the wheel.
Use a le to remove roughness and open barrel diameter.
Ensure pen holder is at the proper level hold the pen up.
Ensure servo points straight up during penup() command. If not, adjust PENUP angle in rmware.
If you are stuck, ask for help in the comments. I've done my best to make this a successful beginners project, but it is
complex. Asking for help lets me know what needs improvement.
For my workshops, we use the Hour of Code activity at GROK Learning: https://groklearning.com/hoc/activity/snow ake/
. It provides a gentle introduction to Python, Turtle commands, and loops.
Once the participants nish, they can create their own custom snow ake in the browser. This can be directly placed in
the "mySnow ake.py" template. The rmware also contains the nal snow ake example from the tutorial in
"turtle_snow ake_example1.py".
For younger students who may bene t from the simpler "block" programming style, I like the Code with Anna and Elsa
tutorial. Students can again create their own custom snow akes, but it will require a more experienced coder translate
the code from Javascript to Python. There is an example from the tutorial in "turtle_snow ake_example2.py". I have also
posted an Instructable about using the turtle robot with these on-line resources.
In addition, the following example scripts are available in the rmware folder:
Challenge Activities:
From the snow ake tutorial, create your own custom snow ake and put the code in my_snow ake.py
template.
In snow ake examples, use the function random.randint(low, high) to generate random number of arms,
angles, and/or lengths.
Modify turtle_font_example.py or turtle_cursive_example.py to write your name or a message. Could you
use random.randint(low, high) to create random messages?
In turtle_obstacles.py, the turtle only stops when sensing a wall. Write code to have turtle navigate away
from obstacles it senses.
Create a maze for the student to solve. ( example)
Open Source Turtle Robot (OSTR): Page 36
Try the di erent songs in rtttl_example.py to nd your favorite.
Open music_example.py to see how tones are played. Can you adapt your favorite tune in code?
What does turtle_goto_example.py draw? Use the handout to create your own object.
There is a isButtonPushed() function that returns True if pushed, False if not. What could you use that for?
Hint: look in eye_check.py!
Bonus level: Since turtle can see and emit IR, with a friend could you create a predator / prey pair, with
one seeking IR, and the other eeing IR?
Join the Turtle Robots forum to share your robot and teaching ideas!
Resources are always limited when doing workshops, so I've been breaking students into three groups and rotating them
through three areas, each with a knowledgeable volunteer.
Safety with the electrical portion is important and should be discussed before starting. Safety glasses should be worn. I
have a squirt bottle of water at the table for cooling burns (and wetting sponges).
https://youtu.be/P5L4Gl6Q4Xo
https://youtu.be/QKbJxytERvg
Most examples run on a 8.5" x 11" sheet of paper. Lay down some butcher paper on the oor for larger drawings.
I like having the 3D printer at the workshops since it shows how the robot was made. I usually print out tree frogs to give
the students. They usually end up riding the robots around.
If time allows, a simple 3D design exercise allows the student to learn more about 3D printing while creating a custom
name plate for their robot. The at, thin object prints quick, and swapping lament out creates a nice contrast.
Resources:
Tutorial
Blank Nameplate STL
Shared Tinkercad example
I love seeing these robots out in the wild, especially when they have been modi ed in ways I would have never have
thought. Here are a couple of notable examples, with hopefully more to come:
If you make a Turtle bot inspired from my examples, use the "I Made It!" button below, upload a picture, and make my
day!
I do have one question though. A few of the links to the Github source files are dead - I assume
this is because you are continually evolving and improving the design! Can you please tell me
which versions of the PCB and printable files are the most recent/best? For example, I get a 404
if I look for the Freecad files at https://github.com/aspro648/OSTR/blob/master/V2/3D
I think I am getting the hang of the directory structure on Github. Is it correct that some of the
"V1" files still need to be printed, UNLESS there is a replacement in the V2 folder?
Open Source Turtle Robot (OSTR): Page 42
Thanks
Nick
This project was great! My eight year old children were able to complete it, with some help from
me. The Tindle kit had everything we needed, and the instructions are very accurate. The kids
enjoyed soldering the boards, although they did need some help in attaching the adafruit, as the
pins are quite tight. Rob was great about providing support and suggestions, and really went
above and beyond to create a great project, and something that motivates kids to keep learning
about programming and the wonderful world of robotics. Thank you!!!
Thanks for posting the picture! I love seeing the results of all that work paying off!
Just a heads up, the notes above about the resistor values are incorrect. The 10K is Brown-
Black-Orange-Gold, and the 100 ohm is Brown-Black-Brown-Gold. We should have read the
guidelines first to confirm. Unfortunately we soldered a couple in before we realized our mistake.
Ouch. That was a mistake. Thanks for catching and reporting it and sorry for the extra effort it
caused!
I've updated the step.
Would like to purchase the kit but would also like to see a video of it working is there one?
I like the way you divide into 3 engineering sections in order to build a robot, very well done!
How Nostalgic!
I always wanted one as a kid
Awesome very neat project :)