Arduino spectrometer

(I 'm not experienced arduino user, just exploring and learning how everything works)

Hi,
I have been working on my arduino spectrometer project for quite long time. But I have some problems and I want to know your suggestions how to deal with them. I have been following this scheme:
.

And when I do measurements on diode using arduino I get minimum value of 757+/- and maximum value of 882+/-

Whole setup looks like this:

The problem is that I should get 0 value when there's no light hitting diode but as I said it never goes lover than 750. The ideal situation would be to have maximum value around 800/900 and 0 for minimum value. As you may saw in my scheme I'm using 1Mohm resistors which is really crazy but this is only value in which whole setup works. I tried used 470k and 300k but it failed because measurements were teribbly inaccurate. Please can you tell me, what I'm doing wrong and give me some ideas how to improve it.

Thank you.

Pin4 (opamp negative supply) should be connected directly to ground.

Please post a diagram of the circuit with diode orientation, not a connection diagram.
I suppose it's the circuit from page13 of the LTC1050 datasheet.
Leo..

I tried to connect Pin4 directly to ground but it ended up with really bad measurements (really bad) ranging from 0 to 120. Actually I was following this scheme:

Pin7 and pin4 are supply pins, so must be connected to 5volt and ground. No doubt about that.

0-120 might be good. It could be that opamp gain is not high enough.
Gain is set by the feedback resistor value.
10k in your Fritzing, and 1Megohm (100x) in your hand-drawn diagram.
So what is it.
And what is the (wrong polarity) type of diode in your Fritzing.
Leo..

it ended up with really bad measurements

10K is way too small for the feedback resistor, and you may have had the diode polarity wrong.

Here is one approach recommended by Linear Technology:

Anode (+) goes to pin3, and catode to pin2 of the opamp.
Pin3/anode can be grounded, or connected to ground with the same resistor as the feedback resistor.
Feedback resistor sets sensitivity.
Leo..

jremington: Thank you for your ideas. I placed capacitor paralel to resistor and it seems, it improves results, thx for that. Diode polarity is not wrong, I tried to connect it in opposite way but this time it didn't measure anything. So I think there isn't problem.

Wawa: Thank you for ideas. I have setup with same value of resistor and feedback resistor. I tried really small values like 200 ohms to 20kohm. The problem is: The value in which measurement starts fall rapidly (perfect) and when diode wasn't exposed to light it measured with resolution +-2 which is also perfect. BUT! When diode was exposed to light it was really terrible. Values varied from 200 to 600 (205,321,208,501)etc... And that's really inaccurate. It seems like I have to choose if I want more accurate reading when exposed to light or accurate reading without exposing to light. But obviously I need as precision measurement as possible in both situations and I think it's possible.
BTW: I tried lower main resistor from 1M to 470k and feedback res. from 470k to 220k. The results were also terrible and it seems I really need 1M resistor.

A photo diode used that way acts like a solar cell.
It generates power, and the opamp tries to fight that (shorts the cell).

You could say the photo diode is the throttle, and the opamp (feedback resistor) is the brake.
You measure how much the opamp is "braking".

The value of the feedback resistor sets the size of the brake pads.
About 10k could be ok for sunlight, depending on the size of the photo diode.
1-10Megohm could be ok for moonlight.

Take care that you only measure natural light.
Mains powered (AC) lighting could change intensity 100 or 120 times per second.
That could upset your readings if you use the wrong code.
Leo..

Thank you for that info. So it’s bad thing to use that as an “sollar” cell?
Well in my situation light passes diffraction grating so only very tiny fraction of that light hits diode and diode is more less sensitive to different wavelengths.
I know that ac powered light changes it’s intensity. But I have no choice here. And I don’t see any 60hz noise maybe it will be worse when I change something. So what would you suggest that is best thing to do?

When diode was exposed to light it was really terrible. Values varied from 200 to 600 (205,321,208,501)etc... And that's really inaccurate. It seems like I have to choose if I want more accurate reading when exposed to light or accurate reading without exposing to light.

So it's bad thing to use that as an "sollar" cell?
Well in my situation light passes diffraction grating so only very tiny fraction of that light hits diode and diode is more less sensitive to different wavelengths.

The graph above shows a problem (there are many) with what you are attempting to do.
You are working to read 400nM to 700nM which is a reasonably flat part of the curve; however the diode is very sensitive to IR and therefore thermal effects. You need an IR optical cutoff filter for wavelengths 700nM and longer.

Additionally, the design of your circuit will likely cause the diode to produce voltages from RF sources, too. You will need to carefully shield the diode and OpAmp.

Ray

mrburnette: Thank you for ideas. I'm sorry but I really know what I'm doing I mean practically, please don't tell me things like from what range I'm working on, I know that I want to know just some ideas or solutions for best results. The graph above shows a problem (there are many) with what you are attempting to do. .. ok so what are those "other many" problems? I'm using this diode: Siemens BPW21 datasheet pdf
I think I will never pass 700 nm range. And I don't have money for IR filter... that would even more reduce light intensity which I don't want. Ok still I can shield it but it won't solve main problems. Thanks you :slight_smile:

I clipped in from the datasheet for the diode the spectral response. 20% - 35% of the voltage produced falls in the 700nM or greater sensitivity range so if you are not concerned about that, neither am I.

With the cell covered with black vinyl tape, the OpAmp output should be 0 V. In reality, thermal noise and rectified RF noise (like a crystal radio) will be present but you should be able to bypass some of the RF to ground. (Looking at your breadboard design the whole thing is an RF transmitter! Take a transistor radio on the AM band if you do not believe me.) The best design would still be for everything to be shielded and electrically bypassed.

You will have to deal with the thermal noise in software (or hardware by cooling the diode), but I’m sure you already know that. Unless you reduce or eliminate heat from around all reflective surfaces, IR will screw with your readings without a filter. You could use some velvet black paint on all surfaces that face the optical window.

And while I am surely not as smart as you are (by your own admission) I do have a weebit of experience in the photonics area.

Ray

Screenshot from 2016-12-02 11:53:25.jpg

Dragonsired1:
So it's bad thing to use that as an "sollar" cell?

I know that ac powered light changes it's intensity. But I have no choice here. And I don't see any 60hz noise maybe it will be worse when I change something. So what would you suggest that is best thing to do?

No, that's how it's done.
The circuit basically measures photo diode short circuit current, which is AFAIK more linear than measuring photo diode voltage.
Ray made some good points there about shielding. This circuit with ~500k resistor values is basically a very sensitive preamp, and needs to go inside a metal box with only a small window for the diode.

Never done this, but this is what I would try.
A/D sample time of a Mega is about 100us.
Write a sketch that puts enough samples into an array to cover one sinewave of the mains frequency.
That's ~200 if you are on 50Hz mains, and ~166 if you are on 60Hz mains.
Output to serial plotter.
See what variation (sinewave?) you're getting.
Leo..

Hi,
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Please include pin numbers.

Thanks.. Tom.. :slight_smile:

Ok Thanks all of you. I think I owe you couple photos:
https://scontent-vie1-1.xx.fbcdn.net/v/t35.0-12/15321461_1373754439310771_423846643_o.jpg?oh=d90779d08f99ec73ca43c345e6aabd3c&oe=58452402
https://scontent-vie1-1.xx.fbcdn.net/v/t35.0-12/15292835_1373754435977438_939052434_o.jpg?oh=ad460c46b68799ccbf927feadbc8c983&oe=5844BAEA
https://scontent-vie1-1.xx.fbcdn.net/v/t35.0-12/15302431_1373754475977434_1703221806_o.jpg?oh=546e4a31f29f61fd4e4e369c75f15217&oe=5844D0E5

The last one is schematic used right now:
https://scontent-vie1-1.xx.fbcdn.net/v/t35.0-12/15303889_1373754479310767_908555111_o.jpg?oh=174a93029710ee3c3734859cca081dc9&oe=5845189B

Sorry I'm bad in drawing circuits :smiley:

Dragonsired1:
Sorry I'm bad in drawing circuits :smiley:

Yes, it sucks.
If you are using the opamp the way you have drawn it, it certainly won't work.

As said before, pin7 and pin4 are the supply pins of the opamp, and with a single suppy they should be connected to 5volt and GROUND.
You have connected pin4 to pin3, so the opamp won't get any power.
There also must be decoupling across the supply pins of the opamp, close to the opamp. ~47uF could be ok.

You also have drawn (and maybe connected) the photodiode with the wrong polarity.

If you're using the LTC1050, then look at the photodiode amplifier on page13 of the LTC1050 datasheet.

The feedback cap on your diagram is very big. That slows the opamp. It won't amplify fast light changes.
The diagram in post#4 shown 100p. The LTC1050 diagram shows 15p. You draw 100n (100000p).
But I'm still not sure what light you're trying to measure.
Leo..

I'm sorry but I really know what I'm doing

No, you very obviously do not know "what you are doing" and you aren't listening to advice either.

As said before, pin7 and pin4 are the supply pins of the opamp, and with a single suppy they should be connected to 5volt and GROUND.

Ok I have connected it like that.

You have connected pin4 to pin3, so the opamp won't get any power.

Ok I disconnected link between pin 3 and 4.

There also must be decoupling across the supply pins of the opamp, close to the opamp. ~47uF could be ok.

Ok I will add decoupling capacitor.

You also have drawn (and maybe connected) the photodiode with the wrong polarity.

I switched polarity of which diode was connected.

If you're using the LTC1050, then look at the photodiode amplifier on page13 of the LTC1050 datasheet.

I did.

The diagram in post#4 shown 100p. The LTC1050 diagram shows 15p. You draw 100n (100000p).

Ok I'll try add 100p and then 15p and see results.

But I'm still not sure what light you're trying to measure.

AS I said. I have 10W LED which is my source of light. Then I have diffraction grating which splits light into spectrum. That spectrum is reflected by mirror. Light goes through cuvette, through lens, and finally to diode.

If that's completely wrong, then I'm really sorry I didn't knew that. I have been following this page: DIY Science: Measuring Light with a Photodiode II | Outside Science
And it worked. I didn't knew, there were so many mistakes.

No, you very obviously do not know "what you are doing" and you aren't listening to advice either.

Is I said, I meant I know how spectrometer should looks like. I'm chemists I'm not electronic engineer. Sorry but I disagree, I don't listen to advice. I changed things and wrote results here. For example adding capacitor to feedback resistor, was your idea and I did that.

Please be patient with me. I'm doing my best.
Thank you.

OH and also. Moving opamp from that shitty board is great Idea. I will do that. But I want to be able to change things so I hope it's not the worst idea to buy separate breadboard and mount it far from that cables.

It’s fine to use a breadboard for development, just be mindful that connectors can become fatigued when connected/disconnected too much. As far as cable length goes, a bit of extension, but your ‘pre-amplifier’ (or in your case, only amplifier) shouldn’t be too far away, because small noise picked up by the wires will become big noise in the amplified signal. In the last photometer I made, I put the diode about 5 cm from the amp.

Can you post your new schematic (put the jpeg file’s url between [url=your file's url]url.jpg[/url] or [img]url.jpg[/img] tags so we can just see it)?