Programming of the ScratchGPIO Dalek

Finished Dalek Model

Finished Dalek model ready for control with Scratch or Python

The Dalek here consists of four outputs connected to the GPIO port on the Raspberry Pi. These are:

  • Standard size servo – on GPIO pin 7
  • Blue head LED (left) – on GPIO pin 11
  • Blue head LED (right) – on GPIO pin 12
  • Red Antenna LED – on GPIO pin 13

These are all within the capabilities of ScratchGPIO which can be obtained from SimpleSi’s website. Out of all of the Raspberry Pi software, this is one add-in that I keep coming back to as it’s easy to install, intuitive to use and gives me the control I need.

Servos are controlled by setting up a variable – for example: Servo7 would be used to send the appropriate PPM signals on pin 7. Using Set Servo7 to 0 will ensure that the servo moves to its central position. Note that there is a limited range that servos can rotate to. I have got servos that will only cope with a range of 50 down to -50.


Simple digital output devices such as LEDs are controlled by using a broadcast command. To turn on an LED, I use broadcast Pin11OnDalekSetPinOn

DalekControllerWhen these commands are combined with forever loops, the repeating effects are quite effective despite the simplicity of the commands.

  • I’ve used a repeat loop to flash the blue head LEDs 10 times
  • Move the head left and right, followed by a movement to face forward
  • Fire the gun 10 times with a short pause in between each flash
  • Repeat the whole lot forever…

One thing that my Pi seems to be struggling with is the use of sound. I grabbed an “Exterminate mp3” from the internet but I’ve had all manner of strange noises and interference. It might be an interaction with the servo driver, Scratch or just something else within the operating system. It might even be due to the fact that I’m developing on an original 256Mb Raspberry Pi and it’s all a bit tight in memory!

However, the next step will use Python, and for this I’ll need some help from the Raspberry Pi website. Some time ago, they featured “Boris, the Twitter Dino-Bot”.

More info coming soon once I’ve had a chance to try out the Python programming.




One response to “Programming of the ScratchGPIO Dalek

  1. Possibly fixed the sound… modified on of the ScratchGPIO python files to add “–pcm” where it starts the servo daemon (servod). I’ll also check with SimplySi to see if this is likely to break anything in ScratchGPIO.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s