This is an update to the main project: Horticultural Spectrometer Upgrade - Planning.
- Acquiring most of the hardware parts
- Setting up the Raspberry pi to interface with the computer over USB and successfully viewing the camera output on the raspberrypi.local/html web address.
This article describes the fun part, hardware assembly!
For the most part, I followed the steps in Assembling the Public Lab Lego Spectrometer until I found out my pi NoIR camera was oriented differently, so I had to alter the lego structure. See all steps below:
1. Confirm Pi Zero W and Pi NoIR camera are successfully set up to be "plug and play" with the computer
This step was extremely important for me, as I didn't want to be fiddling around with the SD card or the pi, or the camera after it was set up inside the spectrometer.
2. Layout lego pieces
All the pieces are organized and in the correct number. Great!
I also cleaned each individual lego piece with a brush to minimize the amount of dust that would get locked into the spectrometer. Any dust inside the housing could later end up on the diffraction grating or camera lens, or even the slit, which would be undesirable.
3. Assemble the lego, glue in the camera
With the first three layers assembled, I used gorilla superglue dabbed around the camera breakout (not on the electronics parts! Just around the edges near the screw holes and on the back of the camera connector, which has a big flat piece of plastic). Little did I know I'd soon have to pry the camera off due to this camera having a different orientation!!
4. Focus the camera
To focus the camera, I first cut a piece of card the same length as the distance between the camera lens and the front of the spectrometer, where the slit would go. That's because I ultimately wanted to focus the camera on the slit.
Then, I used this piece of card to align a picture directly ahead of the camera, using a metal arm device. The idea was that if I focused on the photograph, it should be akin to focusing on the slit since they are the same distance from the camera (just that the diffraction grating redirects the light from the slit into the camera from a different angle).
I focused the lens using the little plastic tool that came with the pi NoIR.
Here you can see the screenshot on my computer of the before and after:
5. A big problem with the camera orientation!
It was here that I started realizing something was wrong. In real life, the public lab image was upright, but in my computer, it was upside down. I expected it to be sideways. Being upside down, it meant that the diffraction grating was going to deflect the spectrum from bottom of the camera sensor to top, not left to right. I consider this to be a major error, as due to "rolling shutter", the camera reads data from the sensor in horizontal lines one at a time. It is MUCH more strategic to have the entire spectrum readable from one single horizontal line.
I had to now rip off the camera from the plastic and make the cable come out the side of the spectrometer.
This is how the modified version looks:
Parallel to this, I prepared the diffraction grating:
6. Diffraction Grating
I used the thin diffraction grating film provided by PublicLab rather than the DVD. First, I dug through my recycling bin and found a very stiff clothing tag to become the frame for the diffraction grating. With a knife I cut it into the correct dimensions with a small hole just big enough to fit the camera lens.
Being very careful to only handle the gratings by the edges, and only place them on clean, dust free surfaces, I cut them into pieces with scissors.
I chose the cleanest piece with least visible scratches/dust, and taped it onto the card frame. This I had to attempt twice, to try to get it as flat as possible. The film warps easily, and I didn't want that negatively affecting my measurements.
When I hold the grating up, you can see the reflection of my window blinds. It should be perfectly straight, but it's not. That's because the diffraction grating is a bit warped, but it was the best I could do.
7. Nearing final assembly
Here the build is nearly complete. I've put in the black card to prevent reflections, but I still haven't put in the slit. I also haven't fixed the diffraction grating in place. That was a lot of work for one day and I'll finish this post when it's done.
For now, I checked on the camera feed to see what the spectrum looks like, just from light coming in the window. For having no slit, I'm pretty happy with it and I hope it will look better when the slit is in place. Time to go buy some razors...
The next steps can be found at Horticultural Spectrometer - Assembly II