Sunday, December 23, 2018

Home-brew Spectrometer

Due to a quality control problem at a local marijuana dispensary, we found the high-CBD plants we thought we had actually were unknowns.  This became apparent when the plants got big enough to exhibit their typical growth habit and odor (smell can vary widely among different clone types).  To make it clear:  we want high CBD for pain management.  Not interested in getting high.

Via online searching I found a chemical test for CBD and it showed that just one of the 3 clones contained much CBD -- but, unfortunately, the test is not very quantitative.  It relies on the development of a purple color when the plant material is added to a 5% solution of sodium hydroxide dissolved in alcohol.   The darker the color, the more CBD is present.  But eyeballing is not very accurate.  I started thinking that a spectrometer might improve the accuracy of the test.  In addition to the alcohol-hydroxide test, there is a very sensitive test that will stain THC and CBD slightly different colors.  It is a dye called Fast Blue B, dissolved in water, and is used to develop thin layer chromatography (TLC) plates.  So it MIGHT be possible to determine the ratio of THC and CBD by using Fast Blue B and a spectrometer to resolve the different colors.

But commercial spectrometers are expensive.  Sure, it is possible to find them for less money on Ebay:  but often they need software and a computer, and if the package is complete the price goes up.  The other aspect of this work is to hopefully make it possible for others to do the same measurements on their own material, so a one-off purchase from ebay won't cut it.   As an alternative I found an open-source spectrometer here.  Cost is around $50.  For that you get a web cam, an optical slit, a CD-R disk (to turn into a diffraction grating), a black cardboard box and materials to assemble it all.  I put the thing together and found it wasn't mechanically stable enough to generate repeatable absorption spectrograms.  So I used the essential parts -- the camera and slit -- and built my own spectrometer.  The photos below show the spectrometer I put together.

Exterior showing the slit and lid.  The "hinge" is a length of adhesive-backed aluminum (which is opaque to light).


This is a photo showing the "optical holder" design.  It is a block of oak with a flat-bottomed hole just large and deep enough to glue in a super magnet.  The bottom of the spectrometer is a steel plate, so the blocks stay put -- but are easy to move around to optimize the optical path.

And here is a photo of the interior.  The diffraction grating is glued to one of the optical blocks.  I sawed a slit in the block to provide a robust mounting point for the grating.  The web cam is attached to an optical block using heavy-duty double-sticky tape.  The corners of the enclosure are reinforced with wood blocks that were glued in place.  The top, sides, and ends of the box are made using foam-core poster board.  Black, of course.  I also put a length of the poster board on the bottom, to reduce reflections that would degrade contrast of the spectrum.  I had some black silicone caulk so I ran a bead along the front corners and along the bottom edges as well, to reduce light leaks.

And here is the spectrum of a CFL lamp, obtained using my spectrometer:

Unfortunately, I found the web camera is not compatible with the Public Labs spectrometer software.  At least, not on my linux laptop.  So I found it necessary to write my own program(s) to do the job.  I found a starting point here but it has a fairly serious memory management problem -- it acquires a bunch of frames, and only then performes averaging.  I modified the code to acquire one video frame, then extract ONE line of interest for processing.  This way I can average over any number of frames without running out of memory.  I also wrote a version to get the calibration factors needed to convert pixel positions to wavelengths.  The end result is a system that easily resolves the two green emission lines around 540 nanometers, and has a low noise level in the data.

Now I can move on to testing my THC/CBD measurement idea....

Tuesday, October 16, 2018

Update

A lot has happened since my last post.  Some highlights:

I have a new hip joint.  The joint on my right side was bone-on-bone, painful enough to restrict my activities.  The surgery went quite well -- I was out of hospital the same day of the procedure!  And right now I'm pretty much back to normal as far as muscle strength in that leg.

Another interesting project:  our old barn.  Two winters ago we had a fairly heavy snow fall, and the weight was enough to cause one of the walls to buckle.  Not much of a foundation, especially after many years of dry rot.  Fortunately the wall just dropped a few feet before finding a new equilibrium, and the rest of the barn was flexible enough to not shatter.  It just looks pretty bent.  I am in the process of rebuilding the wall.  I am jacking up that side using some harbor freight "farm jacks".  The temporary support header is several feet over from the old wall, so, once the barn is back to square (more or less) I will install new concrete footers and a new wall.  I will post some photos when I have a chance.

The garden is our perennial summer project, and like previous summers it took a lot of time.  I'm just glad I was in good enough condition so we could get the garden in.  We did have some help putting in some things, like the cucumber and bean trellises -- thanks to Mike and Debbie for that!  However, I wasn't quite in good enough shape to mulch the garden like I usually do, and we paid the price -- weeds galore.  And perhaps that is why our peppers and tomatoes didn't do as well this year as previous years.  Even so, we got enough tomatoes to put up 40 pounds of tomato-vegetable juice and 20 pounds of pasta sauce.

Another milestone:  we initiated a quarterly "draw" from our investments, to cover expenses.  Up to that point we were funding our expenses from savings in the bank accounts.  I have tracked our burn rate so had a pretty good idea on what we would need on a quarterly basis.