Page 1 of 1

Pi-based spectrophotometer

Posted: Mon Apr 15, 2013 9:47 am
by thekeywordgeek
I'm building a Pi-based spectrophotometer. I have no need for a spectrophotometer, it's just that many years ago I used to work on them for a living and based on that experience I think a simple design can be created that should be buildable by someone still at school, and for a rather small amount of money. And since such a project is right on-message for the Pi it makes sense to give it a try.

Hardware wise I'm all set. Except for the sensor, I wish I could scrounge a pre-production Pi camera board (Hint to the foundation: lend me a camera board for a while and get a shiny spectrophotometer for your display table!*) but I can't so my trusty old Nokia mobile phone is performing cumbersome sensor duty.

There's one thing I don't have though and I'm hoping someone may be able to help. A spectrophotometer shines light through a sample in solution, and that solution sits in a transparent sample cuvette - like a square plastic test tube in most cases. I can buy cuvettes, but they come in packs of hundreds and I only need a couple. Are there any Pi enthusiasts who are (a) not too far from Oxford, and (b) able to give me a couple of cuvettes? Visible light, so the plastic ones would be fine.

*subject to the thing working.

Re: Pi-based spectrophotometer

Posted: Mon Apr 15, 2013 10:45 am
by dan3008
Wow, this sounds like an amazing project. spectrophotometer's can cost £100's (as you know)

Can you imagine though, if these could be produced using the pi for less that £100 :D

Every secondary school and science collage in the country (nay world) could have one :D
If you get it working, I would be more than willing to help market them :) My school got given an old one when the old head teacher died, (not sure why he owned one but there we go), and I loved it. I nearly cried when it broke.

Good look with your project.

Also, if you take a look at kids science kits, and suppliers, you might find what you are looking for in smaller quantities. :)

Re: Pi-based spectrophotometer

Posted: Mon Apr 15, 2013 10:58 am
by Airstream
To obtain a cuvette in glass - low qty etc, just search the keyword 'Cuvette' on ebay co uk.
You will find quite a few of them. Plastic 4ml x 25 at £6.25 for example Good luck with the project.

Re: Pi-based spectrophotometer

Posted: Wed Apr 17, 2013 3:46 pm
by thekeywordgeek
I guess I should point out that a home made spectrophotometer is unlikely to deliver lab-grade resolution. It should however be possible to make one that shows something and demonstrates the principles.

The great thing about a spectrophotometer is that its calibration is against a known and unshakeable standard, the absorbtion spectra of known compounds. So if it works at all you will know straight away because you will see the characteristic spectrum of the known compound you are testing.

The eBay cuvettes look promising. Still way more than I need, but at least the outlay is more sensible. I could of course just use test tubes, they're cheaper still.

Re: Pi-based spectrophotometer

Posted: Wed Apr 17, 2013 3:56 pm
by Ravenous
What about these? (Hope the long link works)

http://www.rapidonline.com/Education/Me ... bes-500336

Re: Pi-based spectrophotometer

Posted: Wed Apr 17, 2013 4:04 pm
by thekeywordgeek
Those look good. However I've just ordered these through Amazon: http://www.amazon.co.uk/dp/B008KYQC82

I don't know the likely difference between polypropylene, polystyrene and glass for visible light. Though fortunately the absorbtion spectrum of the sample container and solvent is removed by taking spectra for both sample in solution and straight solvent in the same type of sample container, then subtracting them.

Re: Pi-based spectrophotometer

Posted: Mon Apr 22, 2013 1:25 pm
by thekeywordgeek
Tubes arrived, here's a pic.

https://twitter.com/thekeywordgeek/stat ... 48/photo/1

From these people, via Amazon: http://www.plastictesttubes.co.uk/

Re: Pi-based spectrophotometer

Posted: Tue Apr 23, 2013 9:19 am
by thekeywordgeek
Interesting discussion with friend last night over light sources.

I'm using a tungsten car bulb. A brake light, 12v at 5W if my memory serves me. Generates heat, uses lots of electricity, not at first the best choice you might think. I'll have the Pi turn it on for 5s before sampling then turn it off after each sample.

A white LED as suggested by my friend would at first sight be much better, low power, lots of light. But white LEDs aren't really white at all, IIRC they're UV LEDs with a fluorescing material that glows when hit with UV. Thus they don't have a very flat spectrum. Tungsten light isn't perfectly flat, but it's far better than LED light in this application.

Handy graph from http://www.olympusmicro.com/primer/ligh ... intro.html explains all:
Image

Re: Pi-based spectrophotometer

Posted: Tue Apr 23, 2013 9:28 am
by Ravenous
Indeed a case where the cheap old fashioned way is best. Compact fluorescents would be bad too I guess. (Ever noticed those interference fringes on the back of CDs and the like?)

Though nice photographic/studio lamps (if still available) which work well into the blue might be quite expensive, and short-lived. The little white/blue 12V spotlights (dichroics?) might be good and a bit cheaper.

Though yes, you're probably right to stick to the car bulbs while you get it developed, I suspect they're the most long-lived to play with...

Re: Pi-based spectrophotometer

Posted: Tue Apr 23, 2013 10:10 am
by thekeywordgeek
Funnily enough some professional spectrometers I used to work with used special bulbs which were as I understood it standard tungsten bulbs selected to within particular tolerance ranges and with a crazy price tag. Some of them were even direct equivalents to bulbs you'd find in your car or other domestic settings. It makes sense, if you have a plant that makes bulbs in a particular way it would be uneconomic to make tiny quantities in a completely different package.

I'm not too worried about the mundane source of my bulb. Given that the rest of the machine is not going to be lab-grade - it would be rather difficult to do so on a budget accessible to the Pi-owning teenagers I hope might build it - any shortcomings of a tungsten light source will I feel not be noticeable.

Edit: also car brake lights are rough service bulbs designed to withstand many short on-off cycles. Handy, I don't want to constantly be buying new bulbs.

Re: Pi-based spectrophotometer

Posted: Tue Apr 23, 2013 10:46 am
by techpaul
Depends what colour spectrum you want I should imagine like other standards the light is probably similar to D62 or D65 and in lighting products is referred to as colour temp of 6500K.

Some bulb manufacturers refer to this as Daylight, cool white, blue white, for tungsten, fluorescent, LED or any type of light source. You could always use Xenon arc bulbs as in projectors and medical light sources.

Many sources are available. Even have 'daylight' fuorescent and energy saving Compact fluorescents in the house, much easier on the eyes and for reading. One room has 'cool white' LED strips.

If you are really worried you could use an RGB LED and mix the colour spectrum you require.

Re: Pi-based spectrophotometer

Posted: Tue May 07, 2013 9:58 am
by thekeywordgeek
I spent a little more time on this project over the weekend. Mounted my sample tube - also known as "drilled a hole".

My original idea was to shine the light through a hole and have a wide bean illuminating the whole sample, now I see the error of my ways in that I don't want light transmitted through less sample at the edges of the round sample container. No worries, I'll incorporate a simple slit-based collimator to make a narrow beam of light.

Re: Pi-based spectrophotometer

Posted: Tue Jun 18, 2013 7:59 pm
by FLAVIO
Before you worry about cuvettes, do this thing right. buy a real CCD. This one on EBAY is the same one OA uses: http://tinyurl.com/m6hloas and it's $12. With a few cheap lenses and a grating you could build a lab grade spectrometer for under $100 USD!

Re: Pi-based spectrophotometer

Posted: Mon Jun 24, 2013 2:03 pm
by thekeywordgeek
You're not wrong, a linear CCD is a way better bet than a camera for a lab grade spectrometer. In fact I have one, they're readily found in flatbed scanners.

However I'm not bothered about how good my spectrometer is from a lab perspective, my aim is to make one that provides demonstrable results from something a builder who may be a young person is likely to have already, namely a camera or the Pi camera module.

A very worthwhile upgrade course for someone to pursue would be to interface a linear CCD to their Pi and publish a HOWTO. Perhaps it might not even be a hardware project, if the CCD module and interface board of a flatbed scanner could be reverse engineered it could be a software project alone.

Re: Pi-based spectrophotometer

Posted: Wed Jun 26, 2013 6:15 pm
by FLAVIO
thekeywordgeek wrote: my aim is to make one that provides demonstrable results from something a builder who may be a young person is likely to have already, namely a camera or the Pi camera module.
Have you seen the work the public laboratory is doing? Very similar, only with a tinge of an environmental focus: http://publiclaboratory.org/home

Re: Pi-based spectrophotometer

Posted: Wed Jun 26, 2013 7:06 pm
by PiGraham
FLAVIO wrote:
thekeywordgeek wrote: my aim is to make one that provides demonstrable results from something a builder who may be a young person is likely to have already, namely a camera or the Pi camera module.
Have you seen the work the public laboratory is doing? Very similar, only with a tinge of an environmental focus: http://publiclaboratory.org/home

Ingenious. I love the $10 smartphone version.

A self-contained Pi-based device sounds good.

Re: Pi-based spectrophotometer

Posted: Wed Jun 26, 2013 7:15 pm
by PiGraham
techpaul wrote:If you are really worried you could use an RGB LED and mix the colour spectrum you require.
Just FYI, you can't do that. You can't control the wavelength of light from an LED (at least, not commonly available LEDs). All you can do is control the relative intensity of three different wavelength emitters. That's the R, G and B in the name. Our eyes can't see wavelength. We only see the relative intensity of three overlapping spectral bands. So an intensity blend of three narrow bands can produce the same response as a wide range of spectra.

Re: Pi-based spectrophotometer

Posted: Thu Jun 27, 2013 8:17 am
by thekeywordgeek
PiGraham wrote:
FLAVIO wrote:
Have you seen the work the public laboratory is doing? Very similar, only with a tinge of an environmental focus: http://publiclaboratory.org/home

Ingenious. I love the $10 smartphone version.

A self-contained Pi-based device sounds good.
Kinda makes my project rather redundant :)

Re: Pi-based spectrophotometer

Posted: Thu Oct 31, 2013 10:21 pm
by bfesser
Any progress on this since the NoIR camera module was released? It'd be nice to have a box 3d printed out of light-absorbing (black) plastic, where you would simply insert the camera and a diffraction grating into perfectly-aligned slots and snap on a cover with a holder for a cuvette.

Re: Pi-based spectrophotometer

Posted: Fri Nov 01, 2013 12:39 am
by scruss
If you want a nice sensor, the TCS34725 is quite fun: https://www.adafruit.com/products/1334

Re: Pi-based spectrophotometer

Posted: Fri Nov 01, 2013 11:04 am
by thekeywordgeek
bfesser wrote:Any progress on this since the NoIR camera module was released? It'd be nice to have a box 3d printed out of light-absorbing (black) plastic, where you would simply insert the camera and a diffraction grating into perfectly-aligned slots and snap on a cover with a holder for a cuvette.
None at all I'm afraid. Life got in the way. But you're right, the black camera would be an ideal sensor for this project.

Re: Pi-based spectrophotometer

Posted: Fri Nov 01, 2013 11:09 am
by thekeywordgeek
scruss wrote:If you want a nice sensor, the TCS34725 is quite fun: https://www.adafruit.com/products/1334
In this exact case, no, as the idea is to use the camera as a sensor array, a row of pixel light intensity sensors. Thus avoiding some of the mechanics of a spectrophotometer at the expense of maybe not having such a high quality device.

However it would make a much better sensor than the camera if it were able to track along the spectrum. Maybe a rotating mirror and slit arrangement could do it.