This is a hack kit based on a USB webcam where you remove the lens and reverse it to create a cheap microscope. In the box you get a set of parts including the camera itself, a plastic screw pot, some neoprene material and a few laser cut parts.
Instructions can be found over at StoneTurners along with some inspiring images taken with the scope. It’s an easy build – I did however skip over using the neoprene strips instead opting to hot-glue the webcam module inside the plastic screw-pot, and I had to bend the LEDs slightly to fit them inside the hole at the top. What you end up with is 2 ways to adjust the microscope – you can focus the reversed lens attached to the CCD module, and you can raise and lower the microscope ‘stage’ – being the outer part of the screw pot.
Here’s how mine ended up:
You can use the microscope with Camspinner on the Mac – this worked fine with no problems on my Yosemite iMac.
For the ultimate in budget scientific computing, you can use guvcview and plug the USB microscope directly into a Raspberry Pi. I used a model B+ and it worked fine just plugged directly into the USB port, although the low power warning icon did flash up a few times.
To install guvcview just open the terminal and type:
sudo apt-get install guvcview
then head over to the desktop with startx – the webcam software will be found under Sound and Video in the main start menu.
I did try installing Cheese, but that was a little bit too much for the Pi.
Finally, here are a few pictures I took just trying out the USB microscope:
So now I’ve finished my digital Holga project, one of the things I wanted to do was to get a bit creative with it – so here’s my first attempt at an ASCII art generating camera.
This uses the ASCII art script written by Steven Kay, please visit his blog to find out more – I’ve modified the original script to use the python picamera library – this helps speed up the image resize. There’s also a timestamp added to the text file which uses the same script I wrote about in my previous Holga post.
If you just want to run Steven Kay’s script you’ll need the python imaging tools – install with
sudo apt-get install python-imaging
Here’s my modified script:
ASCII Art maker
Creates an ascii art image from an arbitrary image
Created on 7 Sep 2009
@author: Steven Kay
from PIL import Image
from bisect import bisect
# greyscale.. the following strings represent
# 7 tonal ranges, from lighter to darker.
# for a given pixel tonal level, choose a character
# at random from that range.
greyscale = [
# using the bisect class to put luminosity values
# in various ranges.
# these are the luminosity cut-off points for each
# of the 7 tonal levels. At the moment, these are 7 bands
# of even width, but they could be changed to boost
# contrast or change gamma, for example.
with picamera.PiCamera() as camera:
# open image and resize
# experiment with aspect ratios according to font
im=im.convert("L") # convert to mono
# now, work our way over the pixels
# build up str
for y in range(0,im.size):
for x in range(0,im.size):
date_string = time.strftime("%Y-%m-%d-%H:%M:%S")
text_file = open('image' + date_string + '.txt', "w")
There are lots of settings to tweak – the image above was generated by the script – and bear in mind this is designed to be viewed with black text on a white background. Perhaps I’ll see if I can dig out an old dot matrix printer from somewhere.
For a blog of ‘photos’ updated whenever I take them and am in range of WiFi check out:
My aim being to build a hackable portable digital camera which hopefully would be able to capture images not possible with a normal digital camera, and to recapture the unpredictable spirit of film cameras (without the expense of the chemicals).
In my second post I added the final inputs to the Holga case – a rotary selector switch with 3 positions, a push button switch on the side (with a trigger input on the bottom) and a power switch. I added a filter adapter to the front lens and I also took a few pictures by remotely triggering commands on the Pi.
I’ve now connected up the switches and added 2 LEDs to the Raspberry Pi, making the Holga 120d a practical portable digital camera.
The rotary switch combined with the trigger switches effectively gives the Holga 120d 3 input buttons. The 2 LEDs (blue and orange) indicate the ‘mode’ the camera is in when I push the shutter button.
Each of the 3 ‘modes’ is programmable – at the moment I have 2 set up – one takes a photo which is saved to the Pi’s SD card, and the other performs a safe shutdown. It’s possible to add any command to the python script – and I’m working on an additional artistic mode which I’ll detail in a later blog.
I soldered all the inputs & the 2 LEDs to a Slice of Pi Breakout Board – these are available for around £5 and fit neatly over the Raspberry Pi without taking up too much space.
From the board leading to the case, the green wires are to the push switch and trigger input, the 3 red wires & black to the right lead to the rotary switch and the red and black pairs lead to the LEDs.
The yellow wires just out of shot are to the flash hot-shoe. I did consider connecting this using an opto-isolator LED and there this space to do this at a later date.
There is also (just) about enough space to add a real time clock module – I used the Adafruit DS1307 Real Time Clock which connects to the 5v, GND, SDA and SQL pins on the slice of pi board. I followed Adafruit’s instructions (leave the resistors off the board!) and it works well.
The LEDs themselves slot into the viewfinder and light up according to the position of the switch. So in mode 1 the blue LED lights up, 2 both LEDs light and in 3 just the orange LED. This gives a bit of useful feedback to show that everything is working properly and the Pi is taking pictures when you click the shutter button.
For an easier to understand diagram – here’s the circuit laid out in Fritzing.
GPIO 23,24 & 25 are the inputs, with GPIO 17 and 18 driving the 2 LEDs. The switch at S2 is the rotary selector switch.
I used 330 ohm resistors for the LEDs and 10K resistors for the GPIO inputs.
The code I used is really simple.
Make sure you’ve run sudo apt-get update and have installed the Camera py modules first.
from time import sleep
import RPi.GPIO as GPIO
if ( GPIO.input(23) == False ):
print('Orange: Taking photo')
date_string = time.strftime("%Y-%m-%d-%H:%M:%S")
with picamera.PiCamera() as camera:
camera.capture('image' + date_string + '.jpg');
if ( GPIO.input(24) == False ):
os.system("sudo shutdown -h now")
if (GPIO.input(25) == False):
In the code above, one of the settings takes a photo which is saved with a time / date stamp, the other safely shuts the Pi down, and the other is yet to be used.
The easiest way to get your photos off the Pi is to use Filezilla and to connect to your Pi using sFTP – this uses your SSH login and enables you to easily to download and delete photos.
I’ve had lots of interesting feedback about the Holga 120d – with the Pi model A (and potentially a smaller model A+ in the works) there are lots of opportunities for adding a digital camera to an existing film camera.
Now i’ve got my Holga 120d up and running I’m going to do some experimenting – my aim being to capture images that you can’t recreate with Instagram. If you’ve got any creative ideas to share please leave them in the comments below!
Here’s a quick tip to finding a Raspberry Pi (and anything else) on your network using the nmap network scanning security tool.
Quite often you might want to run a ‘headless’ Raspberry Pi without a screen or keyboard, using SSH to connect. SSH can be enabled in the config menu when you first boot the Pi. You can then find the IP address of your Pi when you’re initially setting it up using the ifconfig command in the terminal. Normally this works like this – on the Pi you want to connect to, type into the terminal:
Note the value next to “inet addr” – which usually looks like 192.168.1.(a number) – Then from another machine you can SSH to your Pi to allow for remote control
This is fine, but most home networks use something called DHCP – ‘dynamic host configuration protocol’ – local IP addresses are temporarily assigned to the computers by your router (the DHCP server). Although these addresses often don’t change, they can. You can assign a static IP address which is something i’ve used in the past, or install a service like no-ip that tracks your Pi’s IP address (and makes it available over the internet as well). You also need to be able to connect a screen to the computer you’re attempting to connect to!
A simpler method is to use a tool called nmap (network map)- there are versions available for windows and mac, and it works from a Raspberry Pi. It’s also free.
For instance, you might have a Raspberry Pi setup on your network with a monitor and keyboard, and you’ve plugged a second Pi in that’s running SSH.
Install nmap with:
sudo apt-get install nmap
and then use the following command:
sudo nmap -sP 192.168.1.*
Returns a list of ips and hostnames – just look for the one called Raspberry Pi – This takes about 30 seconds.
Nmap does a lot of other things as well – and it’s the program of choice whenever movies attempt to depict computer hacking, or if you want to hack into Matt Damon’s brain.
If you’re looking for a more portable version there’s a (paid for) tool called Scany which is available for the iPhone and iPad or Fing which is free.
Here’s a very cheap outdoor weatherproof case for the Raspberry Pi.
I’ve been experimenting with the AirPi weather sensor kit (available on Tindie). This is a lovely kit which comes bundled with an air-pressure, humidity, light, temperature, NO2 and CO sensors. The AirPi is fairly easy to solder together and comes complete with some nice software that automatically uploads your recordings to Xively. As it’s written in Python it’s also quite easy to see what’s going on – and the whole project is available on GitHub.
I did find that the software needed a bit of work (don’t expect it to be perfect out of the box), but it’s a good starting point – part of the Raspberry Pi adventure is about trying to come up with your own ideas and improving on the work done by others. It’s also particularly impressive that the AirPi was put together by an 18 year old in his spare time.
Since it’s more fun to take readings outside, I’ve been looking at weatherproof case options for the Raspberry Pi.
The white louvred boxes you sometimes see on street corners, outside science labs or in the middle of school fields are called Stephenson screens. These allow for the weather sensors to have air circulate around them and are carefully designed to minimise the effects of sampling error – by providing a standard way of mounting and housing scientific instruments.
As Stephenson screens are no doubt quite expensive (and my AirPi hasn’t been calibrated anyway) I’ve opted for a cheaper option, which also manages to include a few of the features of it’s more expensive counterpart. The key things I’m aiming for are: standard (and repeatable), allows air to circulate around the sensors, and white and reflective.
For a fiver from Wilkinsons (in the UK) you can buy a bird box which makes a cheap and effective weatherproof housing. You’ll also need a dremel (or similar small drill), some sandpaper, waterproof outdoor gloss paint, wood glue and insect netting.
This is a box made from softwood, so it’s very easy to work with – you can use a dremel or a junior hacksaw to make holes. The plate with the birdbox hole is removable, and the pi sits on top of a piece of cardboard which wedges inside. The spare bits of wood from the hole were used to make rests for the Pi mounting board.
I modified my AirPi kit slightly – first I adjusted the height of the header pins so that the board would fit on top of a modmypi plastic case – second I didn’t solder the light sensor directly to the board. Instead I soldered a couple of header pins to the board, and then a couple of leads to the sensor – allowing it to be fitted in a different place. In the image below you can see the light sensor mounted in a hole in the front plate – it sits behind a clear lego stud which serves as a little window.
The Raspberry Pi sits inside the box on a piece of board – I cut up the back of an old picture frame.
Depending on how you’re planning to communicate with your Pi (in this case a model A with a Wifi dongle) you might need to make a hole in the back of the birdbox for the USB to stick out. In my case the WiFi module fits snugly in the hole in the back of the bird box, which was then covered with a bit of board and painted. For power I used a low profile USB – micro cable which is hooked up to a USB terminal block inside the case (scavenged from an old digibox). The Pi is orientated inside the case so that the green and red LEDs are visible through the wide hole in the font. You don’t need to add all these bits, just bare in mind that the Airpi uses a lot of power and long USB cables might have a negative effect on your Pi’s power supply.
The measurements I used were as follows:
You might need to experiment with the materials – but the softwood is very easy to work with. You can buy wood filler if you make any mistakes.
Once you’re happy with the fit of the Pi inside the box, paint the whole thing with white glossy outdoor paint. To stop insects or anything else nesting in the box, wrap the front plate in insect netting.
Finally – test! – i’d recommend leaving the box in the rain (without your Pi) with some tissue paper inside just to check if there are any issues with water getting in. Obviously this can’t be 100% waterproof, but it’s good enough to leave your Pi on a windowsill or sheltered garden.
I’ve reviewed a few Raspberry Pi add on boards before, including the PiFace which includes a multitude of inputs and outputs, and the minimalistic LEDborg which has a very bright single multicoloured LED.
The Ryanteck Raspberry Pi Motor Controller Board Kit is a GPIO add on board that allows you to control 2 motors with your Raspberry Pi. Although it’s much simpler than the PiFace it’s cheaper (about £12) and is easy enough to assemble yourself. In fact it makes a nice introduction to soldering, and is an ideal project if you want to take the plunge and have a go at making your own hardware.
With the motor controller board you can build a simple Raspberry Pi based rover – you just need 2 motors driving side by side sets of wheels or tracks. Driving the motors in opposite directions allows you to turn on the spot. The Ryanteck board can control motors up to 12 volts to you could always re-purpose a toy or build your own.
There’s some documentation available here, but I thought I’d share my build guide. If you’ve never soldered before check out the Soldering is Easy guide, and try to buy some leaded cored solder. Lead has (quite rightly) been removed from the solder used in commercial products to prevent it ending up in landfill when electronics are thrown away. However lead-free solder is much harder to work with (it’s fine if you’re a robot) and for hobbyist applications it’s easier to work with the leaded variety. Just make sure you don’t throw your electronics projects away once you’ve finished with them.
In the kit are 3 sets of 2 pin headers, 3 sets of blue terminal blocks, a GPIO connector pin header and a chip carrier and controller chip.
Holding everything in place when you’re soldering is tricky – so my tip here is to use the GPIO header block to hold the parts in place while you solder them. So first we have the set of 3 2 pin headers:
Next we’ll solder the chip holder into place, using the GPIO header plugged into one of the sets of 2 pin headers – orientate the cut out to the left hand side of the board:
Next comes the blue terminal pins. These are a tighter fit so easier to just rest the board on the blocks and solder away. Finally comes the GPIO header. Remember to solder this facing down – you’ll need something to rest the board on. Fortunately I discovered this was exactly one lego minifigure knee in height, so I used the lego workman as a rest:
Finally comes connecting it all up and testing. The board is rated for a range of motor voltages. Surprisingly as I seem to have a lot of Lego around I thought I’d test it with a vintage Lego technic motor. Lego motors come in different voltages – the very old ones are 4.5v and the newer ones tend to be 9v. My motor is 9 volts but I’m running it off a 5 volt USB power supply, which I’m using in my Lego rover project. The motor runs a bit slower but is fine for my purposes. Attach the power supply for the motor to the J1 blue terminal with positive on the left hand side.
#Now loop forever turning one direction for 5 seconds, then the other
#Sleep 1 second then turn 17 on
#And now the other way round
#And loop back around
#And final cleanup
and then run it using:
sudo python motortest.py
You’ll need to use sudo as you’re using the GPIO pins.
Finally here’s a picture of the almost completed Lego Rover: all that’s to do next is to write some software and add a PiCam:
The Ryanteck Raspberry Pi board is a nice kit, easy to put together and get going straight away, and works with Lego motors so there’s quite a range of interesting things you can try. Ryanteck has now launched a complete robot kit that includes a chasis as well. For more info check out their GitHub project page. It’s a bargain way of making your Pi control things.
I’ve been playing around with LED scrolling signs for a while now and have been looking for an affordable sign to use for a project. Some LED signs are really expensive but I’ve recently come across this one from Embedded Adventures:
It’s a 80×8 display with three colours – Red Green, and Red/Green mixed to produce Orange. It measures about 35x4cm in size so is ideal for something eye catching.
Best part is that it’s available for just £20 from the Embeded Adventures website. It’s ready assembled so you don’t have to get out your soldering iron.
To connect to your Pi’s GPIO follow the instructions on this page – which includes a handy python script by Pete Goss. For the wiring guide note that the numbers refer to the number of the pins as you count across, not the GPIO number. This is also for the Rev 2 board model A or B (if you have mounting holes, your Pi is fine).
Raspberry Pi pin number (GPIO pin label)
LDP-8008 pin number (label)
3 (GPIO 2)
2 (A row address)
5 (GPIO 3)
4 (B row address)
7 (GPIO 4)
6 (C row address)
8 (GPIO 14)
7 (EN enable display)
10 (GPIO 15)
8 (D row address)
11 (GPIO 17)
9 (red LED)
12 (GPIO 18)
10 (green LED)
13 (GPIO 27)
15 (GPIO 22)
There’s a slight errata on the page as you have to type:
sudo python scroll “Raspberry Pi” 1
to get it to work.
I found that it will work powered just from the GPIO of the Pi, but if you need a brighter display you can just hook up a 5 volt power supply (e.g. a spare USB charger) to the central pins – this doesn’t need to be connected to anything else. The lower pin (with the printed text on the back the right way up) is ground – I used the cable off a novelty LED light from Poundland.
For the cable you can use jumpers or for something more permanent I found this Maplin GPIO breakout board available for £3.49 to be ideal. The LDP8008 comes supplied with a ribbon cable you can use.
Here’s a closeup of my cable – by cutting the grey cable different lengths you can make it quite neat. I also added a plastic cover cut from a spare toolbox divider.
and the cable attached to the GPIO on the Raspberry Pi (make sure you get pin 0 on the right side!)
I was surprised at how neat this turned out…
Note that in my case, the labels on the Maplin GPIO breakout board were incorrect – make sure you double check everything before plugging it into your PI so you don’t break it!I also found the display a little sluggish if anything else is running.
For extra neatness I mounted the whole setup in a box frame – the one I used came from Wilkinson’s and was £6.
If you visited the Raspberry Pi foundation’s website yesterday (April 1st), you will have spotted their spoof website redesign featuring a text interface and binary numbering on the menus:
They even had some lovely ASCII art. If you missed it, you can recreate the effect for any site on the web using the Lynx browser.
The Lynx browser is currently the oldest web browser still in use – it dates from 1992 and runs completely in the terminal. Despite it’s old age, it’s still regularly updated and actually works quite well. For sites with lots of text and forms Lynx is all you really need, and if you have limited access to the web where you work you can SSH into your Pi and browse the web remotely, all from the terminal.
sudo apt-get install lynx
then just type:
to visit the site of your choice! – the newly launched redesign of the Raspberry Pi website looks like this:
At the moment I have a Raspberry Pi sat in the kitchen at home, running a Ghost blog – you can usually find it a ghostpi.org (BT broadband connection permitting).
As I don’t usually leave computers running 24 hours a day, 7 days a week I was curious as to how warm the Raspberry Pi gets with use, so I’ve found a handy way of keeping track of the temperature of the CPU. Admittedly the blog isn’t driving massive amounts of traffic – it was mentioned on Reddit once which generated a spike of activity, but the plucky little Pi held up very well. There are heat sink kits available for the Pi that add a block of metal – either aluminium or copper to dissipate heat. At the more extreme end of the spectrum someone’s even created a water cooled Pi.
Realistically, although they look nice, heat sinks are a bit like go faster stripes or fluffy dice – in use the biggest impact on my Raspberry Pi was what time of day it was, and if the sun was shining on the kitchen shelf. Famous last words, perhaps this will get slashdotted and I’ll come home to find a smouldering pile of molten plastic.
If you’re interested in hosting a Ghost blog I’ve posted some instructions here – it is a beta blogging platform based on node.js which launched last year – it generally works well on the Pi, although for slightly complicated reasons logging in takes about 3 minutes (enough time for a cup of tea).
I’ve been using RRDTool to track the temperature of my Pi’s CPU – every 5 minutes this updates a nice little graph of the last 24 hours as a PNG which is then copied to the images directory on my GhostPi.org blog:
Run the script with the bash ‘name of your script’ command.
Now create a script which will update the graph: – you might want to edit the line cd /home/pi/scripts to point in the right location. The last line starting cp copies the png file to the content folder on the ghost server. Again you might want to edit that.
Test this script with bash ‘name of your update script’ – run it a few times and you should see the green line start to grow on the png graph.
Finally because you don’t want to keep having to run the script manually you need to add it to crontab:
and then add the line:
*/5 * * * * ./scripts/CPU_temp.sh
the */5 bit means run every 5 minutes, and again you might need to edit the location and name of the script.
RRDtool is quite simple – there are projects out there that use external sensors to track temperatures outside the Pi. Part of me is wondering if running RRDtool a lot and reloading the PNG file will then start increasing the temperature of the CPU in a sort of observer effect feedback loop…
Since its launch the Raspberry Pi has been phenomenally successful – with over 2 million units of the little computer sold around the world, it’s arguably kick-started a revolution in cheap, educational computing.
The only slight worry about this is how many Raspberry Pi computers have landed in the hands of kids (who it was really intended for) as opposed to 30-something computer nerds who are re-living their 8-bit computing childhoods, or networking the family toaster. Arguably there’s nothing wrong with that as the enthusiasts provide a ton of support but sometimes it’s easy to lose site of the goal of the project in the first place.
Then there’s the Raspberry Pi’s biggest competitor – the tablet computer. Many kids will be given tablets as they’re ‘educational’ devices – and given the choice of an instant on, readily usable ipad that can play games as well, the Raspberry Pi has its work cut out to avoid the drawer of forgotten devices.
So enter the Kano project – a kickstarter that raised over 1 million dollars, and effectively bundles the Raspberry Pi up with some nice hardware and some trendy design. Marketed as the computer you can build, it’s taking aim at the educational market in the hope that the kids will put down their iPads and have a go.
The Beta version of the Kano OS software part of the project launched this week so here are some first impressions.
In order to prepare your SD card Kano requires a burner program to run on a PC or Mac – although this does the job, it’s not quite as elegant as the NOOBS drag and drop method which has now become the standard for most Raspberry Pi software.
On bootup you get asked a few questions in the terminal, in the style similar to a text adventure. This is actually a rather nice touch. It neatly introduces the idea of the text interface and entering commands, and makes typing startx rather exciting (there’s a countdown!). I can imagine this being fun with a classroom of kids trying out the Raspberry Pi for the first time.
This first person theme continues as you use the computer – one nice touch is the bundled wi-fi setup app asks you to test your internet connection with the ping command (thus introducing the idea for later).
Once you get past this you’re presented with the Kano desktop. It’s beautifully designed with nice flat icons for the various apps. Chromium is the default web browser and it runs at a decent speed, and there are some bundled apps for creating programs.
Even as a Beta it feels quite polished.
Overall Kano OS is much simpler and less cluttered than other Raspberry Pi distributions and everything you really need is still there.
Lots of things here will be already familiar to anyone who’s used a Pi before – the command line is still accessible, so despite its user friendly interface there’s still the option to type proper linux commands.
The apps that have had the most work done to them are the programming tutorials – these allow you to mess around with a game of snake or pong using the drag and drop interface of scratch, and there’s also a split screen Minecraft app that is quite clever. It doesn’t take long at all to start really using the Pi and trying out different projects.
It’ll be interesting to see how this software progresses – there are definitely some good points, and as something I could load onto a Raspberry Pi and give to some kids to play with it perfectly fits the bill; and it does still include the vital command line for anyone that gets curious as to what’s running their computer behind the scenes – something that a tablet computer lacks.
One thing I wonder though is exactly how the Kano kit fits in with the other Raspberry Pi distributions – I’m not sure if the aim is to get this to fit alongside the other Raspberry Pi distributions (for instance including it as part of NOOBS) or to sell it separately. Raspbian’s open source nature has led it to be massively improved over the years by the community – and it would be a shame if Kano OS missed out on this.