Turtle Pi

Back when I was a teenager, 30 or so years ago, I had a BBC micro and I used it to built a turtle driven by the BBC computer in Basic. By command, it could move forwards, backwards, spin on its axis, and drop a pen into contact with a paper surface to allow it to plot its path, allowing it to draw pictures.

30 years later, I’m reproducing what I did in my teenage years, but this time with a RaspberryPi controlled from Python via the GPIO ports. Here’s the plan:

  • get my RaspberryPi setup – [DONE] couldn’t be easier for an IT engineer like me, thanks heavens!
  • teach myself basic python – [DONE] a combination of the RaspberryPi user guide combined with this quick reference I found
  • teach myself how to use the gpio port using python – [DONE] starting with the RaspberryPi User Guide
  • extend the basic GPIO code to flash 7 LEDs – the total number of easy accessed GPIO I/O pins [DONE]

Then my first problem. A stepper motor used to drive the turtle has 4 control wires. How to direct 2 motors (8 wires total) when I have only 7 available from the GPIO? Enter the 74HC595 serial in, serial or parallel out latch. This means with only 3 pins, I can drive both stepper motors exactly as needed, leaving me 4 pins to do something else (for example, it’s possible to get joystick switches to provide the inputs to make the Turtle go forward, backwards and rotate. On we go…

  • read and understand the spec for the chip – [DONE]
  • write the python to drive it – [DONE]
  • try it out, using LEDs to represent the motor coils – [DONE]

I’m pretty pleased with progress so far (even though I do say so myself), since I only got my RPi 2 weeks ago. So what next…

  • build a body for the motors in LEGO – [IN PROGRESS]
  • fit the wheels which I kept from my original Turtle to the steppers
  • swap the LEDs for the motors – this means adding some buffering and power as the motors (unlike the LEDs) cannot be powered off the GPIO port
  • add joystick control
  • use a second RPi to control it wirelessly – currently the initial plan is for turtle to be tethered to an immobile RPi via a very long ribbon cable

As a man approaching middle age, I’ve not been this excited since I was a teenager, and even better, doing this means I can help my kids learn to use their own RPi’s when the time comes (they are a little young at the mo!)

I intend to get some pictures up here soon showing progress so far.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.