Introduction
The PiRingo is a lovely little board from 4tronix. It has a ring of 12 LEDs and two switches and is plugged directly into the GPIO socket of the Pi. It comes in 5 different flavours (which are basically just different combinations of LED colours): I went with the Fairy Lights design which included 3 blues, 3 reds, 2 yellows, 2 greens and 2 whites.
You can read more about the PiRingo over at the 4tronix website and you can purchase it for £8.30 (ish) here.
Solder and set-up
It took about 45 minutes to solder (but I enjoy soldering and took my time!) and I plugged it straightaway into my new Chinese Raspberry Pi (one of the red ones). If you’re going to do this, I recommend starting with a new image of Raspbian. I tried with an existing install and didn’t have much luck with it – I think it has something to do with the serial port being enabled and having a console run on it. But no matter, I had a spare SD card and it only took half an hour to download and write the image.
What do I do with it?
I then had to decide what to do with it. We happened to be watching an episode of The Big Bang Theory at the time and the boys had rigged their apartment’s electrical equipment up so that it could be controlled by anyone anywhere over the internet. Aha! I thought. Internet-controlled Christmas decoration!
First of all, I wrote a Python script which simply cycled the 12 LEDs in a circuit. Note to the wise: don’t stare at the lights! That script can be found on GitHub.
Very pretty, I thought. But how do I get it so that other people across the world can control it? I thought I’d start simple and create a web server with a page that would just run the LED cycle. I knew it was possible to create a webserver in Python so I looked up how to do it (I finally found it here) and adapted it to catch the (non-existent) cycle.py page, which then ran the function to cycle the LEDs. The web server code can be found here. By putting these two scripts into the same folder and then running:
sudo python server.py
… I got a web server running on port 8080. The next thing to do was to set up port forwarding on my router. I’m not going to describe how to do that here as it’s different depending on which router you have. You might try looking here, for instance, or Google your router with the phrase ‘port forwarding’.
I can now allow other people to control the PiRingo. I’m not on a static IP though so I’ll have to figure out some way around that, but it does work. Within a few minutes of tweeting the URL to use, the PiRingo was flashing away 🙂
Future work
- Create a page where individual lights can be controlled.
- Create a page where you can define your own lighting sequence and save it for others to use.
- Set up the camera module so that people can see it working… but that might be overkill.
[…] recantha Introduction The PiRingo is a lovely little board from 4tronix. It has a ring of 12 LEDs and two […]
How about making it sms controlled only require a page that accepts a post request and done