One of my DIY spectrometer designs was published in The MagPi. You can view issue 24 here or you can check out this github link which contains the word document.
As one of my ‘loyal readers’ has pointed out (thanks Nick), the schematic in the MagPi has the LED in the wrong way. Be sure to connect the negative side of the LED to Ground and the positive side to GPIO25.
G’day Bob from Australia! I am a Chemistry High School teacher currently putting together my own build of this spectrometer as described in your article. I’m not very familiar with Wolfram but I think I’ve got the functions into the Pi correctly and got a response from the Pi while checking the capacitor with a multimeter with short[], readpin[] and measure[]. So far so good. Before I ran out of time on Friday afternoon measure[] was throwing an error but I didn’t have it in a blackout box and was just shrouding the LDR with my hand so this may be the problem. I also think my LED may need a lower/higher value resistor – I just found a mystery one (no tech specs) so it’s either not getting enough current or it’s dead already.
Changing the ‘np’ variable to suit my setup is next so I’m guessing I just change the value of ‘np’ to a suitable interval to allow detection of pin 25 going high.
Nick, most generic LEDs will be able to handle up to 20 microamps of current. Checking the current in your LED circuit is the best way to ensure you are getting the brightest light from the device without blowing it up. The resistor I use in the article is larger than necessary, mostly because that’s the size within arm’s reach at my desk. The biggest challenge with this setup in my opinion is the capacitor selection, as it has a very significant impact on the sensor timing. Furthermore, the “correct” capacitor is dependent on the background lighting conditions. I would certainly troubleshoot with a consistent light-blocking setup to minimize the variability in ambient lighting. You are correct about the next step being to play around with ‘np’ to allow it to wait long enough to go high. If it is timing out in the dark, that means you can decrease the capacitor size.
I’m very interested in hearing how the project turns out and how engaged the students become in the instrument design process.
Hi Bob,
Thanks for the swift reply. (I didn’t get a copy of your reply sent through to my email address so it’s just by chance I found out you’d responded).
At this stage I am just trying to get a functioning spectrometer. Once, I’ve got over most of the hurdles I can then design an experience to suit my students.
I have some more staff from around the school helping out now. They’ve rewritten your code in Python and suggested a minor change to the circuit. Incidentally, was the LED in the circuit diagram in the MagPi article round the wrong way intentionally?
I’ve seen the code changes but not the circuit as I’ve had 2 days straight in the classroom and no time to devote to this.
Once this design is working to my satisfaction and we get some usage out of it in class, I will be looking at using the camera module. I’d like to use the camera to take more “real-time” measurements and maybe look at some reaction kinetics – Blue #1 (E133) and NaOCl is what I had in mind.
If you let me know your email address I’d be happy to let you know how the students go with this (although it’s not ‘class ready’ yet and this is still a little way off).
Thanks for your help and inspiration!