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 Pin11On
- 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.