26 Jan 2015
Apart from home improvements, I’ve also been tinkering with computers and electronics, especially over the Summer break.
It started with buying a Raspberry Pi last September. A Raspberry Pi (RPi) is a small computer designed to be tinkered with. Rather than explain it, go read about it here. My aim was to play around with some time lapse photography and to learn to code in Python.
First up I played around with time lapse with a camera connected to the Pi with a ribbon cable. I wanted to capture the lunar eclipse in October and did a lot of playing around with the exposure and shutter speed at night.
In the picture above the RPi (in a plastic case with the red power LED lit) is sitting on top of the rechargeable battery pack that’s powering everything and the white ribbon cable runs up from the computer to the camera on the tripod. The camera itself is tiny and you can’t really see it there. I was running it “headless” without a monitor, keyboard and mouse – instead I can log into it over my home network from my Mac and run commands from there. To preview images, I used Berrycam on my iPhone that also connected over the network (there is a wireless dongle on the RPi).
With a bit of fiddling with the exposure and white balance (depending on cloud and a few other factors) I was getting good images, but I didn’t capture the eclipse because the moon was hidden behind cloud. I will try again some other time. For the image above I had a long exposure – a plane has left a trail over on the right near the moon.
The RPi runs on Linux, which was new to me, so to learn more about Linux and the RPi I went and did a course over two Sundays in late November/early December. The course was very helpful in getting me started. Suddenly having one RPi wasn’t enough – I bought a second to use as a media centre.
Setting up a media centre was so easy – there are many tutorials, but I used this Lifehacker one, an Adafruit tutorial to set up the remote control (you can see the infrared receiver above the RPi bottom right in the picture above) and this one on setting up Aussie catchup TV. It’s a bit clunky and a few of the catchup TV services don’t work, but those that do are great – it runs smoother than Airplay from my iPad to the Apple TV has been doing lately (I’m still running an iPad2, which is a tad old now!). I can also run video files off a USB stick connected to the RPi and I could set it up as a PVR but haven’t bothered for now. It cost about $100 all together, sourcing most bits via Tronixlabs.
My next Rpi project was going to require some soldering and I sucked at soldering, so it was time to do something about that. I participated in a Kickstarter by Soldering Sunday and three “Chip” pixel pals arrived just before Christmas for me to solder together.
This one with blue eyes was the first one I put together – I scorched the board just above the first resistor on the left, but otherwise it went well. By the end of the third I was getting better, though the red eyed one has a dodgy connection somewhere because I have trouble getting one of the eyes to work sometimes.
The pixel pals are designed so they can be plugged directly into an Arduino, which is a different electronics platform, also meant for electronics and programming. But just so I could play with some Python coding, I’ve connected up a Chip to the GPIO (general purpose input output) pins of the RPi (via a cobbler and breadboard in the image below) and made the LED eyes flash just for fun.
So now that I could solder better than before and with a bit of coding knowledge, I moved on to a more ambitious project – a couple of waterproof temperature probes connected to a LCD display and able to log data to a file. The purpose of this was to monitor the temperature of solar dye baths (Yup, there’s some fibre crafts hidden in here!). I did attempt some solar dyeing a few years ago (it seems I did not blog it) but the dye never took too well and my guess was that the dye baths weren’t getting hot enough and I didn’t have a thermometer. Making a RPi-powered LCD and temperature sensor rig is complete overkill – I could just buy a thermometer – but that’s no fun!
I should have taken more photos while I was building this – first I connected up all the parts with the cobbler and breadboard to check it all worked, then I worked on the code to get the temperature readings to be displayed on the LCD. Once I was sure it worked, I assembled it in a plastic box with a clear lid (so that it is relatively waterproof), soldered the wires and insulated them with heat shrink and, as I only needed seven of the first ten GPIO pins, plugged it all into the RPI using a 10-pin IDC cable.
Here’s a photo of it doing not very much because I forgot to photograph it while I had an experiment running on the terrace to see how hot a dye bath would get in the Sun.
And this is the LCD screen output. The time and date refreshes along with the temperature data which tells me the program hasn’t crashed. I can add more sensors if I want, but two sensors gives me the ability to make some simultaneous comparisons. I set this up with two different sized dye baths on a very hot day and collected data over about eight hours using a second Python program that wrote the data to a file that I could later import into Excel…
And the dye baths didn’t quite make it to 50 degrees – not hot enough to fix the dye. Bummer.