Close

More Spectrometer Design Fun

A project log for ramanPi - Raman Spectrometer

The open source 3D Printable Raman Spectrometer using a RaspberryPi and easy to find off the shelf components..

flcfl@C@ 08/27/2014 at 09:190 Comments

What have I been doing this past week?  In a nutshell...taking a crash refresher course in trig and burying my head in the web reading about ray tracing and and a bunch of head scratching with openSCAD on getting objects to change angle and position based on another objects angle and position...  For example, the entrance slit shines light onto the collimating mirror... that mirror reflects and collimates the light onto the diffraction grating.....  I am working on getting openSCAD to automatically position the grating based on the mirrors parameters ...diameter, focal length, angle and so on..  that makes the diffraction grating move so it's in the right place to reflect the correct order (chosen with a parameter) to reflect onto the focusing mirror.  I've been pretty successful so far.. I'm still working on getting it to calculate the diffraction angles..that gets kind of tricky because it almost turns into a feedback loop since the angles change for each order depending on the angle of incidence..  

My main goal with this is to get this part of the system to be as flexible as possible.. So someone who wants to build one can just plug in the numbers for the optics they were able to procure and the spectrometer will pretty much design itself so they can print one on the 3D printer with all the right focal lengths and angles for their specific optics.  I have maybe a couple more days work to go with it and then a round of cleaning up my ugly code...  

But as you can see here... it's not terribly far off the mark...although there is a lot left to fix..

This picture is ugly, but it shows the beam paths(although not correctly for the focusing mirror since they don't converge to the focal point of the spherical mirror yet) for the light as it goes around..  In this first one, you can see the collimating mirror is at a 20deg angle, the grating position and angle is automatically calculated... then the focusing mirror is automatically positioned from that...it's angle and the position of the detector array will follow suit..

In this second image, I changed the angle for the collimating mirror to 15deg instead of 20....

Not a HUGE difference since it's only 5deg, but you can clearly see that it moved the diffraction grating and changed its angle as well as moved the focusing mirror to compensate...

The calculation (however ugly it is at the moment since this is a rough sketch so far) for calculating the diffraction grating based on the collimating mirrors parameters are as follows:

// diffractionGrating X position calculated from collimatingMirror angle and distance
DG_Xp = CM_Xp + CM_EFL * cos((CM_Zr*2) - 90);		
// diffractionGratingY position calculated from collimatingMirror angle and distance
DG_Yp = CM_Yp + CM_EFL * sin((CM_Zr*2) - 90);
// diffractionGrating Z position
DG_Zp = 0;			
DG_AN = DG_Zr + 90;

DG_Xp, DG_Yp and DG_Zp are the X, Y and Z positions for the diffraction grating...the CM X,Y and Z are for the collimating mirror... and the CM_Zr is rotation...  DG_AN is diffraction grating angle. The same set goes for the focusing mirror pretty much to calculate its position and angle.

Here's a little animation showing the relationship of the collimating mirror and the diffraction grating..  I obviously have a lot of work to do still..

The math for the concave mirrors is pretty tough to do in openSCAD..  At least with my experience so far..  Here's an example from wikipedia.. Not so much of a worry for the collimating mirror, but is for the focusing mirror..but I might be lucky that the mirror is at its focal length.. But still more reading is required... 

But..when I'm done, it will be very simple to customize the spectrometer!  

For fun, try reading this.. http://en.wikipedia.org/wiki/Geometric_optics  or this  http://en.wikipedia.org/wiki/Blazed_grating  or play with this calculator!


I'm going to go ahead and make another update to this post since I was distracted while posting it and forgot my main focus..no pun intended.  I'm trying to figure out a way to not only automatically calculate the positions and angles for each mirror and the grating and detector....but I want it to visualize the rays for a preview as well..  openSCAD has posed a couple of challenges for me in this dept.  I just found out earlier that apparently you cannot increment or change for that matter, variables..  So, no loops that increment a value..  That poses a problem for my first attempt at using the Bresenham Line Algorithm to test an idea for tracing the rays...  Before this project (a couple months ago), I hadn't really used openSCAD for more than a few minutes..  I really like it, because it works more the way I think than pushing a mouse around, but there are some severe limitations..  If anyone has a good idea of how to trace and plot a ray using really any language, I'd love to see it..  

Discussions