Does this project spark your interest?

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

ramanPi - Raman Spectrometer

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

46 160 126
Enjoy this project?
Share on twitter   Share on Facebook

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

An open source 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...!

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

ramanPi - the DIY 3D Printable

RaspberryPi Raman Spectrometer

Formerly DIY 3D Printable RaspberryPi Raman Spectrometer..

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

ST Micro gave me a shoutout on their Facebook page!

Follow me on twitter too!  I'll be tweeting on gitHub updates as well as from here!

Index of Instructions and Informational project logs:


Imagine the keyboard in front of you... It is made of several's probably plastic, some metal, some silicon, and so on... Now imagine a glass of water, a tasty beverage or your favorite soft drink.. So now let's ask what's in that probably know there's a bit of water, and a lot of other components.. What if you look at that tasty beverage, 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 tasty beverage has C2H6O, carbon dioxide, water, etc.. 

Ethanol Spectra

There have even been examples of how you can distinguish different brands of tasty beverages 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..


You!  Or anyone who is interested enough in hacking and/or science to be on hackaday!  Every home lab, school science dept. and hackerspace should have one...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?


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 tasty beverage!

Lasers + tasty beverages =


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.. 


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


I will start by saying, there is no secret sauce to this project..  I am committed to sharing every detail of how this project works, how to build it and how to get it working...and hopefully how to modify it to suit your needs!  

The entire system is based on a raspberryPi..  And uses 4 microcontrollers to accomplish its tasks. 

Firmware for the controlBoardinterfaceBoard and the imagingBoard can be found either on the gitHub repo or directly at the site... 




The open source hardware information:

The open source software and library information:

For a more readable version of this, check the gitHub location.. I tried forever to figure out how to get this information on here in a readable format, but there just doesn't seem to be any way..

The device firmware for the controlBoard, interfaceBoard and imagingBoard are located in the gitHub under software and are in 4 formats..Three of which are zip files.. There are the actual C++ files and then the exports from the online compiler...which you should be able to import and compile without issue..  There is the Keil uVision4 .zip file, the mBed online IDE (mBed Tools) .zip file, and the zip archive (With Repositories) version..  As soon as I have some worthwhile code to share, I will start putting the pre-comiled .bin files on gitHub as well...that way you can just drag and drop them to your Nucleo board without concern..


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..



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



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


  • 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..


Current Schematics, Firmware and other details for the imagingBoard can be found in the project log located HERE.....or in the gitHub repository..

  • Controls Toshiba TCD1304DG Linear CCD
  • Monitors Linear CCD Detector Array Temperature via DS18b20 temperature sensor
  • Monitors UV index with a SI1145 UV Index Sensor 
  • *Might, at least in future update control the Linear CCD sliding, which can be used to increase resolution.
  • Transmits CCD data to raspberryPi for processing

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

Read more »


See all components

Project logs
  • beamSplitter and filterWheel

    2 days ago • 0 comments

    I've been working feverishly toward getting raman spectra for the past couple weeks...  I updated and have gotten the spectrometer to a pretty good point...and now, tonight have gotten the kinks worked out of the filter wheel assembly and the beam splitter assembly..!  

    The beam splitter assembly now has a access port cover to which the beam splitter mount attaches.. The splitter is captured in a small mount that bolts to the bottom of the access port cover..  It allows the beam splitter to be mounted and then fit into the splitter assembly where you can make any minor adjustments needed..  

    Here's an exploded view of the beam splitter assembly....

    And here is an assembled view...

    The filter wheel only needed the wheel itself and the mounting brackets updated...

    Here's the new wheel with brackets...

    The wheel and brackets just finished printing and I'll get images up as soon as possible... The beam splitter is just starting its print..  Hopefully I can get pictures of that up tomorrow!  Once these are done and assembled, and the splitter and filters are mounted... I should be able to start some testing to get raman spectra!  

  • Spectrometer Alignment

    4 days ago • 3 comments

    Note: This log entry is a living document. I'll be updating this post to reflect the current configuration as time goes on.. There will also be a log at the end of the post noting modifications to the log, etc..

    UPDATED-----> 09.17.2014

    Once you've assembled your spectrometer, you'll need to align the optics so the light coming in through the entrance slit makes it to it's destination....the detector array...  The light will enter through the entrance slit, hit the collimating mirror where it is directed in an orderly path to the diffraction this point, the light will be split into the colors it's composed of....that light is reflected off the grating onto the focusing or 'imaging' mirror...from there it is focused onto the detector array where it's read out to the microcontroller and passed to the raspberryPi for processing...and so on..

    To align your spectrometer, you will have had to assemble it following the instructions in this post.. Which means you'll have all the parts necessary and are ready to go..

    Alignment is pretty straight forward..There are some precautions to take, and you'll need a couple tools..  You need a 2mm and 4mm allen wrench or driver...I recommend the driver as the bent wrench poses a hazard to scratching your optics if you're not extremely careful..  

    To do this alignment procedure, I recommend you have a laser pointer and have printed this test stand I designed specifically for this purpose...  You'll also need this part x2 which is the top bridge for the mount..

    So, let's get started..  

    FIRST AND FOREMOST---SAFETY!!!  WEAR LASER PROTECTION WHILE ALIGNING ANYTHING WITH LASERS!!!  5MW is still enough to cause damage.. Just let it be known I told you so...!!

    For now, it's easiest if we start with the top half of the spectrometer removed.. This will make life easier when trying to access the adjustment screws, etc.. The access port gives a good perspective, and allows for minor maintenance but I'd recommend against starting your alignment through the port..

    You should be looking at something like this...

    First, lets start by attaching the test stand... You can attach the test stand to the side of the spectrometer at the entrance slit flange using a few M4 hex screws..The same type as the access cover lid on the spectrometer. The test stand also has a receptacle for a vial which you can use later for other fun stuff.. :)

    After attaching, you should be seeing something like this...

    Once that is in place, turn the laser on and see where the light is ending up...It really should be hitting square in the center of the collimating mirror...If not, you have some issues..Start by making sure your laser is in the stand properly..and making sure the stand is mounted on the side of the spectrometer correctly.. 

    With the laser on, you should see something similar to this on the collimating mirror...

    Next, with the laser on, take a look at the diffraction grating...You should be seeing a horizontal line across it...probably not centered... You'll have to adjust the three screws on the collimating mirror mount to align this.. The left screw clockwise pulls the line to the right on the grating... the right screw clockwise pulls the line to the left..  The bottom screw clockwise pulls the line downward on the grating... Both left and right screws clockwise will pull the line up... A combination of the three will allow for centering.. It takes a gentle touch and some patience..

    When you are done, you should see something like this....  (Notice in this image, the entrance slit is slightly angled causing the line across the diffraction grating to be angled.)

    After that, you'll want to make sure the grating is reflecting the correct order onto the focusing mirror..  This will take even more patience..  And keep in mind, this is something trained professional normally do with commercial products..they usually cement the optics in place after...

    Read more »

  • imagingBoard - schematic and board information

    6 days ago • 0 comments

    Note: This log entry is a living document. I'll be updating this post to reflect the current configuration as time goes on..  There will also be a log at the end of the post noting modifications to the log, etc.. 

    UPDATED-----> 09.18.2014

    This log entry is where I will keep current information regarding the schematic, board layout and other details about the imagingBoard electronics and firmware..  I will reference this log entry in the 'details' section of the project page..  This log entry will probably change from time to time to reflect the current status of the imagingBoard.  If you're interested, it might be worth a bookmark..

    The function of the imagingBoard is as follows:

    • Controls Toshiba TCD1304DG Linear CCD for imaging the spectra
    • Monitors Linear CCD Detector Array Temperature via DS18b20 temperature sensor
    • Monitors UV index with a SI1145 UV Index Sensor
    • *Might, in future update control the Linear CCD sliding, which can be used to increase resolution.
    • Transmits CCD data to raspberryPi for processing

    Here is what the current imagingBoard looks like...

    It is basically a ST Micro Nucleo F401RE board with a blank arduino 'shield' on it's back...  The daughter board has two indicator LEDs and a port that goes out to the CCD board....

    Which looks like this...

    Later on, these two may be integrated into one board.. There may be an external ADC, etc... but this is what it is for now...

    Here is the schematic....

    The eagle files, and the firmware are located in the gitHub repository...

    The board consists of the Nucelo F401RE, a Toshiba TCD1304DG Linear CCD Array, and a SI11145 Digital UV Index / IR / Visible Light Sensor (Adafruit Part#1777)..  

    Keep an eye out, since there will be updates here...!


    09.17.2014 - Added living document info..

    09.18.2014 - Corrected date format.

View all 54 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


Benjamin Franzmayr wrote 5 days ago null point

Hi. I've got a couple of comments.

Firstly, I'd like to have a low cost spectrometer without the raman aspects of it so when you're done, can you perhaps take out a subsection of your project and write it up as a complete project? If so, I'd personally want to be able to sample in the infrared and UV ranges as well (perhaps 200-900nm? or 250-800?) so would that require a shortening of the light path from the diffraction grating to the CCD? Perhaps having a second position for the focusing mirror closer to the other optics would make that possible (and wouldn't be too hard to add to the design). Also, would you or someone be able to offer a kit of parts or an assembled unit for sale? I'd rather buy one kit than to find a dozen different components (not as easy or cheap to do outside the US)
Secondly, for the spectrometer, you've printed it "right way up" with a curved top and a bunch of supporting material. Would it be simpler and cleaner to have a flat top and print it upside down?

Thanks and keep it up!

Are you sure? [yes] / [no]

fl@C@ wrote 5 days ago null point

Hi Benjamin,
Absolutely.. I fully plan on making sure the spectrometer portion will work outside the raman system.. It will not require much extra work, and I completely see the use for it.. That's part of the reason I'm working in such detail with this part.. The spectrometer firmware should work in both situations without modification.. In fact, there shouldn't be any modification required for it to work in both situations once I'm done.. Even if you have it in the raman portion, it can be removed and used outside...I've put some thought into a bypass or something that may make it usable without removing it too, maybe via fiber or something.. I'll know more when I get that far..
As far as UV and IR, I don't see a problem there either.... You may need a different diffraction grating, but that shouldn't be a problem.... and if there are any modifications to the focal lengths, or whatever... I have created the .scad file for the spectrometer 3d model with enough parameters that basically, you can enter the focal length, diameter, and whatever else and the spectrometer basically redesigns itself based on calculates the angles and everything...I haven't gotten that part to work 100% yet, but I'll have it there soon enough... So, basically you could download the files...plug in your values and it'll design a customized spectrometer based on your optics and requirements... :)
And for a kit.... I would love to offer a kit for that.. Hackaday just opened their online store...maybe they'll consider the spectrometer portion as something they'd like to work with..!
The reason I printed the case oriented the way I have is from trial and error... I thought so too, printing it without as much support and everything seemed more logical...until I saw the result.. At least on my daVinci printer....the walls came out warped, the whole thing just looked miserable..and I wasn't able to get it just right... I've printed four of these now with it oriented this way and they come out flawless....takes more plastic and more time...but it's fairly important to make sure the dimensions stay true...
Thanks to you!

Are you sure? [yes] / [no]

Pixel Pirate wrote 6 days ago null point

It seems as if the Raspberry Pi is a little unnecessary. I bet you could probably hammer out the details for the STM32 with a 12 pack of Coke or three. (After all, Everyone knows that Soda to Software is the most efficient energy conversion known to man)

Are you sure? [yes] / [no]

fl@C@ wrote 6 days ago null point

The raspberryPi is actually very important.. First and foremost, it provides an internet connection and retrieves spectral data from the online databases... It also does the image stacking, and a fair amount of the computational stuff.. It acts as a central hub for the remote interface to determine what needs to happen based on the task the user requests.. And a number of other things.. It also provides a solid platform for experimentation and ventures into using the whole platform for things I didn't originally think of..future expansion and so on. I don't want the system too reliant on the remote interface for image processing, stacking, hardware control, etc.. since I thought it would be better to allow for more OSs to use it, etc.. Ultimately, that's the beauty... if someone decides they don't want to add a certain portion, they can modify it to suit their needs, etc.. =D

Are you sure? [yes] / [no]

Pixel Pirate wrote 6 days ago null point

I can see all but the image processing being done on an embedded setup, and that is mostly because you would want the client to interpret and manipulate the data through a GUI. Though in the end it is your project...

Are you sure? [yes] / [no]

fl@C@ wrote 6 days ago null point

I haven't reached the point in development yet, and the documentation doesn't reflect it yet...but in the long run... the spectrometer will come in three flavors.. one of which is a low cost option with the raspberryPi camera module...which is originally where the raspi came in.. A little into development, I moved to a Linear CCD for the spectrometer...that's early in the project logs.. So, mostly that is where the raspi started, in addition to providing all the stuff I mentioned.. I still plan on supporting the raspberryPi camera module for people who want to use a lower end/cheaper spectrometer...using a dvd diffraction grating,etc...
Also.. I will argue that it facilitates the theme of modularityI am trying to design into this entire project... Without the raspi as a hub, I'd have to code each MCU to communicate and they'd be reliant on each other.. I suppose I could work around that, but for simplicity and modularity.. I like the approach..and it makes the system slightly more standalone and gives room for more features......which I haven't hinted at yet... but I plan on making this a part of a group of instruments that share data and so on... For the $40, it seems like it provides a big bang for the buck on my ultimate goal...

Are you sure? [yes] / [no]

Matouš wrote 18 days ago null point

Hi! I am trying to reproduce your method of driving the Toshiba CCD with the Nucleo, but so far I am failing to do so. Could you please update the schematics of the imagingBoard to the latest version?
I managed to make up from your code on mbed that the pins PB_8 (shiftGate) and PC_6 (shiftGate_int) should be connected, possibly using a resistor for protection and the shiftGate_int pin is used to trigger the checkState function from the shiftGate PWM. I don't understand why you are connecting the CCD VDD pin to 5V. Maybe if you at least connected the CCD output to the 5V tolerant (if I understand the uC datasheet correctly) A1 pin, but you are connecting it to the A0 input, which I believe can damage the uC when the CCD output exceeds 4,0V.
If you could just update the connections schematics, I would be glad as I could see if I am doing something wrong or my CCD is dead. Thanks!

Are you sure? [yes] / [no]

fl@C@ wrote 18 days ago null point

Hi Matouš,
The schematic I posted in the project log - Is the current configuration I am using.. I''ll be revisiting that soon, but for now it seems to work pretty well.. You might be right about the value exceeding 4.0V, however I didn't anticipate that in my testing since the light levels are so low.. This is a point that needs some attention though and I do plan on making it more robust..
The image at is what works for me though.. The CCD datasheet appears to me to imply that it's 5v tolerant..

I'm not entirely sure I understand your question... Regarding the CCD VDD pin (Digital Power Supply - pin 1 on the CCD) is connected to 5v on the nucleo.. Pin 2, which is the Analog Power Supply (VAD) is also tied to 5v from the nucleo.. (Which might be more relevant to your concern of overdriving the nucleo Ain, I will have to check the STM32 datasheet to see what it's tolerances are, but I was under the impression it was 5v)..
In any case, I would imagine you should get something from the device... Are you using the 1304DG or AP? Are you using the mBed online compiler? What are you using to determine your output? Have you checked your signals using a logical analyzer?

I'd love to help, let me know! Also, take a look at this image, it's pretty easy to follow too...

Are you sure? [yes] / [no]

PointyOintment wrote 18 days ago null point

> You might be right about the value exceeding 4.0V, however I didn't anticipate that in my testing since the light levels are so low..

Maybe clamp the output to 4.0 V with a Zener diode just in case? That way you don't lose resolution in the part of the range you're using.

Are you sure? [yes] / [no]

fl@C@ wrote 18 days ago null point

I'll be revisiting the hardware for the analog portion soon... I'm not really convinced the final version will even use the ADC in the STM32.. I've been reviewing multiple ADCs, some which are pretty appealing and use I2C and are higher resolution, etc.. The current setup was mainly for testing...but it does work...I wouldn't use it for anything serious though.. As soon as I get the rest of the hardware and optics for the spectrometer finished up and tested, I'll go back to the electronics and clean up my work there....and that will probably include some new code as well.. :)

Are you sure? [yes] / [no]

fl@C@ wrote 18 days ago null point

Matouš, I just reviewed the Nucleo data sheet.. You are correct, the analog input is 3.3v... In this case, I would suggest powering the Analog Power Supply to the CCD with 3.3v instead of 5v.. And change the code for the output to the raspi (or whatever you're reading it with) from raspi.printf("%i\t%4.12f\r\n", pixelNumber, 5 - ((pixelValue[pixelNumber] * 5) / 4096.0)); ............. to ............. raspi.printf("%i\t%4.12f\r\n", pixelNumber, 5 - ((pixelValue[pixelNumber] * 3.3) / 4096.0));

That way, the analog out will not exceed 3.3v... You can also drive the CCD itself from the 3.3v supply if you wish as it has a relativelly wide range...but I'd suggest reading the datasheet to understand the implications... Do you plan on using this in a raman spectrometer, or another application?

Are you sure? [yes] / [no]

Matouš wrote 17 days ago null point

I have the 1304DG, but I believe the only difference between DG and AP is the packaging... I am using the mbed online compiler and probing the output with an oscilloscope. I tried the code you have on mbed ( and I still don't understand the way the checkState function is supposed to be triggered. You have the shiftGate_int pin tied to trigger the function on rise, but on the schematics you posted the pin (one of the Morpho headers if I am not mistaken) is not connected to anything...
If I wire everything as you are suggesting on this image, the checkState function never triggers.

I am planning to first trying to make it spit out at least something and than probably make some PC software for it. I already have something as I was attempting to do this before, but failed, so it is just lying on my HDD, waiting for it's chance. Eventually I would like to make a spectrometer - probably not as complicated and professional as yours, but if I have plenty of time and money, I might give it a try :)

Regarding the voltage problems - firstly I believe the voltage output of the CCD goes actually higher with lower light. Secondly I see no reason to drive the CCD from 5V instead of 3,3V except that it will work on a bit lower frequencies. Is that the reason you chose to power it ftom 5V?

Thanks for the replys anyway, it is a very nice project I would really like to see finished and working!

Are you sure? [yes] / [no]

Matouš wrote 17 days ago null point

Oh and I am using the Nucleo-F411RE, not F401 as you are, but that should not make a difference...

Are you sure? [yes] / [no]

fl@C@ wrote 17 days ago null point

My mistake.. In my rush, and absent mindedness... I failed to document that I am using a jumper across PB_8 and PC_6.. Sorry, my memory is very very short...and if I am not in the middle of something, I completely forget.. Sorry.. Like I said though, this code and hardware configuration was never intended to make it to the final version.. It is a proof of concept that I could use states to trigger the stages.. I will be going back and possibly using an external ADC.. I don't think the 411 board should cause any problems, the pin configuration differences between it and the 401 board seem fairly trivial.. The jumper across those pins should make a world of difference for you though, I had to do that because the mBed platform doesn't support a lot of functions required to trigger an interrupt from an outgoing signal.. I'll be eliminating that dependency in the next version as well...

Hope that helps you... it certainly would explain why you're getting nothing from the CCD.. Let me know if it helps!

Are you sure? [yes] / [no]

Matouš wrote 17 days ago null point

Yeah, I figured that out in the beginning already. Turns out the problem was the supply voltage after all. When I connected the CCD to 5V it suddenly started working. Probably should have calculated the frequency at which the CCD is working. Why don't you like the uC ADC? It's 12bit, that means 4048 resolution no? That times the 3648 pixels of the CCD seems like quite a lot of data... I wouldn't rush very much to upgrade the hardware. When I was first attempting this, I was using an LPC1114 with 10bit ADC and undersampled the pixels to only 1024 samples, which still gave me nice 1Mb of data...
Also what do you not like about mbed? It is not as fast as writing native code for the processor, but I think it is much more manageable and also easier to understand for others who didn't write the code. It is not that slower too...
But I guess it depends on what you expect from the machine in the end. It's just that you can always buy a better ADC and add it there, but until you have a good foundation to give you usable results, it is all useless anyway, no?

Anyway my CCD seems to be talking to me right now, so I thank you for your help and depart to play with it for the rest of the day :)

Are you sure? [yes] / [no]

Matouš wrote 17 days ago null point

sent you an email with the updated schematic to make sure noone else gets confused

Are you sure? [yes] / [no]

fl@C@ wrote 17 days ago null point

Don't get me wrong, I actually really like the mBed platform.. It's just that the Nucleo boards are missing some support until they fill in the gaps..
I might still use the internal ADC, but there are some 16bit devices that deserve a look at least..they are more tailored for CCDs.. I'll definitely be posting on my findings with that as I move along..
Spectral resolution is the goal.. the more information I can get from the CCD about the spectra the better the results.. is a good overview.. Speed of the ADC, the ability to eliminate noise..
I guess I'm the type that defines the outer limits of what my expectations are for the project...I build a rough sketch of what I envision the final product to be...then I fill in the gaps until I am satisfied with the result... Especially on a big project like this one.. I could spend months working on each part individually until each is perfect, and then fit them together when they're done.. but I lose flexibility and interest along the way.. I'm a little more dynamic in my approach and it evolves as I fit it together.. It may not be the best approach for everyone...and at times may look buggy along the way....but it always works out and has worked very well for me to date.. :)

Are you sure? [yes] / [no]

fl@C@ wrote 17 days ago null point

I'm glad to see you got the CCD going... btw and thank you for the info and interest!! Hopefully, I can integrate some of this into this..!
If you need a jumpstart on the PC side.. I can share some python code I have that produces a nice matplotlib graph from the CCD... (Shown in a couple of my project logs)..
Good luck!

Are you sure? [yes] / [no]

Jasmine wrote a month ago 1 point

Hello fl@C@, I've just checked your project and it meets the requirements, so it will be considered for the next round of The Hackaday Prize. Thanks & good luck.

Are you sure? [yes] / [no]

peter jansen wrote a month ago null point

Great project. I just read your new post about difficulty finding (and driving) linear CCD/CMOS sensors, and having to find out-of-production models on eBay, which makes it tricky for others to replicate the project. I've been looking for similar (but much smaller) sensors for a new version of the open mini embedded spectrometer for the open source science tricorder, and there look to be some good offerings from Hamamatsu. Some of them have high MOQs, so they're a little out of reach, but after talking with a rep it looks like there are a few in the ~$50 range with a MOQ of 1, and might be worth switching to. If you'd like example code for driving a linear cmos, there's some Arduino code if you google "Open Source Mini Spectrometer". Eagerly looking forward to seeing the first specra from your raman spectrometer!

Are you sure? [yes] / [no]

fl@C@ wrote a month ago null point

Thanks Peter! Yes, I want to avoid designing something with end of life parts for sure.. I looked at the Hamamatsu mini-spectrometers ( ) a little while ago... I think I was looking at the C12666MA.. Marvin commented on my Bio page about the resolution.. I didn't contact a sales rep, but $50 isn't too bad. Did the rep mention any distributors that sell them? I check Mouser, Digikey, Avnet, element14..not that any of them sell the Toshiba chip either...but the Toshiba TCD1304 does seems to still be in production.. Although I couldn't find the AP only the DG, which is the one I have and seems the only difference is the ceramic vs. plastic packaging.. I'll definately take a look at your code.. I'm not using an arduino, but I am sure it'll be helpful.. I'm hoping to have some spectra fairly soon! I hope to get it in before the August 20th deadline..!

Are you sure? [yes] / [no]

fl@C@ wrote a month ago null point

Just ran across this link again.. You can buy the TCD1304DG from Avnet Express for $22.49 each (moq=1)... They have over 6k in stock.. :)

Are you sure? [yes] / [no]

davedarko wrote 2 months ago null point

is the neopixel ring planned as a kind of "preview" output spectrum? would be kind of cool.

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

The thought had crossed my mind... Mostly I had planned on using it as a sort of indicator sorta like the spinning wheel on a mac or the hourglass on windows, etc.. with different patterns for different functions... Maybe it can display the spectra as it's imaging to indicate it's working........ I will definitely keep that in mind.. :) Thanks for the skull BTW!

Are you sure? [yes] / [no]

fl@C@ wrote 2 months ago null point

Just as a note too... I had planned on hopefully having it display a preview graph on the 2.2" LCD as it processes the info as well..

Are you sure? [yes] / [no]

Zeke_D wrote 2 months ago null point

Found a university example that may be of use for reference.
Keep up the great work. :)

Are you sure? [yes] / [no]

fl@C@ wrote 2 months 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 3 months 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 3 months 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 3 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 3 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 3 months ago 1 point

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

Are you sure? [yes] / [no]

nmz787 wrote 4 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 4 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 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.... 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 will probably include a peltier cooler...

Are you sure? [yes] / [no]

nmz787 wrote 4 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 3 months ago null point

I am currently using a Horiba Aberation Corrected Monochromator Grating Type 532 00 110 ... 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..

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 3 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:

Also section 6 and 7 here (repost from Richardson Gratings):

Are you sure? [yes] / [no]

fl@C@ wrote 3 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 ( ), 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 3 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 4 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:

However, would use this one, its much more capable:
Docs are here:

Stacking examples in Python:

Hope it helps,


Are you sure? [yes] / [no]

fl@C@ wrote 3 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 4 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:

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

Are you sure? [yes] / [no]

fl@C@ wrote 4 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 4 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 4 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 4 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]