{"id":1824,"date":"2024-05-23T17:13:56","date_gmt":"2024-05-23T15:13:56","guid":{"rendered":"https:\/\/mpr-projects.com\/?p=1824"},"modified":"2024-05-24T20:26:00","modified_gmt":"2024-05-24T18:26:00","slug":"building-a-diy-spectroscope-video","status":"publish","type":"post","link":"https:\/\/mpr-projects.com\/index.php\/2024\/05\/23\/building-a-diy-spectroscope-video\/","title":{"rendered":"Building a DIY Spectroscope [Video]"},"content":{"rendered":"\n<p>In this post we&#8217;ll use a camera, an analogue pocket spectroscope and some software that I wrote to build a digital spectroscope. The spectroscope will be limited to roughly the visible range of light (~400nm to ~700nm). While it&#8217;s probably not as accurate as commercial devices we will calibrate it carefully to give decent results.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30)\"\/>\n\n\n\n<p>Sometime last year I saw a YouTube video by Les&#8217; Lab in which Les used a laser to remove the color filter array of a Raspberry Pi camera. Then he put a pocket spectroscope in front of it and read out the data to get a rudimentary spectroscope.<\/p>\n\n\n\n<p>I thought the idea was quite cool but the calibration wasn&#8217;t very involved. For the calibration of the horizontal axis (pixel to nanometer mapping) he used lasers, which I think is fine<sup data-fn=\"bb9014bd-8593-494e-9f22-55088b0ebe78\" class=\"fn\"><a href=\"#bb9014bd-8593-494e-9f22-55088b0ebe78\" id=\"bb9014bd-8593-494e-9f22-55088b0ebe78-link\">1<\/a><\/sup>, but from what I remember there was no calibration of the vertical axis, i.e. of the intensity of light. Diffraction gratings such as those used in diffraction spectroscopes don&#8217;t transmit the same amount of light at all wavelengths. So without calibration the intensity of light shown across the spectrogram is probably not accurate.<\/p>\n\n\n\n<p>The major problem that I can see, however, is that I and probably most other people don&#8217;t have a laser at home with which we can remove the colour filter array of a cheap camera. <\/p>\n\n\n\n<p>The other videos I&#8217;ve seen on the topic don&#8217;t remove the colour filter array but they read the data right off the JPEG. That may be fine if you&#8217;re only dealing with the relatively smooth spectrum of lamps. Once you point your spectroscope to measure the spectral lines of the sky, however, you&#8217;ll get much less accurate results (demosaicking &#8230;).<\/p>\n\n\n\n<p>So when I had an idea of how we could achieve a reasonably accurate spectroscope without removing the colour filter array, I just had to try it.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Building an accurate DIY Spectroscope\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/cYWU4iq_pRU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>You can find the code that I wrote for this project on <a href=\"https:\/\/github.com\/mpr-projects\/DIY-Spectroscope\" target=\"_blank\" rel=\"noreferrer noopener\">github<\/a>. The README.md file on github also includes more details on the optimization process.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" style=\"margin-top:var(--wp--preset--spacing--30);margin-bottom:var(--wp--preset--spacing--30)\"\/>\n\n\n\n<p>Footnotes:<\/p>\n\n\n<ol class=\"wp-block-footnotes\"><li id=\"bb9014bd-8593-494e-9f22-55088b0ebe78\">Although from what I&#8217;ve seen lasers can quite easily damage your sensor so you have to be <em>very<\/em> careful if you use one. I wouldn&#8217;t even use laser pointers to calibrate the pixel to nanometer mapping &#8230; <a href=\"#bb9014bd-8593-494e-9f22-55088b0ebe78-link\" aria-label=\"Jump to footnote reference 1\">\u21a9\ufe0e<\/a><\/li><\/ol>","protected":false},"excerpt":{"rendered":"<p>In this post we&#8217;ll use a camera, an analogue pocket spectroscope and some software that I wrote to build a digital spectroscope. The spectroscope will be limited to roughly the visible range of light (~400nm to ~700nm). While it&#8217;s probably not as accurate as commercial devices we will calibrate it carefully to give decent results.<\/p>\n","protected":false},"author":1,"featured_media":1862,"comment_status":"open","ping_status":"open","sticky":false,"template":"wp-custom-template-single-post-cc","format":"standard","meta":{"_eb_attr":"","footnotes":"[{\"content\":\"Although from what I've seen lasers can quite easily damage your sensor so you have to be <em>very<\/em> careful if you use one. I wouldn't even use laser pointers to calibrate the pixel to nanometer mapping ...\",\"id\":\"bb9014bd-8593-494e-9f22-55088b0ebe78\"}]"},"categories":[10],"tags":[19,18],"class_list":["post-1824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-projects","tag-project","tag-video"],"_links":{"self":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts\/1824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/comments?post=1824"}],"version-history":[{"count":7,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts\/1824\/revisions"}],"predecessor-version":[{"id":1872,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/posts\/1824\/revisions\/1872"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/media\/1862"}],"wp:attachment":[{"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/media?parent=1824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/categories?post=1824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mpr-projects.com\/index.php\/wp-json\/wp\/v2\/tags?post=1824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}