0
\$\begingroup\$

I would like to create a circuit using photodiode that detects when the lights turn on AND when the lights turn off. The output should look something like that: enter image description here

I want to create the simplest possible circuit. The precision is not important, only reliability. The minimum distance between voltage spikes will be in order of seconds. The duration of spikes should be about 100ms.

I would be grateful for at least some keywords to google the solution. So far I found only circuits detecting when the light is on.

Thank you

\$\endgroup\$
3
  • \$\begingroup\$ Why pulses when you just need levels ON/OFF and a load defined \$\endgroup\$ – Tony Stewart EE75 Nov 5 '20 at 21:33
  • \$\begingroup\$ You can use a light-on detection circuit like what you've found already, then pass the output to an edge detection circuit. \$\endgroup\$ – Justin Nov 5 '20 at 22:05
  • 1
    \$\begingroup\$ What exactly is your goal? What do you consider "simple"? By far the simplest circuit in terms of what you visibly construct would be a 6 or 8 pin MCU; that has the advantage of being able to implement an adaptive detection scheme distinguishing changes of interest from trends that are not of interest. Even for the simplest goal, this would be a far simpler circuit board than any discrete implementation... \$\endgroup\$ – Chris Stratton Nov 5 '20 at 22:44
3
\$\begingroup\$

As Chris Stratton said in his comment:

By far the simplest circuit in terms of what you visibly construct would be a 6 or 8 pin MCU

And I fully concur. (The number of unused pins doesn't really matter for complexity, so use whatever MCU you have the easiest access to).

Typical Photodiodes (like this cheap INL-5APD80) have "day" photocurrents in the order of 10 to 100 µA.

schematic

simulate this circuit – Schematic created using CircuitLab

Your freedom lies in picking R1; the higher R1, the less light is enough to make V_meas high.

Note that your MCU allows you to be flexible there, if you configure it to attach its ADC to the GPIO1 pin. Then, you do things like "if it's been really dark for a long time, we increase our sensitivity", because you're no longer triggering based on a fixed voltage level as if you were using GPIO1 as digital input.

The upside of using GPIO1 as digital input might be (depending on the MCU you pick) that you can send the MCU into the deepest of sleeps, and use GPIO1 changing state to trigger a wakeup, making this a relatively power-efficient circuit.

However, small problem here: Microcontroller (like this cheap STM32F0) have inputs that don't have infinite input impedance. (no problem here, the leakage current on datasheet page 72 is specified to be below 0.2 µA, so if your photocurrent is, say, 40 µA, you're pretty safe.)
If you need to sense things quickly on an ADC input, this can become a problem, and you'd need to add a voltage buffer (typically, made out of an opamp) to ensure things keep working; for really fast sensing, there's little way around more advanced amplifier designs (TIAs), but really, this is not your use case. You don't want to receive megabits per second with your photodiode.


Should you really want to go with Fredled's discrete logic approach, you can do it with a single XOR gate, and a delay.

schematic

simulate this circuit

XOR's output is high exactly iff one input is high and one is low.

You can adjust how long that is by twiddling the time constant of your low-pass filter (in green box).

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Just wanted to tell you that I built it (the second one) and it works like a charm. Thank you! \$\endgroup\$ – d7vid Dec 17 '20 at 13:43
  • \$\begingroup\$ @d7vid awesome! Thanks for letting me know :) \$\endgroup\$ – Marcus Müller Dec 17 '20 at 15:25
0
\$\begingroup\$

Something I did a few years ago.

enter image description here

Everything to the left of U1D is deleted, replaced by the output of the light sensor circuit connecting to pins 11 and 12. The nice thing about the Schmitt input is that the input signal can change fairly slowly, and the circuit still will make a clean output signal as long as the input is monotonic. There is no need for diodes to help the timing capacitors recover because the output period is so much shorter than the input period.

For 100 ms (-ish) pulses:

C1 = C2 - 0.1 uF

R1 = R2 = 1.2 M

\$\endgroup\$
2
  • \$\begingroup\$ (1) When U1D drives low, R2 will charge C1 to VCC. When U1D goes high, U1C will get 2xVCC on its input. (2) Similarly, when U1D drives high, C2 will charge to VCC through R1. When U1D goes low, C2 will deliver -VCC to U1B's input. (3) Then there's power-down, when the rail dies but C1's holding up U1C with a big 470K to leak it slowly away. I'd have upwards-pointing diodes in parallel with R2 and R1. In reality, gate input diodes are there but I'd not design for them to take care of spikes from a 1uF. I imagine you'll say lots of 'em have worked for ages but I can't call it good practice. \$\endgroup\$ – TonyM Nov 6 '20 at 13:52
  • \$\begingroup\$ The caps are 0.1 uF in the text, not 1.0 uF, but I take your point. 1 uF is about my limit for no external diodes. Note that the gate inputs have clip diodes to both rails with an explicit current limiting resistor in series.. \$\endgroup\$ – AnalogKid Nov 6 '20 at 16:14
0
\$\begingroup\$

I designed what you need 2 weeks ago so you are lucky. Because i don't have currently a computer you need a current change detection circuit which can be done really easily with a current source(variable) 2 resistors, 1 opamp and 1 capacitor. You connect 1 resistor in series with the capacitor and you put the entire thing parallel to the 2nd resistor. Let's call this part of the circuit A. You connect A in series with the current source and create a closed loop putting somewhere a GND as well. The 2 ends of the resistor which is in series with the capacitor you connect them to the inverting and non inverting input of the opamp. And here you go!

\$\endgroup\$
-1
\$\begingroup\$

A photodiode will transmit a signal when there is light, stop transmitting when there is none. To convert this on/off signal, you can try the following circuit:

SHT1 is a schmitt trigger used to create a signal equivalent to the inverter schmitt trigger INV1. (It can be omitted if the Photo diode PHOTD1 already generate a signal equivalent). When PHOTD1 output is high, SHT1 turns high and INV1 turns low. C1 let a positive signal pass to the input of SHT2 for a short duration. Inversely, when PHOTD1 is low, INV1 turns high and SHT1 turns low and C2 let a short signal go to SHT2.

D1 and D2 prevent negative current to appear at the output of SHT1 and INV1 (this can damage the ic's). D3 and D4 prevent opposing signals to arrive at SHT2. R1 pulls the input of SHT2 low when no current go through neither D3 nor D4.

schematic

simulate this circuit – Schematic created using CircuitLab

Another circuit proposed by Olin Lathrop here I would just add a schmitt trigger between the RC circuit (R1 + C1) and the input pin 2 of the XOR gate (IC1A).

Chose which one is the best.

\$\endgroup\$
3
  • \$\begingroup\$ Comments are not for extended discussion; this conversation has been moved to chat. \$\endgroup\$ – Voltage Spike Nov 6 '20 at 16:20
  • \$\begingroup\$ " D1 and D2 are not used to "reset" the capacitors but to prevent negative current when the capacitors discharge." But since the right sides of the caps are not driven by a gate output, the left sides cannot be pushed below GND. D3 and D4 prevent the two input gates from back-driving each other. In fact, with decent caps, they will not self-discharge in "seconds". D3 and D4 prevent SHT2's input stage protection diodes from providing a discharge current path. After 1 or 2 cycles, both caps will be charged up and the output gate will not see any transitions. \$\endgroup\$ – AnalogKid Nov 6 '20 at 16:24
  • \$\begingroup\$ See our comments on @AnalogKid's answer for more on the diode clamping subject. \$\endgroup\$ – TonyM Nov 6 '20 at 17:01

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.