Sciencemadness Discussion Board
Not logged in [Login ]
Go To Bottom

Printable Version  
 Pages:  1  ..  4    6    8  9
Author: Subject: Building a polarimeter
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 10-5-2015 at 04:28


So I finally had some time to replace my old op-amps, buy some 1% resistors, etc. I never got to tell ya'll, I was able to remove the noise from the measurments! All I had to do was abandon the audiojack and limit some of the capacitance by using 22awg bare solid core wire on the bread board.

The only thing that's been stifling the project now is simply aligning the detector and sample cell. I am working on a way to do this with craft foam that I did fiberglass and bondo over. I'll let you all know if I get it to work out.

Anyways here's a screenshot for the data of an alignment run. Notice there's no stray dots. Also notice it's not a clean sinuisoid because my source and detector are not parallel. But no more noise!

latest poalrimeter.png - 64kB

edit - if anyone has any nice DIY ideas for creating a sample cell holder and photodetector holder I'd love to hear them. I'm still worried this foam idea won't work out. It's sitting on foam now and still a pain to line up.

Can't wait to put this idea to rest after two years of off and on working between semesters.

[Edited on 10-5-2015 by smaerd]




View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 19-5-2015 at 08:56


So.... I finally have the signal working out, yahoo right? I fixed all of my soft-ware bugs, great. I ran my first trial. And it doesn't look as though I am even polarizing the light lol.

So I did a blank orientation run, and a blank measurement run (left and right images below)
blank1.png - 14kB blank2.png - 15kB

Looks like my motor positioning algorithm is a bit off. It looks like I've started taking measurements too late to catch the first sinuisoid at it's minima. The maxima are at about 270* and 90* (have to add the offset of ~25*). Which means physically and electronically everything is working okay, despite the imperfect sine data. (not sure why this is, things are aligned pretty well, might be too much feedback capacitance)

Then I set up to do another run this time with a sample.
I ran my orientation run (to find min & maxes of a blank cell). Notice that the intensity is quite high, near 900 counts. 87% of the maximum voltage for the microcontroller - amplification success. I'm pretty proud that I was able to work that out without anything other then a 10$ multimeter.
plzplzplz1.png - 14kB

I made a 20% w/v sucrose solution (20g per 100mL) and put it into the sample tray
plzplzplz2.png - 15kB

It's obvious the absorbance has increased, which is a good sign. It doesn't look like the angle of rotation has changed much if at all from what a blank run should be(near 280* and near 100*). Finally conquered some yucky serial transfer code. Now it's just a matter of fine tuning the microcontroller and maybe the amplification circuit.


[Edited on 19-5-2015 by smaerd]

[Edited on 19-5-2015 by smaerd]




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 19-5-2015 at 12:38


Incredible work smaerd !

For repeatability and sanity, align your analogue section to some definite point (without sampling in software) and leave it there - note that point.

Then adjust in software for the expected output.

Otherwise you'll be endlessly battling between what the software tells you and knowing you can tweak the gain of the op-amps etc, then going back and finding you can tweak the code again, ad infinitum.




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 19-5-2015 at 12:46


Quote: Originally posted by smaerd  
if anyone has any nice DIY ideas for creating a sample cell holder and photodetector holder I'd love to hear them. I'm still worried this foam idea won't work out. It's sitting on foam now and still a pain to line up.

What's required o smaerdy one ?

McGuyver at your service.




View user's profile View All Posts By User
IrC
International Hazard
*****




Posts: 2710
Registered: 7-3-2005
Location: Eureka
Member Is Offline

Mood: Discovering

[*] posted on 19-5-2015 at 14:48


Quote: Originally posted by smaerd  
So I finally had some time to replace my old op-amps, buy some 1% resistors, etc. I never got to tell ya'll, I was able to remove the noise from the measurments! All I had to do was abandon the audiojack and limit some of the capacitance by using 22awg bare solid core wire on the bread board.

The only thing that's been stifling the project now is simply aligning the detector and sample cell. I am working on a way to do this with craft foam that I did fiberglass and bondo over. I'll let you all know if I get it to work out.

Anyways here's a screenshot for the data of an alignment run. Notice there's no stray dots. Also notice it's not a clean sinuisoid because my source and detector are not parallel. But no more noise!



edit - if anyone has any nice DIY ideas for creating a sample cell holder and photodetector holder I'd love to hear them. I'm still worried this foam idea won't work out. It's sitting on foam now and still a pain to line up.

Can't wait to put this idea to rest after two years of off and on working between semesters.


I have not looked at this thread in a long while and maybe I missed it in the text but what software are you using for this and is it available.




"Science is the belief in the ignorance of the experts" Richard Feynman
View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 19-5-2015 at 16:03


@aga - I'm not tweaking the intensity signal of the photodiode in the soft-ware, I'm tweaking the motor rotation. The issue now is "clipping" of the signal (sine wave hits minimum for a long period of time) and it looks like the sine function extincts more slowly then it should. I'm thinking thats circuit only work unfortunately, but if I buy maybe 3-4 capacitors in the right range I should get better results. I might add some smoothing functions later to the data but I'm keeping it as 'raw' as possible. Then again the signal to noise ratio seems really small so it's probably unnecessary.

DSCF0032.JPG - 237kB

Here *pops the hood*. Do you see how the detector is suspended on the aluminum frame(on the right) and how on the left there's the light source. Now I've finaggled around a bit and I have a system worked out with planks of wood on screws so I can adjust the position of those things. I really want a way to align the lightsource and the detector with something more permanent rather then wood. Any ideas would be appreciated.

@Irc - The soft-ware I'm using is soft-ware I've been writing as the project has progressed. It's all JAVA, nothing too indepth and I'm sure a professional soft-ware engineer wouldn't like my approaches/structuring but it works and isn't heinously sloppy. If you need help doing things like this or want some source code to build off of, simply ask, I share code for free and no royalties or whatever.

I'm not exactly willing to pass out my code for the polarimeter yet though until I reach a stable version (IE when I'll post a complete write-up). Otherwise I might lead someone into a dark corner. In the mean time though I can give out snippets or how I approached problems :).

[Edited on 20-5-2015 by smaerd]

[Edited on 20-5-2015 by smaerd]




View user's profile View All Posts By User
IrC
International Hazard
*****




Posts: 2710
Registered: 7-3-2005
Location: Eureka
Member Is Offline

Mood: Discovering

[*] posted on 19-5-2015 at 17:04


Yes I would like to have to source and I can wait until you have done your write up. Looking forward to it I like this project. I think threads about building test and measuring instruments is my favorite part of SCM.




"Science is the belief in the ignorance of the experts" Richard Feynman
View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 20-5-2015 at 12:27


Hmmm, so I had my go with sucrose again after I totally revamped my positioning algorithm. I found out the hard way, my data is not-sinuisoidal enough to do a formal second derivative analysis :/. Kind of a bummer, so I came up with another way to handle my motor. I won't bore you with the details unless you wanna know.

Anyways the positioning algorithm appears to be working wonderfully. Picture on the left is the unoriented analyzer/motor (notice the little tail of the sine function going upwards on the right hand side?). Picture on the right is the oriented polarizer with sucrose solution (notice no tail).

blanking.png - 16kB 20 perc suc again.png - 15kB


Unfortunately... It looks like my sucrose solution is not polarizing light whatsoever. My peaks are locked in at 90* & 270*(raw data file attached). It probably is polarizing light, just minorly, which I could write a routine to detect these shifts but I want to see something more promising before I write another routine... So I am going to really up the concentration and see if I can get something drastic. 20% was nothing, let's try 60.

I'm really hoping I don't need a specialized substrate for this wavelength.

[Edited on 20-5-2015 by smaerd]

Attachment: 2015-05-20_160802.csv (306kB)
This file has been downloaded 702 times

[Edited on 20-5-2015 by smaerd]




View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 20-5-2015 at 13:20


Well, I ran my experiment once more with 60% sucrose solution freshly made.

Definitely seeing polarization!

Unfortunately my motor positioning rather then having the peak be at 90* it's at 90.38 ish. So not perfect, but its getting pretty close.

Anywho, I got a value of about 109.63* for my observed peak with 60% sucrose at 650nm(I think...) 1dm pathlength and ~25*C. The value I obtained for the specific rotation is 32.08*. Which seems pretty low, but I have no idea. The point is the thing seems to be working! Edit- keep in mind those values were hand picked, not computational results, feel free to do your own analysis. Most importantly this tells me that positive rotations end up as positive phase shifts (I got lucky in choosing a motor direction).

I'm not 100% sure how to improve my results yet, or how much error is attributed to them. Insight would be wonderful. I think I can put the project down for a little bit though to give it some good thought.

Attachment: blank.csv (307kB)
This file has been downloaded 692 times

Attachment: 60 sucrose.csv (305kB)
This file has been downloaded 700 times

[Edited on 20-5-2015 by smaerd]

[Edited on 20-5-2015 by smaerd]




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 20-5-2015 at 13:41


Brilliant stuff smaerd.

I'm still unclear about a few things so must ask (please verify/correct if wrong).

1. In the photo, the detector is the tube to the Right with the aluminium cage around it.

2. The sample is in the large aluminium hub to the left of the larger gear wheel.

3. The light source is the grey blob top left.

4. the first polarising filter is on the rotating stuff, and immediately After the light source, and Before the sample.

5. there is a second polarising filter fixed to the light inlet to the detector.




View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 20-5-2015 at 13:50


Here I'll outline whats going on. I think you're correct with what you said I just want to be clear as possible because there's a good chance any passerby would be uncertain as well. Especially after the fuss that happened in my DIY rotovap prepublication thread because I didn't take enough pictures lol.

layout.png - 725kB

[Edited on 20-5-2015 by smaerd]

[Edited on 20-5-2015 by smaerd]




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 20-5-2015 at 14:10


Cool. Thanks - that explains it very well.

OK.

First off, wood isn't good as a mechanical reference, so use some steel bar or aluminium plate or some other metal to bolt it all to - that will give you at least 1 axis of stability, and make alignment easier.

If you can drill/tap holes, then bolts with springs is a convenient way to make alignment easier.

Solder up the analogue section on veroboard or something. Breadboards + op-amps is just asking for random noise, feedback etc.
Also stick a 100uf capacitor + a 10nf one right next to the op-amps' supply pins.

Cut/bend a tin can to make a grounded shield around the circuit to eliminate 'other' noise sources. Use screened wire between the detector and the circuit and make the leads as short as possible.

Trim your op-amp gain to be about 80~90% of the max your arduino can handle (3v3 or 5v ?). You loose a bit of Range yet gain some repeatability, and lose the clipping.

In the software, step, wait, measure. measure. measure. measure to derive an average for each step. 8, 16, 32 are good as a sample size for each step as you can do a right shift (fast operation) to do the divide.

e.g. for averaging 16 samples:-

int i, avg;

for(avg=0, i=0;i<16;i++) avg += sample_sensor();
avg = avg >> 4;

If you do not wait, then the sample just after stepping the motor will have jitter due to the mechanical settling time required.

Normally i would use a bubble sort routine to find the median value rather than the average.

This helps to reject random noise (e.g. 1023 and 0 as readings).




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 20-5-2015 at 14:27


bubble sort routine that should work on arduino.

I tried posting the code but bits were interpreted as tags.

Attachment: bubblesort.txt (381B)
This file has been downloaded 685 times





View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 20-5-2015 at 15:31


Yea I considered using an aluminum sheet or similar for aligning the optics but the stuff is expensive and I don't really have good tools for working with metal. Hack saw and a drill press is about all I have and it's really hard for me to get everything where it should be. I wish I had a CNC, it'd be so easy. Or a 3-D printer.

Arduino analog signal is 5V max (maybe 5.15V). I was at about 90% I'm thinking about dropping down to 75% for my gain next test. Yea I'm gonna switch over to perfboard as soon as I am happy with the signal. The op-amps are about 5 USD a piece, I can't afford to fry anymore. I can't tell if the clipping is excess capacitance, too much gain on one stage, or a physical alignment concern.

Yea my routine for measuring doesn't involve waiting. Which I know sounds dangerous but there's just no way for me to PWM a motor and get everything done I want done. I'd need a dual H-bridge type motor driver circuit and lots of hideous code, and there's more room for things to go wrong imo. I'm spinning the motor and reading at the same time and chucking it down the serial. It's a DC motor not a stepper. Think I'm looking at 13,000 or some odd measurements for a full rotation. So it'd take a long time to do a routine which involved waiting.

Thanks for the algorithm I remember doing an excercise like that years ago. I haven't dealt with much stray noise. I am getting a bit of a wonky signal when I really zoom in, but really I think it's ADC noise, it's pretty indeterminant but it hardly effects the quality of output.

I guess I'll show you the algorithm for how I am finding the minima without the elegant trig I was doing before (back before I had signal clipping). Was pretty fun to write lol. It takes advantage of the fact that the peaks (top of the signals) are pretty prestine and consistent (attached). If I can get more sinuisoidal data like before I'll show you the really nice code I wrote for it.

Thanks for the advice!

[Edited on 20-5-2015 by smaerd]

Attachment: MinimaSeekingAlgo.txt (3kB)
This file has been downloaded 637 times

[Edited on 20-5-2015 by smaerd]

[Edited on 20-5-2015 by smaerd]




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 21-5-2015 at 00:40


I've got a spare steppers & driver boards i can send if they'd be of help.

@1.6 degrees per step that'd give you 225 sample points with half-stepping over 180 degrees of arc, although you could always gear it down to increase the resolution.

Are you indexing the position of the motor off a hall switch or similar ?




View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 21-5-2015 at 10:16


Thanks for the offer, I don't think I need to change out my motor. I'm getting pretty good positional accuracy here.

So I just tweaked my op-amp circuit. I reduced the gain on the first stage pretty significantly, and found two more balanced resistors (5% sure isn't 5%, someone at QC goofed up on the 220 K ohms I was using). Then I increased the gain of the second stage to compensate. I'm at about 4/10ths of the arduino max signal potential. Thats running on two highly used triple A batterys for the light source. Not bad. Signal looks good, that's really all I care about.

Here's a picture of my current noise situation(zoomed way in). It's acceptable to me, considering the signal is about 100x larger in magnitude.
Untitled.png - 35kB

I toyed with changing the capicatances on the op amp stages, reducing them to 100's of pico farad was a bad call. Lots of oscillations essentially pure noise. I tried 1/10th what the capictance is now, didn't really change the clipping at all. or the band shape.

Anyways the noise looks a little prettier to me than how it was before so I'm gonna keep it this way. If I had an oscilliscope I'd be able to tune this thing more, but this serves it's purpose and seems to work well.I'm leaning more towards the physical allignment being the culprit for the funky band shapes.

I also found a source for a small error in my positioning algorithm. I'm not sure how to overcome it just yet, I think I'll have to hit the drawing board.

[Edited on 21-5-2015 by smaerd]




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 21-5-2015 at 12:16


i simply have to have a go at this myself.



View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 21-5-2015 at 14:50


Give it a shot aga it's really not a major project. The only reason why it's taken me so long is stupid mistakes like using a 100w soldering iron and melting IC's lol and lots of school and other busy life things.

I just fine tuned my firm-ware a bit and I seem to be getting acceptable results. I tightened up my alignment as best as I could so now I'm really not sure why I'm getting those funky band shapes.

I'm trying to think of some good cheap test substrates or an experiment I can perform to test this thing out. All that's really left to do is wrap up my soft-ware and firmware then maybe try an LED again with the new amplification stage. I think I abandoned the LED too soon, but I was frustrated at that point.The nice thing about an LED is that I could compare my results to literature values.

Edit - So I just tried holding one of those super bright LED's I bought a while back about 10cm from my detector. Looks like I can pull a hundred counts out of it without changing my amplification stage, not bad. I am going to try and switch back to an LED design.

LED.png - 15kB

[Edited on 21-5-2015 by smaerd]




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 21-5-2015 at 15:04


Never give up.

Adapt, and change.

Laser, LED, whatever - they tend to stay constant in their behaviour.

Adjust your approach instead, and conquor it you will.




View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 21-5-2015 at 19:54


I was able to get a signal and everything which was great, I realize I could improve the optics of the LED and change my gain and yadda yadda yadda. Then I remembered why I was so happy with the laser diode, its so easy, its point and shoot (thanks bfesser for that suggestion it changed my entire project).

orangeLED.png - 14kB

I found a web page which stated that the greater the wavelength of light the less polarized it became by a sample. Which physically makes a good deal of sense. I believe they said at 436nm the polarization can be 2x as much as that of 589nm(http://rudolphresearch.com/products/polarimeters/polarimetry...). I'm not sure if my diode is 650nm or 680nm but regardless it explains the low specific rotation values I was seeing.

So I did some scoping around and 532nm laser diodes are very cheap, will give me a greater polarizing effect then 589nm which may be beneficial (less sample for analysis), and best of all they are in a range which my detector is very sensitive! So I may not get as much clipping or any at the lower light levels. The nice part of this design is I can interchange light sources, so if someone ever produces a 5mW 590nm laser or something I'll snatch one up. In the mean time...

No literature comparisons, but using less sample, and ease of use is good enough reason for me. Besides do I really care about the specific rotation of something, no, I want to use this thing for analysis :).

The other funny thing about this is, I can actually use this sucker as a colorimeter from about 400nm to 700nm. So yea it's not a UV-VIS or totally practical but heck I have often wanted a colorimeter anyways. I'm definitely going to modify the sample comparment area in a modular way to incorporate that functionality.
[Edited on 22-5-2015 by smaerd]

[Edited on 22-5-2015 by smaerd]




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 22-5-2015 at 11:56


is it ready yet ?

I've been waiting *hours* !




View user's profile View All Posts By User
aga
Forum Drunkard
*****




Posts: 7030
Registered: 25-3-2014
Member Is Offline


[*] posted on 22-5-2015 at 12:48


No news yet ? It's been minutes !



View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 22-5-2015 at 15:12


Haha Aga, sorry to disappoint. I'm waiting for a green laser diode to be shipped rather than fiddling with the LED's. I like the laser diode so much more. LED's just weren't meant for doing 10-15cm path lengths without focussing elements. I'd rather keep my poorly aligned optics as limitted in number as possible.

The project is pretty close to done though. I believe my first sample was accurate, but when I get my green laser I'm going to put this thing to the test and see if I can do a couple experiments to demonstrate it's efficacy. I'll test 5 concentrations of sucrose. Then if that looks good I'll maybe do a mutorotation of glucose experiment (if I can make the buffer for it I forget what weak acids and bases I have). Then anything from there on I'll be doing for other projects not just demonstrating "it works". In the case that it doesn't work there'll probably be more rapid fire posts in this thread lol. I really need to finish up my latest project though so I can surprise ya'll with it.

I was thinking about doing my encoder routine in quadrature just for shits and giggles. I'm just not sure if I really need 26,000 data points it would bring me from 0.02* positional resolution down to 0.01* though which sounds kinda saucey.

Either way I am already at 1/10th the encoder resolution of this instrument - http://www.vernier.com/products/sensors/chem-pol/ and mine is automatic with changeable light-sources and less than half the cost.

[Edited on 22-5-2015 by smaerd]




View user's profile View All Posts By User
smaerd
International Hazard
*****




Posts: 1262
Registered: 23-1-2010
Member Is Offline

Mood: hmm...

[*] posted on 24-5-2015 at 06:16


So I built a farraday cage around my house and implemented ferrite chokes on all my lines, balanced my circuit with handfulls of gimmick capicitors, made a new ADC for the arduino. Okay those are all lies to make aga giggle.

But I did get rid of all of ADC noise. I borrowed an FFT library (JTransforms) and wrote a quicky high-pass filter into my software. Now I can finally fine tune the positioning algorithm. The second derivative tests should be reliable now. The best part of this type of filter is simply that none of my band shapes are shifted, and the amplitudes remains nearly the same. All it does is rips high frequencies out of the spectra.You'll notice that the units on the Y-axis after the inverse transform are scaled on the order of 100,000. Who cares? Absorbance units are arbitrary anyways.

Check these signals out,

FFT closeup.png - 14kB FFT.png - 16kB

[Edited on 24-5-2015 by smaerd]

By doing this I was able to get my motor positioning resolution down to a factor of 10 with an unoptimized algorithm. If I can tune this one more time I can see atleast a factor of 5-10 more resolution then my soft-ware will be complete aside from frilly things.

[Edited on 24-5-2015 by smaerd]




View user's profile View All Posts By User
m1tanker78
National Hazard
****




Posts: 685
Registered: 5-1-2011
Member Is Offline

Mood: No Mood

[*] posted on 24-5-2015 at 09:13


I just started reading this thread but couldn't resist jumping ahead to the last page. :D

Man, I can hear the gears of improvement (not the motor drive gear) turning all the way across the internet ocean. Seeing your graphs, it looks like you achieved smooth, constant rotation of the rotating polarizer. That's what I call a sine wave!

BTW, did you mean to say you implemented a low-pass filter or did I miss something?




Chemical CURIOSITY KILLED THE CATalyst.
View user's profile View All Posts By User
 Pages:  1  ..  4    6    8  9

  Go To Top