This is a rough idea for a project I'll be working on during a hacker camp in two weeks. I want to share my ideas already now, so I can get your input early on and still have time to order parts if needed. Please note that this is a project mainly for fun and not scientific accuracy, so sorry if it might seem a bit messy ;)
The result should be one single device, at the core of which will be a lego spectrometer (RPI camera) controlled by a Raspberry Pi. It should work like this:
- Insert the sample cuvette
- Push a button
- A python script on the RPi reads the image from the camera, derives the spectrum, compares to a control (solvent only) and triggers some further processing
- The result of the processing (I will describe in detail later) is represented by some RPi controlled LEDs
The main challenge for me will be to automate the whole process, s.t. only one button is necessary. Some ideas:
- https://publiclab.org/n/15880 looks great and I think I can use its capturing logic.
- I could use spectralworkbench via POST to get the spectrum as a csv from the image, but I'm not sure if it's worth it. Also it would involve posting all the captures to SWB and it might be more than one per hour (the suggested limit)
- Alternatively I can do it myself: Transform the one-line cross section camera readout to wavelength domain using the positions of B2 and G2 found by CFL calibration. Then, for each wavelength, average the intensity of R, G and B to obtain the intensity. Is this actually correct?
- I didn't check out how to deal with background/solvent only, but I guess it's really just a simple subtraction...
This is really just a quick record, I will add more details later. Any ideas are very welcome! Thanks and looking forward :)
Jakob
4 Comments
This looks awesome. Just a quick note that this repository can do the extraction of cross section locally:
https://github.com/publiclab/spectral-workbench.js/
Also, @MaggPi has developed some excellent scripts for doing this as well, I believe!
On Mon, Jul 23, 2018, 11:00 AM \<notifications@publiclab.org> wrote:
Is this a question? Click here to post it to the Questions page.
Reply to this comment...
Log in to comment
Hi Warren, thanks for the link. I peeked a little bit into it already, but I don't speak JS, so it's a bit difficult for me not to get lost. I already found some useful functions though! I will check it out when I have more time.
Looked at MaggPi's notes, cool CV stuff! I will also take closer look soon.
Thank you!
Reply to this comment...
Log in to comment
Hi, Not sure if this is a direct match with your project but I can share some of my work on real time spectrum processing.
This video shows how a trackbar is used to select a line which is then displayed on a matplotlib graph. The plot displays the spectrum’s RGB components and is updated at video frame rates. The video shows examples for a CFL and white light spectrum.
https://www.youtube.com/watch?v=yyGCIxKjT9s (The plot shows intensity for a single line of video)
A single frame is also on the spectral workbench site and the RGB split seems to compare well with the real time results. https://spectralworkbench.org/spectrums/139348
The spectrum was taken with a Public Lab Lego spectrometer kit with Raspberry Pi NoIR camera. ( These comments may apply to other designs as well.) I am still fine tuning things but here is a list of mods to the Lego design(see picture below):
-Raspberry Pi camera mount – During my first install I used sticky tape backing to hold the camera and the camera stopped working. Not really sure if it was the tape or something else but it spooked me. I switched to a 3d printed part (https://publiclab.org/notes/partsandcrafts/12-02-2017/quick-build-raspberry-pi-microscope) that is the camera holder for the Public Lab microscope. (The camera does not have a flat back so without a holder it can rock back and forth.) Could not have done this without the help of @cfastie .
-Side mounted design: The Lego spectrometer design has the cable coming out from the top, my design comes out the side. The goal is try to use the NoIR camera to capture spectral data to 1000nm and I wanted to have the long side of the array to match the horizontal spectrum.
-Extra long camera cable: Assume you are going to have some type of GPIO connection to manage the LEDs. You may want to have at a meter length camera cable to give you some working room.
In terms of calibration – -Getting calibration thru the spectrum workbench GUI seems like a solid approach but it may be something that cannot be completely automated. -I have been thinking about using opencv color analysis to set an auto calibration scale. One possible option would be to use computer vision to overlay different color masks and build up some type of cross reference between RGB colorspace and wavelength. Still working on this put you can see color mask sorting at: https://publiclab.org/notes/MaggPi/07-09-2018/computer-vision-color-detection
-Do you really need calibration? Could you just take the spectra and make a selection based on comparisons to prior measurements?
Have fun at hacking camp. I would recommend having a good working spectrometer before you go so you can concentrate on everything else during the camp.
Code available at: https://github.com/MargaretAN9/Peggy/blob/master/Image%20Processing/realtimelineRGBintensitydisplay.py
@warren, @icarito, @amirberAgain,
Is this a question? Click here to post it to the Questions page.
Reply to this comment...
Log in to comment
Don't forget that when doing absorption spectroscopy:
Chris
Reply to this comment...
Log in to comment
Login to comment.