0
\$\begingroup\$

I want to measure the rate of change of voltage with respect to time coming out of a phototransistor, and preferably amplify it at same time, as the change is not so significant. But lets just not making it complicated! I am totally a newbie! Is it possible doing it with Rail to rail op amps and arduino? Lm324 can do that? If somebody can provide me with a schematic, it will mean everything to me.

Thanx

\$\endgroup\$
  • \$\begingroup\$ Your question is missing several details. What is the input voltage range? What is the rate of change (volts/s or /ms)? Why can you not feed directly into your micro-controller? Hit the "edit" link under your question. \$\endgroup\$ – Transistor Oct 12 '18 at 16:18
  • \$\begingroup\$ The differentiator will also respond to any fast edge energy picked up by your sensor. Flourescent lights (80,000 Hz), motor commutations, those black-brick wall-warts. \$\endgroup\$ – analogsystemsrf Oct 12 '18 at 16:57
  • \$\begingroup\$ The input voltage range will be around 2.5 volts and few milivolts/ms deviation. Actually I feed it into micro controller but as the change is really too little I could not process it, the ADC can not see any differnce. In the output in my experience I have very small high picks like 10 milivolts but for really short time like 10th of ns, but they will happen repeatedly. \$\endgroup\$ – sina rahbari Oct 12 '18 at 18:19
1
\$\begingroup\$

An op-amp may not be needed to measure phototransistor output with a microcontroller.
A microcontroller can dynamically change a digital input-output pin to one of three states:

  • input
  • output
  • tristate (high-impedance)

Any microcontroller is adept at measuring time (using an internal counter). The time taken to charge or to discharge a capacitor is measured. Charge/discharge time is inversely proportional to phototransistor current.

First, the capacitor is charged up to the microcontroller's DC supply voltage by setting the I/O pin to output a logic 1.
Then the I/O pin is switched to input, and the internal counter is started.
Once the I/O pin reaches a logic low state, the counter is stopped. It now contains a count value inversely proportional to light level.

schematic

simulate this circuit – Schematic created using CircuitLab

The I/O pin could be polled in a tight loop, or it could generate an interrupt-on-change. You're looking for that high-to-low transition. It is a good idea to also be able to terminate this process should the counter overflow....if there is NO light, the high-to-low transition may never occur. This method can be used with almost any microcontroller - even one with no internal analog-to-digital converter.
The capacitor can take on a smaller or larger value, depending on how much light the phototransistor sees. A small-value capacitor can detect candle-light. A large value is better for sunlight.

This light-measuring process does take some time and is not appropriate for rapidly changing light sources like photo-flash. However, it is more linear than using a photo-resistor. The threshold voltage of a digital I/O pin is not greatly dependable - linearity of this light measuring method can be improved by using an analog voltage comparator to detect the high-to-low transition voltage: many microcontrollers include one (like Arduino).

\$\endgroup\$
  • \$\begingroup\$ Once the microcontroller's pin will be set to input mode, any "unclearly defined" voltage will probably make it consume a lot more current in its input stage. The high gain and high impedance of which will also make it susceptible to noise (although I'm unsure, maybe the capacitor shunts it). In any case, I think the answer might benefit of a mention to Schmitt triggers, as they are perfectly suitable for the task. \$\endgroup\$ – Sachiko.Shinozaki Oct 12 '18 at 16:37
  • \$\begingroup\$ @Sachiko.Shinozaki Yes, Schmitt inputs would be preferable, if available. Have used this method with regular non-Schmitt I/O on Microchip's PIC series quite successfully. Their leakage current spec of +/- 1uA on an input pin is very conservative. Measured less than 1nA. \$\endgroup\$ – glen_geek Oct 12 '18 at 16:45
  • \$\begingroup\$ My problem is not to see the light or not, I have two situations, imagine output voltage from sensor to arduino versus tim: 1- nearly flat at 2.5 volts with very small (10 mv) fluctuation because of ambient light change. 2- Again flat at 2.5 volts but with flyctuation with higher levels only to minus side, like 100 mv and happening at certain timing like every 100 ns, I like to seperate these two condition. I dont insist on op-amp if there is an easier way. Thanx \$\endgroup\$ – sina rahbari Oct 12 '18 at 18:23
0
\$\begingroup\$

There's plenty of op-amp differentiator circuits to be found on the web, since you're using a single supply you'd need to bias the op-amp to run in the middle of the supply range, so that you could get both positive and negative going transients but since you have A-D inputs available, why not just record the input to an array, or at least a 'history' parameter regularly, and look at the difference between the signal over time? No need to differentiate the signal externally.

This isn't really a differentiator, it's amplifying the difference between the input and a smoothed version of the same signal, but it's the simplest way that you can get an amplified signal that shows the change.

This one is a differentiator, the big difference is that the DC gain is obviously zero, and so the op-amp needs biasing to the middle of the range. The first one settles at the mean voltage of the input. enter image description here

\$\endgroup\$
  • \$\begingroup\$ This was what exactly I did with micro for testing made an array of 128 and took the variance by math, it was good, but because the variation which I am trying to measure is too little, I could never tell what treshold is okay and what is not, say sometimes 20 looks fine as a number but sometimes no \$\endgroup\$ – sina rahbari Oct 12 '18 at 18:30
  • \$\begingroup\$ So the ambient light which I have is always giving me roughly 2.5 volts, which will be a problem because it is not fixed every time, but anyway can I amplify the variations only, if yes please guide me with some schematic, sorry but really I am new! If it works like this I can then use amplified signal to be measured by controller like you said, then will be the problem of the refernce point at 2.5 volts which is not always exactly. \$\endgroup\$ – sina rahbari Oct 12 '18 at 18:41
  • \$\begingroup\$ Added a couple of schematics to the answer. \$\endgroup\$ – Phil G Oct 12 '18 at 20:33
  • \$\begingroup\$ Thanks it really helped, but last question how should I supply power to op-amp? 0 and 5v? For both? \$\endgroup\$ – sina rahbari Oct 12 '18 at 21:15
  • \$\begingroup\$ Pretty much all op-amps will run on the same 5V supply the Arduino uses. Check the datasheet for the appropriate connections eg. Vdd=+5V, Vss = 0V on this one ww1.microchip.com/downloads/en/DeviceDoc/21733j.pdf \$\endgroup\$ – Phil G Oct 13 '18 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.