190Views12Replies

# Find the average and highest voltage from multiple photodiodes before analogue Arduino input? Answered

Hi, I have a large number of photodiodes (too many to connect all of them individually to the analogue inputs on my Arduino) so I was hoping I could form say 4 groups each containing several parallel photodiodes and find the average the highest voltage for each group. This way each group uses 2 analogue inputs.

The picture below depicts one group of photodiodes connected to two 'black boxes'. The 'highest voltage' black box would determine which input had the highest voltage and would then output that voltage to the Arduino. The 'average voltage' black box would average the input voltages and output this voltage to the Arduino.

I have found a passive averager circuit on this website - http://www.allaboutcircuits.com/textbook/semiconductors/chpt-8/averager-summer-circuits/ - which appears to be suitable however I have no idea how to find and output the highest voltage.

Hopefully this sufficiently explains what I'm looking to do and I look forward to getting feedback.
Andrew

Tags:

## Discussions

Resistor dividers can do the averaging. Connect 3 (or however many you need) equal value resistors to one analog input and the other end of the resistors to the individual diodes.

Peak voltage can be done the same way with diodes instead. The diodes will prevent current flowing back into any of the photodiodes. The one with the highest voltage will be present on the arduino input.

You may also need to buffer and amplify the signals. Op amps can be used to do that. Here are some example circuits: https://www.google.com/search?q=op+amp+averager&espv=2&biw=1536&bih=758&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjg_8_u8O3MAhVLVj4KHbgHCCcQ_AUIBigB

Do the same thing but replace the 3 or x number of resistors with diodes to get the maximum voltage of the sample.

Hi -max-, I'm not sure if I've understood correctly, but are you suggesting putting a diode in series with each photodiode and then connecting all of them in parallel to the Arduino input (see picture)?

I'm not sure how this circuit would work. For instance, with three photodiodes at V1 = 1V, V2 = 1.2V, V3 = 4V, why would the Arduino see 4V?

Yup, you should also add a pulldown resistor. I assume that the photodiodes will produce several volts of EMF when hit with light. The diode with the highest voltage will allow the greatest current to flow through the 100K resistor to ground, and you can sense the voltage dropped across that resistor.

The way the circuit works is really quite simple. You have to think about this circuit in terms of current as well as voltage. Look at the colorful diagram. Say input A has nothing connected, the input B has 3V applied to it, and input C is connected to ground potential (0v). Because input A is left floating, there will be nothing to push current through the diode. The second diode has 3V on one side, and a resistor on the other side. Because it is forward biased, current can flow through. It will have about a 0.6 volt drop across it, so that leaves 2.4V across the resistor. The last diode has its anode connected to ground and the cathode at 2.4V potential. Because it is reverse biased, very little current "leaks" through it. Orders of magnitude less than the current supplied by the other diode. So the voltage still stays at 2.4V.

You may notice a small problem with this circuit: That real diodes are crappy and need a minimum of 0.6V to start conducting current. If the photodiodes (I don't know much about them) produce only millivolts, you may want to connect them to a higher potential to begin with. So instead of connecting the cathode of all those diodes directly to ground, you may want to low value (1k ish) resistors and apply a bias current into these resistors to develop a small voltage of at least 0.6V. (use ohm's law!). Or you could instead use Schottky diodes which have a lower voltage drop (of about 0.1v to 0.4v)

----------------------------------------------------

This is also a great way to make a diode logic AND gate. I like to think of this configuration as an "analog" and gate.

Thanks for the information, I'll look into the unity gain buffers and try making this when I have some time.

Because for the any photo diode, the normal diode is in reverse when another photo diodes produces a higher voltage.

Of course, you would not get 4V but 4V - Uforward

Well, and you have to take the internal resistance into account. That of the sink - the ADC (very high, that's good) and that of the source - photo diode (high - bad).

You cannot connect the photo diode with both circuits (average and maximum) directly - they would influence each other. Look for unity gain buffer circuits.

+1.

You can use op amps for really good voltage buffering, but I think you can get away with a common emitter amplifier, especially with a darlington.

Well, it could be one with analog electronics by using an analog multiplexer and some sample-and-hold stages with different time constants.

But as you already have a microcontroller, you can drop the sample-and-hold stages and do the math there - averaging is simple, maximum even more so. All you need is the analog multiplexer to connect the diodes one after the other with one ADC input.

Hi Verence, I hadn't come across those before so thanks for pointing them out. Unfortunately using the Arduino to check each photodiode individually would cause my program to run extremely slowly so it wouldn't be suitable for this application.

Are these diodes loose or in a ribbon dispenser. You could do a sequential test and sorting while you sleep...

Sorry but I fail to follow you here, what is the purpose of this?

Hi Downunder35m, I'm make a game similar to laser tag, I can't get the right shape photodiodes or ones large enough to cover the target surface so I was intending to cover it with several smaller photodiodes.

I need to read the average voltage from all of them in order to calculate 'background' voltage from the ambient light but then I also need to be able separate out the photodiode which the laser is incident on in order to read the transmitted data. Hence the need to find the average of all the photodiode voltages and the voltage coming from the photodiode with the highest voltage.

To put some numbers to this:

If I have 10 photodiodes all reading 1V+-0.2V due to ambient light then my average will be around 1V

If the laser is now incident on 1 of the photodiodes, I have V1->V9 = 1V, V10 = 4V then the average is just 1.3 which is barely above the noise level and could easily be swamped. So I also need to separate out the 4V though I don't care which photodiode is giving the highest voltage.

I hope that explains things a bit better.

That is better :)
I have seen laser vests here in basically two types.
The first is used for invisible lasers, like these for kids using just some IR diodes.
Here several "pads" are used in stratic locations, chest, back, arm...
Each pad is like a little dome made from dark plastic that only allows IR light to pass.
The inside of this plastic is half reflective so no matter from what angle the beam hits it will find a way onto the photo cell.

The other type I have seen is used for red and green lasers.
Here people have to wear corresponding safety glasses.
The detection is a bit easier as the laser is
a) not fully focussed
b) detectors are placed in lines over the vests
I say easier as simple filters are used where only the selected color can pass.
Here for example you can not shoot your team mates as everyone in the team has the same color for the laser.
If you are red than a green laser is required to shoot you.

Both methods won't really react to ambient light although I doubt you could play the gmes outdoors in full sunlight.