Drawing with maths
Posted in Primary
MyMaths brings maths alive, and we have taken this idea into the real world. We wanted a project, something that would teach us about a discipline none of us had previous experience of (electronics), that made the team approach programming from a different angle, and it had to be made from Lego! After some searching we settled on the idea to create a 'Logo' robot, also known as a 'turtle'.
What is Logo?
Logo is a high level (simple, close to English) programming language that is best known for drawing graphics. It works by using a series of commands that essentially describes how something would have to move, an on screen pen or a robot, in order to draw something. The commands look like this:
The first command here is FORWARD and then the number 50, this is telling the 'pen' to go forward 50 pixels, or 'clicks' in the direction it is facing. The second command RIGHT is turning the 'pen' in a clockwise direction by the number 90 which is in degrees and then it proceeds FORWARD again. Next it turns LEFT or counter-clockwise 90 degrees, goes forwards again and draws another RIGHT angle making something resembling a step as displayed.
We have set up a little area where you can try making your own drawings using Logo at the following link which has the full reference of commands. Send us your creations!
Building a robot?
With a bit of Googling and some trial and error the components and know-how to build yourself a fully functioning drawing robot are remarkably easy to come by. We used an Arduino, which is programmable microprocessor, to power and control our robot, some stepper motors to drive it, and Lego as a building medium. The total cost of all of the components was about £40, which covers the processor, motors, electronic breadboard (doesn't need soldering!), and some jumper wires (Lego was from our private stashes!).
It had to be made from Lego.
Maths for robots
There were several problems that we needed to overcome in order to get our robot functioning, and the answer to all of these was wrapped in maths, but first we needed a design:
We decided to go for a three wheeled design, with two motors controlling the wheels independently. One of the key benefits of using stepper motors aside from the low voltage is that they are very accurate and as the name suggests move in controllable steps. This allowed us to step both motors forward to go forward, both motors backwards to go backwards, and alternate combinations to turn either clockwise or anti-clockwise. Then by putting a pen directly in the middle of the two wheels we were able to control the pen to make it draw exactly as Logo does. The problems all came in trying to work out the relationship between the commands that we give to the robot, and how they translate to motor movement. Knowing the distance between the two wheels, the diameter of the wheels and the fraction of revolution that the stepper motors turned with each step could produce a formula that would inform us of the number of steps required to turn about 1 degree. Once we had all of that we produced an interface to the Arduino using Python, which accepted Logo commands and could draw anything we desired... Well sort of, it still needs a great deal of tweaking and we will be sure to keep you up to date with progress!
[gallery link="file" columns="4" ids="114,115,72,70"]
We would love to hear about others building robots so do get in touch we can share all in a future post.

