leswright1977 / PySpectrometer

Raspberry Pi Spectrometer
Apache License 2.0
653 stars 104 forks source link

Compactness #5

Open arthurwolf opened 3 years ago

arthurwolf commented 3 years ago

Really awesome project!

This is huge (in terms of volume). I think this would be much more useful as a tool, if it was much more compact (say if you could have this easily added to a trichorder etc).

Does anyone reading this have any idea how it could be made more compact?

The internet has some designs for compact spectrometers, but I would be interrested in something even more compact if possible. You can see one such design here for example: https://img.laserfocusworld.com/files/base/ebm/lfw/image/2016/01/1305lfw01f1.png?auto=format&w=720

Could a prism be used instead of the diffraction grating? That sounds like it could be made more compact then. A very small motor could be used to move (rotate) the prism about if needed, there are minuscule stepper motors around, and I can help with finding and interfacing those if required.

The design of this project (PySpectrometer) looks a lot like this one, am I correct in my understanding there? https://www.hamamatsu.com/sp/ssd/product/Spectrometers/img06_en.png

Stacking mirrors also might have potential by increasing the number of reflections (still using only two mirrors) and therefore widening the prism/spectrum effect: https://media.springernature.com/m685/springer-static/image/art%3A10.1038%2Fs41467-018-06495-5/MediaObjects/41467_2018_6495_Fig1_HTML.png

Something like this has a similar concept to what I'm describing here : https://www.researchgate.net/profile/Manuel-Cano-Garcia/publication/338279737/figure/fig1/AS:845739789938690@1578651487502/Schematic-draw-of-the-proposed-spectrophotometer-An-Arduino-stage-drives-all-the.png but I would think it might be possible to make this even much more compact somehow ... just racking my brain for an engineering solution and have not found one yet. Curious if somebody else reading this would have an idea.

Maybe it could be possible to take advantage of the fact that we have a 2D sensor (instead of the strictly 1D sensor we actually need for spectra), by having several different prisms stacked on top of each other, creating different lines hitting the sensor on top of one another. This should be relatively easy to manufacture: it is simply a pile of flat panes of glass, on top of one another, with their entries and exists at different/varying angles (and presumably an opaque sheet of something between each layer). I can create a schematic of this if somebody is interrested and/or my description is not clear enough. It would also be very easy to make this very precise, by having two (or more) holes in each pane/plate/prism, and have a "pin" go through all of the holes in the stack for each series/stack of holes, thus ensuring perfect alignment of the prisms. This way, you would get on your sensor, a series of spectrum lines on top of one another, giving you a 2D array of spectral points instead of a line/1D array of such.

I hope I'm not saying anything too stupid...

Maybe it's not stupid: I found an image that looks like that idea: https://www.osapublishing.org/getImage.cfm?img=dTcqLmxhcmdlLG9lLTI2LTE1LTE5NDU2LWcwMDE

The interresting thing/goal of what I describe here, would be that it would be very compact, which is the objective/what I created the issue for. But if anyone else has any idea of how to make things more compact, I would be very interested to hear about it (I need very compact spectrometers to identify materials on an automated recycling/sorting CNC machine)

Sorry for rambling about this, I hope I'm not disturbing anything, I'm just trying to get a conversation going.

Cheers!

arthurwolf commented 3 years ago

Does anyone know if laser cut acrylic/PMMA would work to make a prism for a spectrometer? If so I can easily design an incredibly trivial-to-manufacture proof of concept for my "stacked" idea... Or would the PMMA only let through a certain spectrum in a way that would make this useless?

arthurwolf commented 3 years ago

Uuuuuuh... I just looked up what diffraction grating is on Wikipedia, and I think my rambling about was just re-inventing warm water. Sorry for the noise people.

PySimpleGUI commented 3 years ago

PySimpleGUI may compact the code if code length shortening is what's being suggested.

arthurwolf commented 3 years ago

Oh no, I mean ideas for more compact mechanisms/hardware. Like, the optics. LIke, you have this very long/bulky diffraction grating thing, and I was brainstorming ideas for things that would take less space/volume. A lot of what I wrote was rambling, but there was one idea I think I will try next time I get access to a laser cutter to see if it might work or not, that might allow for a more compact version of this project.

MakerMatrix commented 3 years ago

There are shorter diffraction spectroscopes. I just ordered one that is 55mm long. i believe the one in the project is about 3x that long.

You might be able to get away with running on a Pi Zero if you can accept a low framerate. Those are tiny. I have not tried this, it's just an idea.

leswright1977 commented 3 years ago

Cool! Let me know how you get on! If you wanted to run on a Pi zero, you could always strip back the interface, and just have an OpenCV Imshow frame.

Les

On Tue, Apr 27, 2021 at 7:41 AM Jarrod Smith @.***> wrote:

There are shorter diffraction spectroscopes. I just ordered one that is 55mm long. i believe the one in the project is about 3x that long.

You might be able to get away with running on a Pi Zero if you can accept a low framerate. Those are tiny. I have not tried this, it's just an idea.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/leswright1977/PySpectrometer/issues/5#issuecomment-827354625, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5IEE5WCTWR6DKMLFEYRI3TKZMCHANCNFSM43QCXMWA .

PySimpleGUI commented 3 years ago

I've got my eyes on this project. I would love to use it as a design pattern for "scope" projects using PySimpleGUI. There is at least 1 I know of now. I just don't have the ability to DO anything with it at the moment. Someday I'll be back to take a look at some of the features you've made.

MakerMatrix commented 3 years ago

My tiny $30 diffraction spectroscope came today. A quick look through it inspires some level of confidence that this little guy can work.

IMG_3958 IMG_3959

arthurwolf commented 3 years ago

Schematic

My tiny $30 diffraction spectroscope came today. A quick look through it inspires some level of confidence that this little guy can work.

Why do these have to be a (long) tube like this?

Is there any way they could be made much shorter of a tube?

Anyone has a schematic of how these work/function/are designed, so we can rack our brains for anything that could help shorten/make them more compact/take less volume or space in any way?

Is this an accurate schematic of the kind of tube you have been using?

spectroscopediagram

( image link )

If we can't reduce the length, can we reduce the diameter? Or can we reduce both diameter and length at the same time ("shrinking" the entire assembly altogether ?)

Looking for any ideas that could make this more compact/transportable, become a tiny attachment/add-on for a smartphone or a pi zero's camera module.

Angle

Most schematics I can find for a diffraction grating spectroscope tube, have some kind of angle required in the design (see the image/schematic just above).

Your tube is straight, no angle/change of direction from the light source being analyzed, to the actual sensor doing the measurement (CCD/CMOS etc). How is this? Why is this a thing?

Existing designs

I looked for "existing" designs that try to accomplish compactness, and did not find much.

One is this product aimed at smartphones, with the end goal of use for gem analysis in the field:

https://www.amazon.fr/GoSpectro-smartphone-Spectroscope/dp/B07KFJZW1Q//

Also: Product page at the actual company rather than their Amazon shop

And it's beefier cousin

And an interesting write-up on those tools.

Any opinions on the product, and in particular ideas of how the compactness is achieved / what the schematic for it would be?

Learning

I found this is also a pretty interresting ressource about diffraction grating, with a few very neat schematics.

leswright1977 commented 3 years ago

Beautiful. I got a smaller one also, they are so tiny. If I can source a smaller zoom lens for the picam, this would be sweet!

On Sat, 1 May 2021, 19:05 Jarrod Smith, @.***> wrote:

My tiny $30 diffraction spectroscope came today. A quick look through it inspires some level of confidence that this little guy can work.

[image: IMG_3958] https://user-images.githubusercontent.com/52144433/116791108-bd63cb80-aa7d-11eb-8166-c79e7bab7077.JPEG [image: IMG_3959] https://user-images.githubusercontent.com/52144433/116791109-bdfc6200-aa7d-11eb-8155-fa986dc0a29a.JPEG

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/leswright1977/PySpectrometer/issues/5#issuecomment-830671064, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5IEEYIY4IE46PGXU7JYTDTLQ7FTANCNFSM43QCXMWA .

leswright1977 commented 3 years ago

The diagram is more or less there. After the slit, there is a collimating lens before the grating. In the model I am using, there is also a prism of some description, so the the output is in-line with the device. Hence the length. Paton Hawksley do a miniaturised version as well, that I am looking into.

On Sat, 1 May 2021, 19:18 Arthur Wolf, @.***> wrote:

Why do these have to be a (long) tube like this?

Is there any way they could be made much shorter of a tube?

Anyone has a schematic of how these work/function/are designed, so we can rack our brains for anything that could help shorten/make them more compact/shorter?

Is this an accurate schematic of the kind of tube you have been using? image link https://outsidescience.files.wordpress.com/2012/02/spectroscopediagram.png

If we can't reduce the length, can we reduce the diameter? Or can we reduce both diameter and length at the same time ("shrinking" the entire assembly altogether ?)

Looking for any ideas that could make this more compact/transportable, become a tiny attachment/add-on for a smartphone or a pi zero's camera module.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/leswright1977/PySpectrometer/issues/5#issuecomment-830673221, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG5IEE2TRJEH7AZ6PTWCNIDTLRAWDANCNFSM43QCXMWA .

MakerMatrix commented 3 years ago

I think there are at least two things going on with the length. First, the light needs to be collimated. That is what's being depicted in your diagram where the white light travels for quite a ways before it hits the grating. It can occur via a lens with some focal length, or by a thin slit and a length of tubing, such that rays that are not perpendicular to the grating will eventually hit the sides of the tube and be absorbed.

Second, there has to be adequate space for the differentially diffracted rays to resolve into a pattern that's wide enough to produce a spectrum you can resolve into its individual components. See the triangle produced by the diffracted rays in your diagram. The base of that triangle determines the resolution, and is related to the distance from the grating.

arthurwolf commented 3 years ago

@MakerMatrix Thanks for the great explanation!

My naive understanding is that I can just miniaturize this (make everything 4x smaller), and with the correct lens at the entry, and the correct lens at the exit, have something functionally identical, but (nearly) 4x smaller (not exactly 4x smaller since the entry/exit lenses take room too).

Is that wrong?

I found an optics simulation thing the other day, I'll try to test my hypothesis in there.

MakerMatrix commented 3 years ago

If you can find a collimating lens with a very short focal length, perhaps. I'm not an optics expert but this person is:

https://www.edmundoptics.com/knowledge-center/video/tutorials/understanding-collimation-to-determine-optical-lens-focal-length/

Edit: what we are discussing here is running her experiment in the other direction: a non-collimated light source on the opposite side of the lens, producing collimated light on the other side, at <focal length> away from the lens. That is where you place your grating.

MakerMatrix commented 3 years ago

Side comment: In my way of thinking, the tube needs not be shorter than the longest dimension of the Pi itself. At least if you are talking about making a standalone version (which is what I plan to try).

I'm thinking of putting it together in such a way that the camera is on one end of the pi, lined up with the tube, which is over or under the Pi. If you can manage that, the entire thing need not have a footprint any larger than the Pi. This little spectroscope I showed is just over 1/2 the length of the Pi 3/4 boards.

arthurwolf commented 3 years ago

@MakerMatrix My goal is mostly that I'm curious about what the ultimate/maximum compactness that can be achieved here is.

Maybe it'd be useful if this could be made into a very compact attachment to a smartphone too (not necessarily using the smartphone's camera either)

I think there is value in discovering ways to make this more compact, if we can discover any. Maybe value we don't currently know what to do with/about, but that others reading this later will have ideas about / uses for.

Making things smaller tends to be a good idea, in general, technologically speaking.

mrpackethead commented 3 years ago

i would trade size for better accuracy. Size is not something i particularlly am worried about.

jjoeff commented 2 years ago

G'day, so i tried to make this thing as small as possible using the new Pi Zero w 2. I also tried a 3,2" Screen, but the resolution is a) to small (320x240) and b) its not showing the running software. So i scrapped the screen, installed a LiPo shield, so it portable. VNC gives me access and it looks nice on a mobile screen. 2021-11-28 22 39 55 - Kopie . Now i am waiting for new hardware (RPi4 + 5" 800x480 screen) so i can use it as a bit less compact stand-alone solution.

Primarily i want to learn more Python. Now i have to look into a full screen-mode with autoscaling all the frame sizes of the software. Also i made me a plan to set the software up, so it runs on different screen sizes. I am not sure how well i will accomplish my plans. I thought about interacting via a touchscreen, so the buttons should grow in size. Here are my first ideas: Frontend

Raw: will show you the normal spectral intensities.

T: stands for transmission. What i did in old spectroscopy project is i used ambient background light for reference (100%) then i could check my samples. The light source with this idea should be a dedicated bright LED light because the intensities of background light will not show up well.

R: is the reflection. Problem here: i need a light source and a white reference sample. I got a few ideas and some fancy white samples already. The light source i am looking for is circular positioned around the spectroscope with a focusing lens. The lens should be out of plastic, so i can drill a hole in the middle, so the focused light can fall back into the scope.

Also i want to utilize the USB-Port from the rPi4 to store the measurements directly on a USB-Drive, if a available.

This little thing, thanks to Les, already is a very powerful scientific and cost effective tool. In my eyes the development can mature even more. I am so glad you Les brought this thing to life.