Public Lab Research note

WebValley 2016: improved compact spectrometer

by cristoforetti | June 22, 2016 12:38 22 Jun 12:38 | #13225 | #13225

What I want to do

Second post about the development of a portable spectrometer to be used outdoor on field during the WebValley 2016 Summer School ( The school just started on Monday and together with Jeff, who is here with us for the whole week, we are working hard to improve the layout of my previous post (

The first prototype, used four reflections of the beam in order to increase the length of the light path. After the feedback from Public Lab users, and after receiving the new webcam we decided to simplify the design. In particular the new webcam gave us the possibility to shorten the distance between the slit and the sensor to around 10 cm. Thus, it reduced the number of reflections to one. Following: pictures of the new prototype.


First results

Calibrated spectrum from a CFL lamp is shown in Fig. 2; it looks like mercury with some other phosphor. As we can see a very light peak just after 700 nm, which is not usually present in the mercury spectrum (we think).

The spectrum in Fig. 3 is obtained with a simple script we wrote in Python using opencv to capture and analyze the data.

From Fig. 2 we can check that most of the second order spectrum is also captured. On the left side, the light spot comes from the webcam facing directly the mirror. We captured this wide angle of light due to the webcams fisheye lens.



Questions and next steps

In the development of the spectrometer there are various issues that would need improvements: 1. Mirror: with our design we need a mirror. As discussed in the comments of the precedent post first surface mirror are the optimal choice. Thanks to Jeff now we have one and we will try to see how this improves the spectrum. 2. Light source: test made with the prototype show that we can also capture the second order diffraction spectrum. This means that if we are interested in capturing both the NIR range (700nm - 1100nm) and the VIS range we would need two different light sources to be able to capture the spectra separately. Otherwise, NIR would overlap with VIS at m=2. Thus, LED are probably the best solution. There are thousands of different LED with many parameters to fix. 3. Working in reflectance: as you can see from the first figure we added a LED light immediately above the slit, in this way we can try to work in reflectance instead of transmittance. Tests are in progress


This is especially cool as it uses a Raspberry Pi camera, which it seems can be set for fixed exposure and uncompressed image capture. I'm going to install SpectralWorkbench.js which now has a script for commandline image to CSV processing:

Reply to this comment...

I have a similar camera in my spectrometer and was having the same light spot interfering and showing up in the spectral data, I had to bring mine down to 29 deg angle to avoid it, and it works. Now you may be able to use it with it at it's present upright angle if the mirror angle is correct, but I can almost guarantee with the fish eye effect there will be a slight distortion of the diffracted light.

Reply to this comment...

Is the form factor your main concern in these designs?

I'm curious what is the test you are trying to run in the field with the spectrometer?

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

@tonyc, the idea is having a portable spectrometer to evaluate fruit maturity in the field to decide about harvesting. In this sense design is certainly important. Farmer are without notebook in the field. And it is also possibile that we have no internet connection ...

Reply to this comment...

That's a really cool use case I hadn't heard of before! Is it something you've had luck with using the PL spectrometer, reading fruit?

I imagine each type of fruit would present its own issues, as far as relections off the surface, shape of the surface, how to get a light-tight seal around the fruit, etc.

But in general, do you find you can get useful spectra from the basic DSK design in this use case? Do you have any spectra on SWB showing fruit? Very cool stuff.

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

@tonyc the project is really under development in these days. Here at webvalley 2016 we are concentrating on measuring grapes and raspberries. Hope to have something more to share in the next two weeks.

Reply to this comment...

Have you all seen the PhotosynQ project? It is an LED based device using reflectance to measure leaf chlorophyl. it started as an incubated kit on the PL store called the MultispeQ.

Seems like it could be a relevant project, closer to your use case maybe.

Is this a question? Click here to post it to the Questions page.

Reply to this comment...

Login to comment.