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

Printable Version  
 Pages:  1  ..  5    7    9
Author: Subject: Building a polarimeter
smaerd
International Hazard
*****




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

Mood: hmm...

[*] posted on 24-5-2015 at 11:02


Oh gosh you're absolutely right m1tanker, yes I meant a low-pass filter not a high-pass filter. I used a "brick-wall" algorithm which basically goes FFT-> Remove frequencies outside of threshold(turn them to 0) ->inverse FFT . So the filter wasn't electronic it was soft-ware, because I speculated that the noise I was seeing was ADC noise. I deduced this by chucking the arduino ADC clock to 1MHz and noticing some distinct changes in the spectra/noise appearance. The brick wall is not as good as masking, but my data is essentially one sinuisoid and the rest being highfrequency noise so the brick wall is juuuust fine.

Before the FFT I was seeing 1-7* error in positioning the polarizer. Not good.

Now I'm just tuning the "peak finding" algorithm. After the FFT I was getting lots of 0.081* errors (off by ~3 motor encoder counts), then I saw some more 0.50* errors for the positioning (made a few too many assumptions in my routine). So I gotta come up with something more reliable but so far I can safely say I am at 1* accuracy at least. My goal was a consistent error of ~0.05* (1-2 counts off from predicting the peak). If I can hit that then maybe I'll try running in quadrature and getting a slightly larger gear and then I could hit 0.01*.

Also once I swap out the laser I should no longer be seeing the clipping at the bottom of the sine waves (fingers crossed).

Thanks for dropping by :).




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




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


[*] posted on 24-5-2015 at 11:55


You've gone and done it now smaerd.

You made me build a polarimeter.



diagram.jpg - 197kBlaser.JPG - 163kBfront.JPG - 198kBmirror.JPG - 176kB




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 12:20


Thats' amazing you did that so quickly!

What kind of detector are you using?

How are your results looking?

I think I'm stuck for the day :/. Having a hard time doing all this data handling. I'm beginning to suspect that my slightly irregular sine wave is becoming my undoing. Or I've made a blunder somewere. My second derivative analysis is less accurate then my height seeking algorithm. Which to me makes little sense.

[Edited on 24-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 24-5-2015 at 12:31


Decided to try building one this afternoon.

Having a stock of metals, other stuff and many tools in the shed helps enormously when experimenting with stuff - takes a lot less time.

No results yet, just some random numbers.

Got a basic CdS cell as the detector (came with the arduino kit) and only have half a polarised disc. Very short on polarised film here at the mo.

Many bungles and bodges to get this far - the slot in the cross bar at the top is there simply because i measured it wrong and there wasn't enough room for the rotating polarising disc.

Get yourself some of that sticky-backed foam strip that is used for sealing doors/windows against draughts, as i'm especially pleased with the way the test tube goes in and out with the greatest of ease.




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 12:38


It looks like a really great start aga. If you want my amplifcation stage circuit diagram or anything else let me know :).

Yea 90% of my battle has been just setting up the physical components, so the rest should be smooth sailing for you. I really like how you used a mirror to get things into place I didn't think about that, but its a lot easier to adjust a mirror then move a mount on wood.




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




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


[*] posted on 24-5-2015 at 12:51


The mechanical components may not be perfectly linear, so you should remember that when looking at irregularities in your data.

It may well be that your motor goes faster at some point in it's rotation and slower at another, which would also cause a non-sine trace.

Keep on battling !

You're almost there !

Attachment: My Movie-1.m4v (556kB)
This file has been downloaded 685 times




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




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


[*] posted on 24-5-2015 at 12:56


LOL.

If you loop that video and imagine it's dispensing just 10mls of beer, the timing is spot on !

[Edited on 24-5-2015 by aga]




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 13:34


Aga whether the motor is going faster or not should not effect the encoder timed photodiode measurement. Technically I could remove power to the motor and spin the encoder by hand and still arrive at the same measurements as long as I went in only one direction. It's also specific to the left hand side of the rising wave, whereas before I did an alignment it was on the right hand side. That's why I keep thinking it's the alignment. Like say one of my polarizers is off at by 5* then the transmittance through the polarizer is uneven, which leads to slightly more or slightly less absorbance based on the period of the polarizers rotation. I could likely fourrier transform the function to make it more symmetric but I'd really rather not mess with that, that's when data processing becomes data manipulation. Edit - I could probably derive an equation to fix it, but I'd rather not do that either.

I think I have an idea to fix this thing. I know the length the period of oscillation is supposed to be. So I can fix that as a value. Then find the two optimum locations (one on each band) either by 2nd derivative or peak height. Then bring the two optimum locations closer together based on which location change leads to the smallest change(in either peak height or second derivative) until they match what the period should be.

lol that is a nice video. I like the clicky sample holder. Mine isn't even fixed to anything yet. I just slide it infront of the beam when I want to measure a sample.

[Edited on 24-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 24-5-2015 at 13:46


Sounds like you're into all sorts of complicated maths to solve a Timing problem, and using readings derived form a rotating polarised filter.

Only 180* of the data will be relevant (?) so why not just stick a bit of tape on the rotating disc and use total blackout as your index to see where the motor is at ?




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 14:59


Quote: Originally posted by smaerd  

Also once I swap out the laser I should no longer be seeing the clipping at the bottom of the sine waves (fingers crossed).


Sorry smeard, I thought the graph offset was off and my brain sort of auto-completed the sine wave. I don't want to be the guy that asks a thousand questions that have already been answered or covered upthread so I'll refrain until I get through it. ;)

The important thing is that aside from tweaking, you have the hardware and logic throwing raw data at your computer. From there, it's [almost] all math!

OK, one quick question.. how do you account for the source polarization when you switch to a laser source?




Chemical CURIOSITY KILLED THE CATalyst.
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 15:52


@Aga it's not exactly a timing problem. its an orientation problem. One you might face as well. Even if you do know where a piece of black tape is, if your waveform is nonuniform like mine is, how do you tell the peak of the measurement waveform to get the phase shift? In my case it's a bit more of a concern because I have my lower voltage inputs being clipped (black tape or clipped signal). Black tape won't solve this for me. I'm using two peaks as metaphorical black tape.

@m1tanker78, that's something I didn't consider :/. I know some lasers are polarized some aren't, some are randomly polarized etc. Now that you are bringing this to my attention which was a big over-sight on my part, I'm a little worried. Worst comes to worst I will switch to a different light source I guess. I'll have to sit down and think about how that might be effecting my results.


I think I've honed in on the source of error though. I think I'm missing some encoder counts while the motor is drifting. With the way I have the mathematics set up now, there are few other explanaitions (I hope).




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 16:23


Most if not all diode lasers emit highly polarized light (maybe green is an exception, IDK). Assuming I'm not misunderstanding the operating principle of a polarimeter, one possible solution for you would be to swap the source and detector placement. You'd avoid having to massacre the drive mechanism and could keep the stationary polarizer in place without issue. In fact, you could use either the laser rotational position and/or stationary polarizer rotational position to dial back the intensity if the source overloads the detector/amplifier.

If you want to switch back to a non-polarized light source, you just swap them back to the way you have it now.




Chemical CURIOSITY KILLED THE CATalyst.
View user's profile View All Posts By User
aga
Forum Drunkard
*****




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


[*] posted on 25-5-2015 at 02:42


It was a surprise to see so little variation on the detector !

I had assumed that the laser would saturate the detector, so chose a pretty insensitive one.

Out of a range of 1024 points, i get a variation of just 10 !
Time to try a new detector & op-amps i guess.

Also need to replace a screw, as one 'dip' is the screw blocking the laser ...

Upping the amplification in software gives these results :-


firsttrace1.JPG - 181kBfirsttrace2.JPG - 161kB




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 25-5-2015 at 08:23


Nice work there Aga! I can see a sinuisoid emerging from there. I think some of your weird band shape might have to do with the way the polarizing element is rotated.

Yea also most solar cells don't have a linear response for illumination vs voltage right? So you'll probably need either a massive resistor or a TIA amplification stage like I did.


---
Also, on my front, I made some huge progress. I'm getting my reproducibility for motor positioning to be between 0.027-0.081*. So I have successfully nailed it down to ~+/-0.1*. How did I do it?

Well I examined the frequency domain near 0 Hz. I noticed I had a big peak at nearly 0 (slightly off), a smaller one (good makes a wave form), then I had a little funky ripple which was actually assymetric with the negative portion of the domain(not shown due to the half FFT transform I'm using here, but in the full FFT it's there).
Yucky.png - 32kB

So what did I do? Trimmed off the assymetric wave (the portion highlighted in blue) form via my low pass filter. What's the result? I'm now commonly off by 1 encoder pulse (which I can account for) sometimes slightly more or slightly less. Now I haven't done a sinuisoidal regression, but I doubt wave forms get much better then that with a 10bit ADC. So why the huge increase in reproducibility and precision/accuracy, well, my algorithms can finally work on the nice data, the sole problem was the nonideality data (I had to rule out everything else).

No more clipping! I believe this band is lower in frequency as it represents either laser polarization error, or imperfect alignment(maybe both).

wonderful.png - 52kB

It sort of begs the question, is it okay to do this type of data modification. I thought about it all morning because last night I stated it would be data manipulation. Here's the thing, I'm not changing the frequencies of interest in the slightest bit (well in the 11th or 12th digit yes but that is beyond the resolution of the instrument). I am simply removing a constant interferance wave-form and noise from the frequency of interest. It turns out, go figure, that my data is a clean sinuisoid after that, no surprise.

It feels good to successfully surpass a 500$ instrument :). Now it's just a matter of fine tuning a few more things.

[Edited on 25-5-2015 by smaerd]

Attachment: So Clean -20150525_121733.csv (362kB)
This file has been downloaded 788 times

[Edited on 25-5-2015 by smaerd]




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




Posts: 561
Registered: 23-11-2014
Member Is Offline

Mood: No Mood

[*] posted on 25-5-2015 at 08:41


Quote: Originally posted by smaerd  




It sort of begs the question, is it okay to do this type of data modification. I thought about it all morning because last night I stated it would be data manipulation. Here's the thing, I'm not changing the frequencies of interest in the slightest bit (well in the 11th or 12th digit yes but that is beyond the resolution of the instrument). I am simply removing a constant interferance wave-form and noise from the frequency of interest. It turns out, go figure, that my data is a clean sinuisoid after that, no surprise.

It feels good to successfully surpass a 500$ instrument :). Now it's just a matter of fine tuning a few more things.

[Edited on 25-5-2015 by smaerd]


With a bit of understanding, which it seems you have, it is very okay.
A long time ago I hated it, thought just show me the raw data, but I mellowed
and filtering out the crap is a good thing.
I realized after years that I did not hate it, but I trusted my data transforms more that my coworkers.

You have done well.
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 25-5-2015 at 09:18


Thanks morganbw. I still get irked by smoothing data and things like that. But it's not a savitsky golay, or a rolling average or anything. I actually did a poster session where I felt inclined to say that some FT-IR data was not conclusive because I had to smooth it using a SG. When really, it was likely fine.

The design could use some improvements to make run's shorter(PID control via H-Bridge) in duration or this or that, but I'm pleased. Once I fine tune this a bit, and make a second light source, I think I'll do some quicky demonstrations then conclude this project. I decided I don't need to tune it for 0.01*. I'll leave that for someone else to do who can find a slightly bigger gear and feels like setting up the runs in encoder quadrature. It already functions for about everything that I will ever need it for. Most importantly it's inspired someone else to start making one, and hopefully a few more people once I lay everything out.




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




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


[*] posted on 25-5-2015 at 10:13


Wonderful !

Sine doesn't get much smoother that that one.

Great job smaerd.

Edit :

Mine won't get anywhere near sine while it has just a bit less than half of the polarising film required !

[Edited on 25-5-2015 by aga]




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 25-5-2015 at 18:03


Hmm the 20% sucrose solution I made last week ran up about ~0.0* so I made a fresh 5% solution and ~0.0*.

I'm really not sure what's going on. I was pretty sure that I was seeing polarization before, but it was before I had my motor drive routine down. Guess we'll see what happens with the 532nm light source :/.

Unfortunately the one laser pointer polarimeter states that the specific rotation at 635nm is 56.3*. So, I should be seeing an observed rotation of about 11.3* at 20g/mL sucrose solution (maybe slightly less). :/ I'm wondering if my FFT filter is somehow eating this result?

m1tanker - I thought about it though, I don't think that the light source being polarized would ruin anything. All it would do is lose some intensity. The polarimeter would be measuring the polarization from that polarizer. The initial intensity of the light source isn't a concern. Unless I am underthinking something. If I am please let me know.
Actually the few laser pointer based polarimeters I've seen in literature all feature a polarizer right after the light source.

Now I am really stumped though.

[Edited on 26-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 25-5-2015 at 23:59


I've tried putting a bit of polarising film in front of the green laser pointers i have.

Rotating the beam or film makes no change to the laser intensity, so they (at least these) cannot be polarised.




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 26-5-2015 at 12:24


So I changed the batteries going to my laser and it changed my FFT filter conditions (greater amplitude signal due to more power). I think I'm gonna need to get this puppy on a stable power supply.

Fortunately and unfortunately this forced me to revisit my peak finding algorithm. I changed some things and made the code more understandable but also realized. This algorithm is inconsistant again since the filter settings changed. The distance between two "peak" locations can vary as much as 1*. So there are two major problems for the project.

1) Consistent peak detection of real world data. This comes first because it tells me
2) Why isn't my polarimeter detecting changes in observed rotation? Or is it detecting them but problem #1 is hiding them.

I tried finding the phase shift of the signals directly from the fourier data, but it appears this FFT has decomposed the sinuisoid into two more more harmonics. So that seems like a dead-end.




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




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


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


I'm still a little confused as to how you detect the position of the free-running rotating motor that drives your rotating polariser.

If you're detecting Peaks, well, those will change if the polarisation gets shifted by the sample nuh ?

Edit:

Just remembered : for FFT you need a sample rate of 2x (the Nyqist number) of the frequency of the waveform you wish to sample.

That may be a factor in your FFT decomposing the waveform.

[Edited on 26-5-2015 by aga]




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 26-5-2015 at 14:40


Aga I have two routines.

Orientation - This runs the motor 360* and reads all the values. My soft-ware finds the two peaks in the data, gets the period of the rotation then transmits to the microcontroller where the next projected minimum light value should be. Then I tell my MC to measure.

Measure - The mc rotates freely until it reaches the projected light minimum. The photodiode readings then begin until 180* of rotation has occurred(was previously 360 and before that was 180). Then the soft-ware says "Hey I found the experimental maximum at some encoder count. The projected light maximum from the orientation routine was at some value." Then it calculates the phase shift.


Damn the nyquist number. I read a little about that. I'll have to see if it's even possible for me to do a phase angle determination then. I'm not really sure I understand the concept just yet. Maybe by tomarrow, unless you can help explain it a little bit or direct me somewere.

edit - so say I take 6000 measurements for one period of the wave form. Thats like 3000x times satisfying the nyquist criteria right? Or does it have to be 2x times the crazy noise that was in the sample prior to filtering?

[Edited on 26-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 26-5-2015 at 15:26


smeard, in contrast to what aga observed with a green laser pointer, all the red laser pointers and diodes I've experimented with have emitted highly plane-polarized light. I could take a polarizing film and almost completely block the laser beam at 90 and 270* rotation. Virtually all passes at 0 and 180. If you intend to use a non-polarized laser then it's moot. Otherwise, I believe you'd have to rethink your current design. If you only have 1 stationary and 1 rotating polarizing film, I think you could get away with swapping source and sensor like I mentioned before.

LASER -> [OPTIONAL STATIONARY POL FILM] -> SAMPLE -> ROTATING POL -> SENSOR

If the laser light 'saturates' your sensor -- that is, takes it outside the linear region, you can tweak the stationary pol and/or laser and take another background scan.

I haven't tried this, I'm just thinking out loud here.

[edit]

The higher your oversampling rate, the better data integrity you'll have. You can filter out a huge chunk of high freq quantization noise or 'crazy' noise you observed before with a simple low-pass.

[Edited on 5-26-2015 by m1tanker78]




Chemical CURIOSITY KILLED THE CATalyst.
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 26-5-2015 at 16:15


Thanks for the advice m1tanker. Maybe that's why I'm not seeing any polarization? I'm going to test out the 532nm laser pointer and see if it's polarized. if it is I'll swap my source and detector around. I'm giving this project a break for a day or two so I can work on a couple other projects. Kinda burnt myself out reading academic articles on peak finding algorithms when the truth is, I just need a stable power supply going to my light source and all will be good again.



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 31-5-2015 at 14:22


So I did some work on this today. First things first. Thank you M1Tanker. You were right the red laser pointer does have a significant source polarization. I removed a polarizing film from the optical path and swapped my detector for the source as suggested. Now I have clean sinuisoids without filtering.

So I added a constant voltage power supply for the laser pointer, so glad I did, now my FFT filter has a constant setting!

no FFT minus a polarizer.png - 15kB

Anyways, now I took some results as the instrument stood without fine tuning the soft-ware for the new alignment. It's pretty buggy still, but now I have eliminated two or three huge issues. So again thank your M1Tanker. I can see polarization!

INIT w fft.png - 13kB

Here are the results:
Without a sample here are the observed rotations: 0.52*, -0.60*,0.22*,-0.27*(Average: 0.033, STDEV = 0.5)
With a 20% sucrose solution: : +7.83*, +9.67*, +9.36*, +8.08*, (Average: 8.74, STDEV = 0.9)

The mean value gives me a specific rotation of 43.7 (+/-4.5)*, which is reasonable.

The instrument is obviously not consistent but now that I have a consistent sinuisoid I can do curve fitting rather then my calculus based approaches to finding peak locations.

As suspected the variance of the orientation is 2X that of measurements, because the routine is run twice to take a measurement. So it is my algorithm that is off.

[Edited on 31-5-2015 by smaerd]

Edit - also I got the green laser pointer but when I shorted the switch on the circuit and subjected it to the 3.3V source. I'd subjectively say it's 100-200 times brighter then the red laser, but knowing the human eye is ~5-10x more sensitive to green then red, this is probably a 50mW laser. It too is polarized. It is bright enough that I would be concerned for my eyes if it were to be shined there. I'm afraid to even try it on my amplification circuit, it would likely saturate it and I'd need to use a 50kOhm trimmer pot on the second stage, too finicky for my blood knowing how the ideal FFT filter is.

[Edited on 31-5-2015 by smaerd]




View user's profile View All Posts By User
 Pages:  1  ..  5    7    9

  Go To Top