Close

Does this project spark your interest?

Become a member to follow this project and don't miss any updates

DIY 3D Printable RaspberryPi Raman Spectrometer

An open source 3D Printable Raman Spectrometer using a RaspberryPi and easy to find off the shelf components..

21 106 81
Enjoy this project?
Share on twitter   Share on Facebook

This project was created on 05/30/2014 and last updated 20 hours ago.

Description
A 3D Printable Raman Spectrometer that uses a raspberryPi, a couple of arduino compatible ARM boards, a really bright laser and some parts you can grab from eBay, adafruit, sparkFun, Mouser, or wherever...!

BASIC DESIGN GOALS:
1. Make it 3D Printable.
2. Make it modular and easy to upgrade.
3. Make it as easy to build as possible.
4. Make it easy to customize and open to improvement.
5. Use only commonly available off the shelf components whenever possible.
6. Have a remote interface that will allow it to be controlled and viewed from anywhere.
7. Compare the spectra to the online internet spectral databases.
8. Provide the capability to log data to remote databases, share with friends and colleagues..
9. Not be just another open source spectrometer..
10. Make it easy to use and intuitive.
11. Make it attractive with an elegant design..
12. Make it useful and just cool to have!
Details

DIY Raman Spectrometer

Based on a Raspberry Pi and 3D Printable

Be sure to check out the bio that Hackaday.com did on me!!

WHAT IT DOES:

Imagine the keyboard in front of you... It is made of several elements...it's probably plastic, some metal, some silicon, and so on... Now imagine a glass of water, beer or your favorite soft drink.. So now let's ask what's in that glass...you probably know there's a bit of water, and a lot of other components.. What if you look at that beer, and want to find out what chemical compounds are in it.. So take a sample of it, and put it into a 'cuvette' which is a fancy tiny test tube of sorts.. Then insert that into our Raman Spectrometer.. Then run an analysis on it and bam! You can see that your beer has ethanol, carbon dioxide, water, etc.. 

Ethanol Spectra

There have even been examples of how you can distinguish different brands of beer using a Raman Spectrometer! You can do the same thing for other samples, like gasoline, your blood, tears, or even your cat's hair...pretty much anything..

WHO SHOULD BE INTERESTED:

You!  Or anyone who is interested enough in hacking and/or science to be on hackaday!  If you think this is something you could probably pass on having...think again...!  If you're interested in how things work, or what they are made of....you need one of these.. Every home lab, school science dept. and hackerspace should have one...or be embarrassed that they don't. Use it to determine any number of things..  Sort your sand collection based on the composition of silica (SiO2) and other materials(meant as a joke but you could if you really wanted to)!  Or determine what kind of plastic or metal or ceramic or glue was used to make something... How fresh is my food?  What happens to this material when I do this?  Do a before and after analysis and find the raman shift!  Anyone who is interested in making what they do better.. Of course it takes some knowledge to use, but isn't that the whole spirit of hacking?

HOW IT WORKS:

Raman Scattering

Basically, it works by shining a really bright laser through some optics to focus down to a sample...That laser light then hits the sample, and depending on the molecules it hits, and what they're doing...the light can be shifted up or down in color.. Some of that light, and some of the laser light is reflected back into the optics and goes back and is reflected through a couple of filters that removes the laser light completely..leaving only the shifted light from the sample.. That light is bounced off of a 'diffraction grating' which is sorta like a prism.. The light is separated and projected onto a camera(ccd) which takes an 'image' of the spectra. Then the computer analyzes that and compares it to a couple of online databases then comes back and tells you what's in your beer!

Lasers + Beer = Fun....no?

THE PROCESS:

Process Overview

Start off by putting a sample in the cuvette.. Insert the cuvette into the DIY 3D Printable Raman Spectrometer, run the analysis.....the data is retrieved from the internet spectral databases, a match is found...that match is displayed on the users remote terminal...  You can store that data in an external database, share it online, or do what you please with it.. 

THE OPTICS:

Optics Overview

1. The laser emits a 532nm (green) beam of light.

2. The 532nm Pass Filter only allows the 532nm (green) light to pass, and filters out anything else.

3. The Cube Beam Splitter passes half of the light on to the Objective Lens, and the other half into the Beam Dump.

4. The Objective Lens focuses the light down to a tiny point in the sample.

5. The light in the sample interacts with the molecules, and depending on vibrations, bond angles, etc. the light is shifted from 532nm (green) to other colors/frequencies.

6. Some of the shifted light and a lot of the original laser light is reflected back into the Objective Lens and is collimated back to the Cube Beam Splitter.

7. The Cube Beam Splitter reflects half of the light to the Filter Assembly and half back into the laser.

8. The Filter Assembly contains two Edge Filters which block the 532nm (green) laser light and allow the other colors to pass. Since this is a low cost system, two edge filters are used instead of one Notch Filter...and so two separate exposures are taken and the images are stacked.

9. The remaining light is collimated by the Bi-Convex Collimating Lens to the Vertical Aperture (slit).

10. The Vertical Aperture (slit) controls the amount of light that enters the spectrometer section, and is a determining factor in spectral resolution.

11. The light from the slit is reflected off the Collimating Mirror on its way to the Diffraction Grating.

12. The Diffraction Grating acts like a Prism and divides the light into separate colors. Since the light originated as 532nm (green), and the shift is typically fairly minor, this light may be close to the original color...but also may be red (lower frequency) or even blue (higher frequency).

13. The light reflected from the Diffraction Grating is reflected by the Imaging or Focusing Mirror onto the Detector Array..

14. The spectra derived from the above process is reflected by the Imaging Mirror onto the CCD Array where it is captured by the raspberryPi for processing.. One image is taken with the first Edge Filter, then another exposure with the next Edge Filter and then some software to stack the images is used together along with some signal processing and possibly multiple exposures to gain as much brightness as possible so the computer can correctly analyze the spectra...

Originally I started out with a different configuration for mounting the optics. Since then, I decided to go with a much better solution where the optics are enclosed in a contiguous structure that eliminates stray beams and keeps ambient light out. It is also easier to set up, and should stay aligned longer in addtion to being more shock resistant and will reduce resonance.. The system is comprised of a number of individual modules, most of which are based around the optics listed above.

I have decided to go with the Crossed Czerny-Turner Configuration for the spectrometer portion.. It seems to be the best fit so far..

Crossed Czerny-Turner

THE HARDWARE:

Hardware Overview

A view from the outside... The whole thing fits in a Prodigy mini ITX case by BitFenix..

The electronics are centered around a raspberryPi. There are three microcontrollers tied to the raspi through rs-232.. The controlBoard, the interfaceBoard and the imagingBoard.. The controlBoard is also tied to the power control board... and at this time, the imagingBoard and the interfaceBoard may be living on the same PCB..

All three boards are based on the ST Microelectronics Nucleo F401RE STM32F401RE MCU and fit into what used to be hard drive trays that slide into the case..using a 3D printed adapter..

The Nucleo F401RE is just one of many platforms supported by mBed..  The boards shown below are prototypes, I'll be publishing the Eagle files for the new boards when I get the bugs worked out with these..

I am using the mBed online IDE to program them.. Say what you will, it works great.. gitHub to firmware..

controlBoard:

controlBoard

Schematic for controlBoard can be found here.

  • Power Relay for Laser
  • TTL Control for Laser
  • Monitor Temperature for Laser using DS18B20 sensor
  • Control L298 HBridge for Heating/Cooling of peltiers on CCD Array and Cuvette
  • PID Monitor and control Cuvette temperature using DS18B20 and L298 HBridge
  • Monitor current draw from peltiers on CCD Array and Cuvette using ACS712 current sensor
  • Control Beam Shutter using a standard 9gram hobby servo
  • Detect Laser Good (verify beam is reaching destination) using a TEMT6000 ambient light sensor
  • Open and close Cuvette Tray using stepper motors driven by ULN2003, with optical end stops
  • Rotate Filter Wheel Assembly to change from 522nmSP to 550nmLP filters using ULN2003
  • Detect Filter Wheel Assembly position using rotary encoder
  • Monitor Cuvette Holder for presence of cuvette in tray using a optical proximity sensor

powerControlBoard:

powerControlBoard

  • Accepts power from main power supply and distributed it to other boards
  • Contains the L298 HBridge for the imaging and cuvette peltiers

interfaceBoard:

interfaceBoard

  • Arduino Pro Mini (for Adafruit RGB LED Ring which animates depending on activity)
  • ILI9341 2.2" TFT LCD Color Display
  • Capacitive Touch Panel with 12 'Buttons' using MPR121 touch controller
  • Displays system status and mini control interface
  • Accepts user input to open/close cuvette tray, etc..
  • LED Ring provides feedback regarding status, etc..

imagingBoard:

  • Controls Toshiba or Sony Linear CCD Array 
  • Monitors UV index with a 
  • *Controls diffraction grating angle
  • Transmits CCD data to raspberryPi for processing
  • Will probably be housed on the interfaceBoard...stay tuned.

Please read more......the description for the process has been updated!

Read more »

Components

See all components

Project logs
  • Filter Wheel Assembly Design Near Complete

    2 days ago • 0 comments

    So, I have a few details to add and work out... but the first draft is looking good.. I'm going to add a few things (mounting holes for the filter adapters and such), and clean up the code..right now I don't think it'd print too well...  I also need to separate all the parts such as the wheel itself, and the body, etc.. into individual files...

    Here's a couple shots that show what is going on pretty well..  

    This one shows the inside... the big gear is the filter wheel and the holes are where the filters mount..the whole thing spins around and allows you to select the filter for the exposure your working on..The two gears below are the stepper motor drive pinion(right) and the optical encoder pinion (left), which allows the system to track the filter position..

    The backside...Showing the stepper motor, the exit beam path, the screw holes and the mounting hole for the optical encoder...

    I expect I'll have this done in the next couple of days..  I'll print it up and post it here as soon as I do!  

    And then I'll be on to laying out the collimating lens / entrance slit and then it's on to the actual spectrometer! That should be fun..  I need to purchase a new diffraction grating and a couple of mirrors soon...  

  • The RGB LED Indicator Ring

    2 days ago • 0 comments

    So, as a bit of feedback and just a nice finishing touch...I decided to include a NeoPixel RGB LED Ring from Adafruit inside the case fascia interior that will rotate, etc. during imaging and other processes...

    With my current process, it requires a minor modification to the inside of the fascia...

    You start off by sitting the LED ring in the middle of the inside and mark off the cut...

    Then make the cut...

    Verify the LED ring fits...

    It's kinda artsy even...or..have I just been up too late...

    Then we place the LED ring on the portion we cut out... (right now I've double sided taped it..) I will be designing a 3D printable part to adapt this so it fits nicely...

    Here's the ring from the back...

    From the back and mostly what it will look like when installed... Of course there's 3 wires.. etc..

    It lights up!  The ring is driven by an Arduino Pro Mini since the library is available, the processor is only $3 on eBay and it's beneficial to offload the task to a smaller mcu..  The pro mini is connected to the interfaceBoard via serial and is sent commands for different sequences, etc. on demand..

  • Doing more than one thing at a time.....

    9 days ago • 0 comments

    So..  I've been meaning to give an update that shows a little history and some of my failures and what I did to get past them so far...  I'm still working on that.. :)  

    I'm doing this update to show a bit to round the edges on what I have been doing...in the past few days..

    As the previous couple posts show, I've been working on getting serial communications going.. I think I'm pretty satisfied with what I have..  It pretty much worked from the start, and there doesn't seem to be any packet loss....It could use some better handshaking and error correction, but that will come in time..

    So, currently.. I just got everything running from the mini-itx power supply.. the power supply plugs into a mini-itx connector on the power controlBoard and it passes the 5v to the controlBoard, interfaceBoard, and the raspberryPi, etc..  I'll put some pictures up as possible.. 

    In the meantime, here's a couple pictures of the laser emitter and power supply.. with the emitter seated into it's nice little case/mount...

    A view with the bottom half of the case removed....

    And a rear view showing the cooling fan...

    Here is a couple pictures of the mirror mount that bolts to the face of the laser emitter...

    Bottom half with mirror in place and simulated beam path...

    The whole unit.. The printing supports have not been removed in this picture... but it doesn't look a whole lot different after they are removed.

    Here is a photo of some of the optics... The important parts...the 522nm Short Pass filter and the 550nm Long Pass filter..  I'll post a photo of the actual filters soon.. I didn't have the gloves, etc. ready to remove them safely..  The other on the left is the surface mirror..which is in the image above...These all came from eBay.

    The transmission graph for the 522nm Short Pass Filter..

    The transmission graph for the 550nm Long Pass Filter..

    And a quick photo of all of the boards in the case hooked up..  

    So far....I have all of the boards (raspi, controlBoard, powerControlBoard, and interfaceBoard) running from the mini-ITX power supply... the raspi is running some test python code that cycles through a loop and sends commands to the controlBoard to move the cuvette tray back and forth, select the filter both with the stepper motors... It then cycles the cuvette and laser peltiers using the HBridge.. First it cools one side of the cuvette peltier, then heats it... and then it cools the ccd peltier...then repeats the whole thing.. Works great!  

    I'm quite happy that the HBridge controlled peltiers worked out so well.. It proves to me that I will be able to maintain the temperature of the cuvette using a PID controller and PWM and the DS18B20 sensors.. All the code is up on gitHub!

View all 29 project logs

Build instructions
  • 1

    Preliminary instructions are as follows:

    Acquire the hardware listed in the parts list.

  • 2

    Print the 3D Printable parts.

  • 3

    Either etch, buy, or have made the PCBs you choose to go with.

See all instructions

Discussions

Zeke_D wrote 16 days ago null point

Found a university example that may be of use for reference. http://fzu.cz/~dominecf/electronics/usb-spect/usb_spectrometer_dominec.pdf
Keep up the great work. :)

Are you sure? [yes] / [no]

fl@C@ wrote 16 days ago null point

That looks very useful.. Particularly the CCD driving stuff.. I'll read this over tonight..!
Thank you, much appreciated..!

Are you sure? [yes] / [no]

Matouš wrote a month ago null point

Wow. I love this. I would love even more to build this or help to make it better in any way! I have actually attempted to construct a much simpler version of this with an LPC1114FN28 and some Toshiba CCD chip, but it ended up occupying one breadboard and not working very well - I could see some reasonable output with an oscilloscope, but the ARM chip is probably a bit too slow for driving the CCD, reading from it and sending the data over serial to PC. Always only one of those three worked at one time :) Anyway I did not have any of these fancy mechanics and optics, just the bare CCD, so this is a great step for me. Thanks for this a lot, I will study on how to build upon your work after exams :)

Are you sure? [yes] / [no]

fl@C@ wrote a month ago null point

Thank you! I'm always open to input and suggestions..! Sounds like you have some practical experience with the CCDs.. I'm still looking into options in that dept., but I hope to dive into it very soon.. I've been eyeing the sony ILX511 and the Toshiba TCD1304AP recently.. I'm glad that any part of what I'm doing can help... that's my main goal with this! I really want to narrow it down to the cheapest and easiest way to build and source everything. =)

Are you sure? [yes] / [no]

Marvin wrote 2 months ago null point

The Edmund grating listed is the UV optimised version. The VIS version is the same price. Is that intentional and down to a different use geometry?

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

Oops.. Thanks for pointing that out.. It wasn't intentional..and related to my trying to do too many things at once.. :)
It should be the 1800 Grooves/mm, VIS Holographic Grating, 12.5mm x 25mm Stock #43-221

Thanks for pointing that out!! I'll fix that right now..

Are you sure? [yes] / [no]

sammy wrote 2 months ago 1 point

the actual photos in the project log really shows your progress. Impressive build!

Are you sure? [yes] / [no]

nmz787 wrote 2 months ago null point

Have you actually tested the device yet, got spectra and compared them to a reference spectrum (like how Ben Krasnow does in his video on DIY Raman)? The LP filter seems pretty far from the laser line, and I've heard the coherence is hit-or-miss on cheap diode lasers. I'd love to hear your experience! Your bio says you're using a raspiCam, I found the digital noise on my raspiCam to be quite high, so high I've discarded it as a usable imager for science. Did I get a crap camera? It was really bad in low-light for me!

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

I've tested the optics and a bit of crude code I wrote.. Yes, there's about a 28nm gap which isn't optimal..but without spending more money that's the best I could do when I purchased them...it also kinda depends on what deals you can find on eBay at the time.. I might end up replacing mine, but for now these should do.. There was actually a pretty in-depth conversation a couple days ago in the bio hackaday did.... http://hackaday.com/2014/06/05/thp-hacker-bio-flc/ Several imaging options, etc. were covered... it might be worth a glance.. :) I'm not convinced I'm still heading in the raspiCam direction, and if I do...it will probably include a peltier cooler...

Are you sure? [yes] / [no]

nmz787 wrote 2 months ago null point

Reposting this here from my post on your bio page "​The simplest 'spectrophotometer mount' I know of is a concave aberration-corrected flat-field grating. It combines the czerny-turner design's mirrors with the grating, and has some optical engineering done to change the shape so the spectrum is fairly linear on a flat sensor like a CCD or CMOS."

Also, cooling the sensor will only reduce dark noise, not shot noise (including readout noise or other digital/amplifier noise).

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

I am currently using a Horiba Aberation Corrected Monochromator Grating Type 532 00 110 ... http://www.horiba.com/index.php?eID=tx_cms_showpic&file=uploads%2Fpics%2F532_00_110.gif&width=800m&height=600m&bodyTag=%3Cbody%20style%3D%22margin%3A0%3B%20background%3A%23fff%3B%22%3E&wrap=%3Ca%20href%3D%22javascript%3Aclose%28%29%3B%22%3E%20%7C%20%3C%2Fa%3E&md5=ce89b0dc511daa962ab5c570388c75d5 I think I got it for around $49 on eBay..and there was more up last time I looked..
There might be better options, but part of the point of this project is to make it as adaptable to what people can find used on eBay so they don't have to spend so much money on new optics..

Here's a grating list that includes mine..
http://www.horiba.com/us/en/scientific/products/diffraction-gratings/for-industrial-applications/aberration-corrected-monochromator-gratings-type-iv/grating-list/

Spectral Range (nm): 190-800
Dispersion (nm/mm): 8.0
Grooves Density (l/mm): 1200.00
Deviation D (deg): 61.60
A: 100.00
B: 94.00
Blank DIm: 32.32
F: 3.00
Blaze: 250.00
Order: 1.00
Reference: 532 00 110

Are you sure? [yes] / [no]

nmz787 wrote 2 months ago -1 point

A monochromator grating won't result in a linear spectrum being imaged onto the sensor array, so comparing to a reference spectrum might be made difficult, but hopefully you'll be able to visually make some correlations! Check this app note out:
http://www.gratinglab.com/Information/Technical_Notes/TechNote3.aspx

Also section 6 and 7 here (repost from Richardson Gratings):
http://optics.sgu.ru/~ulianov/Students/Books/Applied_Optics/E.%20Loewen%20Diffraction%20Grating%20Handbook%20(2005).pdf

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

There seem to be several examples of how to correct for the non-linear spectrum (mirrors, etc) which shouldn't be a problem.. I'm also investigating linear CCDs for imaging and the possibility of a couple other options that will become more relevant when I am at that stage of development..

I'm curious about your design and why you chose such an expensive grating for an opensource project? Does the propeller chip offer any advantage over the Cortex M3? I found this ( https://www.kickstarter.com/projects/makerhaus/open-spectrometer/?ref=kicktraq ), which seems to be an old kickstarter campaign...have you made significant progress since then, have you imaged any spectra with this device?

Are you sure? [yes] / [no]

nmz787 wrote 2 months ago null point

I chose the grating because the simplification of the optical system seemed well worth it, it is a grating that is recommended for analytical/Raman use which is one of my intended uses for the device. The Parallax Propeller is an 8-core processor, so it is really good at doing things in parallel while still talking to each other. The instruction set is smaller than a Cortex M3, for that kind of processor I'd recommend starting with an LPC Link V2 which contains a triple-core Cortex M4 and two M0s, for ~$20... with an 80 MSPS ADC on-board too!

Are you sure? [yes] / [no]

Jrsphoto wrote 2 months ago 1 point

Great project! Was looking for your email but couldn't find it. I have some links about image stacking in python for the Pi that you might be interested in. It should get you pointed in the right direction. Some of these use this python camera lib:

https://github.com/ashtons/picam

However, would use this one, its much more capable:

https://github.com/waveform80/picamera
Docs are here:
http://picamera.readthedocs.org/en/release-1.4/#

Stacking examples in Python:

http://www.davidhunt.ie/macro-pi-focus-stacking-using-raspberry-pi/
http://stackoverflow.com/questions/9251580/stacking-astronomy-images-with-python
http://onlyjus-photopy.blogspot.com/2012/09/image-stacking.html

Hope it helps,

John, jrsphoto@gmail.com

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

Thank you! And thanks a ton for those links! Those will most certainly come in handy!

Are you sure? [yes] / [no]

Mike Szczys wrote 2 months ago 1 point

Wow, that last build log is mamoth, nice!

Thanks for entering this in The Hackaday Prize. As you continue to document the project don't forget to take into account the Basic Judging Criteria on this page: http://hackaday.io/prize/details

In general though, fantastic work on sharing all the info. I love it!

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

Thanks Mike!! This is a pretty big project, lots of parts! I'm trying to make this as open as I can! All the files are up on gitHub!

I'll be sure to do that... I've been working on some ways to demonstrate the 'connectedness'.. It will be ultimately controlled by a remote interface on a PC, and the data can be transferred to other devices to incorporate in whatever experiments you're running... I had actually planned on developing a protocol so this device can talk to others I've created, allowing them to communicate and make adjustments automatically based on the output from the spectrometer and a couple other devices/variables...

I'm also really working hard to make this as easy to customize, and reproduce as possible.. I want to use the easiest to find/readily available components I can find for the cheapest prices..

Keep an eye out for the youtube video! And thanks to you all at hackaday for the chance to share my work! =)

Are you sure? [yes] / [no]

jaromir.sukuba wrote 2 months ago 1 point

Nice project.
I really appreciate finding and using relatively cheap and available components from ebay.

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

I totally agree.. the savings can be amazing...if you can deal with the wait times.. ;)

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

I'm working as fast as I can to get all the information up here as soon as possible!!

Are you sure? [yes] / [no]