Tag Archives: raspberry pi camera

£15 DIY usb microscope from StoneTurners

At the Elephant and Castle Mini Maker Faire this weekend I picked up a £15 microscope kit from the guys at StoneTurners (hello!).

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.

Photo of the microscope kit
*small robot not included

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:

finished USB microscope
I was a little heavy with the glue gun

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.

USB microscope running on Raspberry Pi B+
The pretty pattern is my Imac screen

Finally, here are a few pictures I took just trying out the USB microscope:

an LCD screen:

An LCD screen (not OLED or retina, I can’t afford a new mac just yet)

and the tip of a ballpoint pen:

Ballpoint pen with a USB microscope
A ball-point pen

I haven’t tried anything living yet, but when it’s not dark and raining outside I’ll pop down to the thames and see if I can get a water sample. One interesting project might be to look at determining water quality based on what pond-life appears.

In conclusion it’s a fun kit for £15 and I look forward to seeing what they come up with next. You can buy the kit here.

Holga 120 D

This is an update to my original Raspberry Pi Holga camera case project.

Earlier this year Holga Direct created a digital version of the Holga – the 120d as an April fool joke – although my version lacks the 73 megapixel sensor and retina back display it does actually exist, can take nice pictures and is fairly easy to build yourself if you’d like to give it a try.

The aim of this is to build a neat case which fits the Raspberry Pi and camera module, and to do a bit of experimenting with the GPIO (General Purpose Input and Output) pins to use them to control various aspects of the camera. Lacking instant feedback and having no idea what you’ve captured until you take it home also fulfils some of the ideas behind retro analogue photography made popular by Lomography. It also looks a bit hipster.

Holga 120 d Raspberry Pi camera
Shutter release and power on the front lens

This is a fully working Digital Holga 120d – it used the case from a broken Holga, unfortunately it doesn’t use the original plastic lens (although I have kept this) as the Pi Camera board has it’s own built in lens, however it is now possible to use screw on lenses and filters.

The case is now finished but I have made a few changes since my last post:

I’ve lost the external USB port as there wasn’t quite enough space inside the case to fit the USB plug – I am now using a nano wifi adapter inside the case – specifically the Edimax EW-7811UN adapter which works well with the Raspberry Pi model A and fits inside the case.

Along the way I’ve added a few extra parts:

  • A 49mm adapter ring on the front lens – it is now possible to add filters – this is a zomei 46-49mm adapter ring (similar to this one) which screwed in to the original Holga plastic lens after using a dremel to sand down the holga lens until it fitted.
  • 3.5mm plug for external camera trigger – this is a stereo headphone socket with 2 wires attached. Am using a mono 3.5mm cable to use as a cable release driver as I think it’s some kind of standard.
  • led indicator (in the viewfinder – which glows red to indicate a picture is being taken )
  • Optoisolator flash circuit – this is an LED attached to an image sensor – the model I’m using is rated to control very high voltages.
  • A 3 position rotary switch – to select between video, still photos and program mode. This is a 12 way switch so i’m only using a few of the contacts. I used a big chunky switch I found on ebay which makes a satisfying click when you turn it – it did fit after a dremel was used to cut a larger hole. I’ve used a tap washer to fill the gap between the switch and the camera case.
Holga 120d Raspberry Pi Camera Case
Here’s the 3/4 view with the big clunky switch. It will switch something eventually.

I’m currently powering this using a (rather big) Anker USB battery – will likely use something smaller in due course but the Anker battery seems to last forever and powers the Pi with the Wifi adapter with no problems at all.

The next step is to build the hardware to connect the various inputs and outputs to the Raspberry Pi. I’ve been experimenting with these using breadboard and hope to solder it all neatly together – with details – for my next project post. Essentially I need to wire 3 switches (shutter, 2 rotary switch positions) and 2 LEDs (indicator, optoisolator) to the GPIO.

Then finally there’s the matter of some software to pull it all together. At the moment I’ve been testing using the rather useful BerryCam iOS app – although it seems ironic to be using a device with it’s own much better built in camera to control the camera of another computer remotely, it’s a useful app to test things with. If you use the instructions in the first bit of my post about using the Pi as an Adblock server you can also set the IP address to be the same each time.

Update: I’ve added the inputs and 2 LED outputs to the GPIO on the Raspberry Pi – check out this post for more details, circuit diagrams and code.

Finally here’s a selfie in the mirror:

BerryCam Holga 120d self portrait
Hello me

 

 

Raspberry Pi Camera Case – from a Holga

Here’s version 1 of the Holga Raspberry Pi Camera – a hackable, programable camera with a 5 megapixel sensor and HD video capabilities, in retro camera form.

My original concept was to do something like this:

Pi Camera Module camera case sketch
Everything and the kitchen sink

And I managed to build something like this:

Pi Camera Holga Case
And here’s how it turned out..

The Holga is an ultra-cheap medium format camera – if you shop around you can get one for about £15-20 – the model I used for this was the Holga Camera 120N (120 N) (Plastic Lens / Hot Shoe) with the Raspberry Pi Model A – although with a bit of modification it would work with the larger model B. Potentially by soldering the power supply and USB directly to the Pi you could make this a slimmer fit, but I wanted something that didn’t modify the Pi in any way.

The model A Pi fits quite well – you just have to remote the 2 plastic struts inside the case, and peel off the foam that secures the film reels inside the case. I had to remove the plastic panels that enclosed what would have been the flash (my Holga came without one). I cut up a cheap USB extension cable to mount on the top of the camera – and to plug into the side of the Pi. In order to make it fit with the right angled micro USB on the other side I needed to solder and make my own USB cable (you’ll need the shortest USB plug available – I used a poundland retractable USB cable as the source for mine).

If you don’t want to bother with the soldering you could probably just drill holes in either side of the case – there is room, and the plastic is easy to cut through.  

I also added a couple of plastic struts to locate the Pi in place – it’s a snug fit so doesn’t rattle around inside the case.

With the Pi removed you can see how it sits in the camera:

Pi Camera Case without Pi (rear view)
Here it is with all the wires

The yellow wires go to the flash hotshoe – the green to the trigger button on the side of the lens housing, and the red to the power button.

Pi camera case with Pi fitted
Here it’s sitting in it’s case. Snug.

The camera module sits inside the lens with the ribbon cable carefully wrapping around the board and over to the socket – I experimented with Sugru to hold the camera board in place (which would work) but wanted it to be removable, so opted to cut up a piece of spare plastic and drill a hole for the module to peek through – it’s a fairly firm push fit which holds it in place. The lens can still be rotated a little to make it easy to level the Pi camera.

For the power switch I used the same circuit as for the Motorola Lapdock, and added it to the lens mount. I’ve also added a press button on the other side to use to take photos – this will be (eventually) wired to the GPIO.

Pi Camera Detail
Here’s a closeup

Despite it’s cheapness the case feels solid – most of the modifications could be done with a sharp craft knife, apart from a few places where the plastic was thicker or I needed to make holes and a dremel was needed. There’s a lot of empty space inside this case so plenty of room to add things later (I wanted to add a speaker and a few other outputs and inputs, so will do later..)

Overall this was a fun project – all the messy cables and glue are neatly hidden (I went a bit overboard on the glue gun when soldering my USB extension cable) and the case was fairly easy to work with.

The case also has a nice screw mount for a tripod – handy for securing the Pi with camera to things.

Making it more than ‘just a camera’

Replicating a simple Camera with the Pi and Holga (HolgaPi? Piga?) would be a bit boring so my aim with this project is to provide a nice case with the possibility of extending it beyond what I could achieve with a normal compact camera.

At the moment the GPIO isn’t connected to the shutter button or flash trigger – i’ll do this next and write up the method in another blog post.

Things to do:

  • Think of a name
  • Calibrate the viewfinder
  • Write / find some code to make the camera operate over a network. As it lacks a screen the idea of putting all the camera controls into a web app makes sense
  • Add an LED indicator to the viewfinder
  • Add a speaker and think of some sound effects for the camera to make
  • Make use of the flash hotshoe (I’m thinking of using an opto-isolator for this, as some flashes have high trigger voltages running through them)
  • Add some more inputs – this could make the basis of a camera trap. Would be fairly easy to make this rainproof. As it is it would work with a Makey Makey…
  • Write some code to make the GPIO stuff work. I’m relying on this blog post to learn how.
  • Spray it red / green to match with the Pi look, neaten up the lens mount where the glue has discoloured the plastic
  • Investigate batteries or solar power
  • See if I can add a filter mount
  • Send a detailed proposal to the Lomo people to ask them to make a modified Holga case for the Raspberry Pi

Update: check out the following posts in the series.