RGB LEDs driven with ServoBlaster

Image

By changing a few options on the command line, it’s possible to get ServoBlaster to output PWM signals from 0-100%. By using three channels and connecting these to an RGB LED it’s possible to produce a wide spectrum of colours. Each channel can be given a value, so for instance Red=100%, Green=0% and Blue=100% gives a rather pleasing purple/magenta colour. The circuit is rather simple, although my RGB LED was common-anode, which meant that using a ULN2803 darlington driver seemed a better option compared to a bunch of transistors.

This RGB might become a useful status LED, a sunset simulator or perhaps an interesting weather display, where colours represent the coming weather. There’s plenty of spare capacity for more LEDs in that darlington driver!

The RGB LED can be found here: http://www.rapidonline.com/Electronic-Components/Piranha-Rgb-Led-72-8998

Advertisement

Miniature Servo-controlled plotter

Amazing what you find when trawling the internet…

This little plotter, built from 6 3d-printed parts, looks like an interesting challenge. I built a stepper-motor controlled plotter years ago and even wrote a simple CAD package in BBC-Basic, but this is a great approach. I’m imagining this combined with ServoBlaster and some simple Python programming. The main  website is at: Miniature Servo-controlled plotter

GPIO and a PIR

Image

Raspberry Pi connected to a PIR and an LED.

I’ve finally got around to connecting a Passive Infra-Red Sensor (PIR) through the GPIO port of the Raspberry Pi. It’s been a long time coming and I wasn’t sure if the output of my PIR would be limited to 3.3 volts, or alternatively would run from 3.3 volts. In the end, I got out the multimeter and then I decided to try it.

This kind of thing is pretty easy with the PICAXE, which is where I spend a lot of my time. I’m a little more concerned about connecting up to GPIO as it’s a more expensive device all together. The PICAXE has quite robust inputs and outputs (sorry to say – I have tested this, and so have my students).

Ultimately, the PIR connects between the 5v terminal, Gnd and any available GPIO input. I’ve used pin 7. I’ve also connected an LED (through 330 ohms) so that I’ve got something to flash. I’d recommend this to anyone – testing GPIO outputs is much easier with an LED connected somewhere – we all need reassurance, right?

Circuit diagram showing the PIR connected to the GPIO

Raspberry Pi connected to a PIR and an LED – circuit diagram

From here, the Python program required was simple. Turn off the LED, check if the PIR has been triggered and flash an LED if it has. Then go back to the beginning…

The next step was to link to espeak using os.system. It works well as an intruder alert system!

What’s really amazing is the sensitivity that these little PIRs can manage. They can detect movement from a great distance and all for a few quid from “a well known auction site”. The current consumption is tiny so it doesn’t load your power supply down. Another advantage of this particular PIR is that the sensitivity and “on-time” are adjustable with two on-board preset resistors. I reckon they’re an absolute bargain.