Author Topic: How to use multiple photo diodes as one?  (Read 5697 times)

0 Members and 1 Guest are viewing this topic.

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
How to use multiple photo diodes as one?
« on: April 26, 2018, 11:14:43 am »
Hi!
I have to make some sort of IR photo sensor and connect the sensor to the uC.

The 4pcs  photo receivers are photo diodes this type: SFH 203 FA.

The photo diodes should be connected to only one I/O pin on a uC.

I have two problems here:

1.
Is there some sort of logic gate which have multiple inputs in my case 4 inputs ) and if one of the photo diodes is triggered the
output will go Hi or LOW? no matter what state.
But, the triggering should be exclusive.
I mean, it can be a situation does in a fraction of time, the same object could hit the second photo diode and also trigger them, but
in this case, the output should not react, or so to say, the output should not change again the state because it is the same
object in the photo sensor. ( this is the photo senor part of a seeder machine ).

2.
What would be your suggestion of the design, how to connect these 4 photo diodes so it will use only one I/O pin of the uC?
If it is possible I would save I/O pins for some other thinks.
And If there is no other option than I have to use 24 I/O pins...

For now I'm just collect ideas, infos and thinking about the concept.
Thank you for any suggestion or info.

My best regards.
« Last Edit: April 26, 2018, 11:19:48 am by Chriss »
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: How to use multiple photo diodes as one?
« Reply #1 on: April 26, 2018, 11:26:25 am »
Your question needs some refinement, but to simplify things, no retriggering within a certain time frame is easy as a software problem, having a period where you ignore that pins input after a valid trigger would likely be the solution there

For the 4 diodes, all going high to low, its going to come down to your diode leakage a little, but I imagine either a fixed pullup resistor or a pin liftup, with all 4 diodes connected anode to ground, cathode to input,

You may need an op amp to amplify this difference, and having it act as a differentiator may improve noise resistance, still connected to 1 pin, just some glue inbetween,

 
The following users thanked this post: Chriss

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: How to use multiple photo diodes as one?
« Reply #2 on: April 26, 2018, 11:32:41 am »
I thought also to make the first problem on the software side as you mentioned.
To implement a waiting time of 10-20ms, but I not sure would this work correct...
This will be definitive an easy task.
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7764
  • Country: de
  • A qualified hobbyist ;)
Re: How to use multiple photo diodes as one?
« Reply #3 on: April 26, 2018, 12:58:24 pm »
Maybe a  transistor/opamp/comparator (with adjustable trigger level?) for each photo diode and 4 diodes to combine the signals for the MCU.
 
The following users thanked this post: Chriss

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: How to use multiple photo diodes as one?
« Reply #4 on: April 26, 2018, 02:05:17 pm »
Quote
the photo sensor. ( this is the photo senor part of a seeder machine ).

Depends some on how you arrange the photo sensors, but I can see a seed effecting two photo sensors at same time.
Treating each sensor as separate could miss this case.

If you think of each photo sensor as a current source, then with no seed you have a combined current. Any blockage will change this current.

Start with a resistor connected to each sensor. The four resistors connected to one resistor in series.
Think a comparator sensing voltage change across the one resistor is what you want.
Only reason for the four resistors is to protect each photo sensor. This is photo voltage protection and might not be needed.

C
 
The following users thanked this post: Chriss

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: How to use multiple photo diodes as one?
« Reply #5 on: April 29, 2018, 06:48:42 am »
It might be better to step back a bit and rather ask for opinions as to how to handle a scenario you understand, is to give us a more descriptive view of the physical setup.

For example - how are the photodiodes positioned?  Are they meant to be detecting the same seed - or up to 4 seeds?

These are things that will make a huge difference in us being able to ask intelligent questions and offer you practical solutions.  Sometimes the best solutions can be extremely simple ... so simple, in fact, that they may not be immediately obvious.
 
The following users thanked this post: Chriss

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: How to use multiple photo diodes as one?
« Reply #6 on: April 29, 2018, 06:42:37 pm »
Here is a block diagram from scratch how it works on real seeder machines:


And here is a picture of the sensor on a seeder machine:


I set up my sensor on my bench, based on the pictures above just with 3 ir diodes and photo sensitive diodes.

I use 74HC14 scmitt trigger ic to get a clear signal from the photo sensitive diodes.

When I drop a corn seed through the optical channel it is sensed by the photo sensitive diodes.
I use my oscilloscope for monitoring.

I thinking in two ways to use the photo diodes:

1. to connect the signals together and use one signal wire for every seed box.
(on one seeder machine can be 4,6 or more seed boxes. Every seed boxes must have one pair of these sensors.)
So I would use only 4 or 6 I/O pins on my uC.

2. to use a smaller uC for every sensor and connect all the photo diodes to separated I/O pins on the uC.
Then all the small uC's to connect to the main uC where the data are collected, computed
and show the result on the screen or whatever...
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: How to use multiple photo diodes as one?
« Reply #7 on: April 29, 2018, 09:02:41 pm »
Connect their anodes (cathode should be biased by about 5-10V) and put the combined current into a resistor to convert it to a voltage (at these speeds you probably don't need a transimpedance amplifier). Connect a RC differentiator to the resistor and use a comparator to threshold the result.
 

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: How to use multiple photo diodes as one?
« Reply #8 on: April 29, 2018, 09:12:07 pm »
Hi Marco!
Thanks for the quick reply.
Can you please attach a schematic how you mean the circuit?
Just to be sure does I understand your writing because my low English.

Thank you.


I'm thinking to try this kind of connection too.
What you think about this?


« Last Edit: April 29, 2018, 09:43:19 pm by Chriss »
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: How to use multiple photo diodes as one?
« Reply #9 on: April 29, 2018, 09:44:52 pm »
Sure, but no guarantees it works :) First dimension R1 and the LED current to get a nice signal swing when a seed goes through (a couple 100 mV or more would be nice, dunno if you can do that without an amplifier). Then dimension R2/R3/C, make R2//R3 larger than R1 if possible, then C sets the time constant, needs to return to equilibrium fast enough for the next seed. I put the diodes below the detection resistor, because that way the pulse goes up when the seed goes through, which is more intuitive.
« Last Edit: April 29, 2018, 09:50:30 pm by Marco »
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: How to use multiple photo diodes as one?
« Reply #10 on: April 29, 2018, 10:55:26 pm »

When testing you need to test all states.

No seed & one seed is a test.
but you also could have two seeds at same time.
or a hand full of seeds at a time.

A hand full could be normal fast planting or an error indication.


From what little you have said, I would look for a microcontroller with CAN bus for each seed counter.

C
 
The following users thanked this post: Chriss

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7733
  • Country: ca
Re: How to use multiple photo diodes as one?
« Reply #11 on: April 30, 2018, 12:36:47 am »
Marco has the correct circuit for this application.
Though you need to properly tune the resistors and capacitor.

The other choice is to get rid of the op-amp, feed the output pu of the capacitor into an MCU ADC input and software filter-isolate the signal into seed counting, but, this requires a lot of programming and software DSP filtering know how.
 
The following users thanked this post: Chriss

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: How to use multiple photo diodes as one?
« Reply #12 on: April 30, 2018, 09:03:26 am »
For detecting any interruption one could connect the photo-diodes in series. So the relevant output would be from the diode that gets the least light.

Having the diodes in parallel would result in the sum of intensity. If the analog part is sensitive enough, one might still be able to detect a single interrupted light path.

The current from photodiodes is usually rather low, so it might be a good idea to have some amplification close to the detectors.
 
The following users thanked this post: Chriss

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: How to use multiple photo diodes as one?
« Reply #13 on: April 30, 2018, 09:58:06 am »
Does it menas if the photo-diodes are in paralel and feed the op-amp that could result in a particle detector? I mean that could detect also the dust in the air where the seed travel.  And that could be a false triggering.
To sensitive...
But of course it could be trimmed with the potmeter on the op-amp.
I'm not sure how precise could that be in a practical meaning because of the rea lly small current of the diodes. I assume it Is somewhere in mA or even in uA region.

Maybe a stupid question but no matter.
Why you are focused to use an op-amp and not a Schmitt trigger?

I mean if one of the diodes is triggered that should indicate that something was traveled through the light.

That diode on-off time must be somehow declared in the uC or by hardware to avoid a seed bouncing effect.  That bouncing effect if it is to long should trigger an error.
Maybe to much seed is traveling or some other sort of problem exist.

This signal shoukd be a to long high/low output, let's say maybe 50ms or 100ms...

When I talked with people's who have this kind of machine, they say if they have to change to smaller seeds or bigger seeds than they have to change te sensor parts also. Becuase of the resolution I assume.

From this info I know does one type of sensor is for one type of seeds. ..

Sent from my GT-I8260 using Tapatalk

 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: How to use multiple photo diodes as one?
« Reply #14 on: April 30, 2018, 01:25:43 pm »
The current through Photodiodes would likely be in the low µA range, depending on the LEDs. So the signal tends to be rather small. With the diodes parallel I would expect more like a small drop in intensity (e.g. 20%) - this might get tricky to detect with a schmidt-trigger.  The size of seeds is a factor too - coco-nuts is easy, something like papaver get difficult.

It might need the extra amplification with something like the OP to also sense weak signal. I would expect a kind of adjustment option. Schmidt trigger like functions are often included with µC inputs. An analog reading to the µC is an option too. So the µC could learn the open intensity.
 
The following users thanked this post: Chriss

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: How to use multiple photo diodes as one?
« Reply #15 on: April 30, 2018, 04:50:47 pm »
At 10 mA a LED would put out about 0.2 mW/sr ... so if the distance between the LED and photodiode is 5 cm, that gives 0.2/25 = 0.008 mW/cm2, gives 0.008*50 = 0.4 uA.

It's not much, but the capacitance is only 11 pF. So even with a Meg resistance you're looking at a time constant of 44 uS.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 8172
  • Country: fi
Re: How to use multiple photo diodes as one?
« Reply #16 on: April 30, 2018, 05:29:11 pm »
Phototransistors could be considered for higher signal.
 

Offline C

  • Super Contributor
  • ***
  • Posts: 1346
  • Country: us
Re: How to use multiple photo diodes as one?
« Reply #17 on: April 30, 2018, 06:26:47 pm »

Think of all the different changes switching seed can make.

You listed dust and for some seed types a bag of seed will contain dust.

Seed size and with this smaller is often planted closer together increasing seed detection rate for same planting speed.

Some let light shine through the seed.

So in addition to proper detection, the speed must be there for planting rate.

C
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: How to use multiple photo diodes as one?
« Reply #18 on: April 30, 2018, 07:03:47 pm »
Need to know the size of the seeds and their speed to say anything useful really. You can get a reasonable signal swing with a 44us time constant with just a resistor, if it needs to be faster use amplification and a smaller resistor or a transimpedance amplifier.
 

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: How to use multiple photo diodes as one?
« Reply #19 on: April 30, 2018, 07:42:06 pm »
The seed dimension, weight, size are very unpredictable, also because of this unknown there is no way to calculate an accurate math I think.
But, here is what I setup days ago and how I played with this stuff and the result on my scope:

My setup is on my breadboard.
I used 1 photo sensitive diode and 1 IR LED diode all they 5mm diameter.
They are 6 cm far from each other.
The actually distance on a seeder machine is below 4cm.
So, my setup is a bit over distanced.

The photo sensitive diode is connected to the 1A on a 74HC14 Schmitt trigger.
And the CH1 of my scope also connected to the 1A of the IC.
The CH2 is connected to the 1Y of the IC.

When I drop a corn seed to interrupt the light I measure the result with my scope:


As you can see, the CH1 is the analog part of the signal and the CH2 is the output of the Schmitt trigger on 1Y.
The seed is traveling around 5.8mS until it left the sensing region.
I tried hundreds of time with a couple of hundred of different corn seeds and the time was between 3ms up to 7-8ms.
Depending on the seed weight and dimension I assume.

This signal looks me fine to use and is very stable until the test on my bench.
I don't had the ability to try it in real life on seeder machine for now.

Why can we not use this signal in some way together with each other rather than using the uA etc.
region what are really nasty to setup and control that small amount of current.
Maybe that could change his behavior on a more hot day, or more colder day, or more moisture or whatever.

And this is a signal when I press a button on my DVB remote control.
The same distance of 6cm from the photo sensitive diode is my DVB remote control.



Sorry for this kind of interrupting but this signal looks really good for me.
What you are think about this?

Don't pay attention to the ripples on CH1, that comes from my breadboard....
« Last Edit: April 30, 2018, 08:03:13 pm by Chriss »
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: How to use multiple photo diodes as one?
« Reply #20 on: April 30, 2018, 08:13:20 pm »
If the seed only blocks part of the sensor it might not drop the signal low enough to trigger. Dirt and dust will affect the reliability in a way a differential detection is less vulnerable to.

Most importantly though if you use the photodiode in photovoltaic mode and you just connect it direct to a logic input, you are relying on the dark+input leakage current to drop the signal when the seed blocks it. Especially the leakage current is not well characterized, designing a circuit purely experimentally is risky. Unless you have a really good idea how the inverter input operates, at least put a resistor in parallel which dominates the pull down, so you know what it does at any temperature and with any in-spec inverter from principle.
 
The following users thanked this post: Chriss

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: How to use multiple photo diodes as one?
« Reply #21 on: April 30, 2018, 08:43:15 pm »
Thanks for this valuable info.
Tomorrow I will make the circuit from post no #9 what you are shared and I will play a bit with it,
to see how that is working.

I have LM324 IC in my home stock, I hope that would be good enough.
I use the TSAL6200 IR LED and the forward current is 100mA in the datasheet.
Should I let the IR LED full sine or not?
« Last Edit: April 30, 2018, 08:50:10 pm by Chriss »
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: How to use multiple photo diodes as one?
« Reply #22 on: April 30, 2018, 09:07:32 pm »
The typical 100 mA specs for the IR LEDs is rather optimistic. They already get quite warm if not cooled well via the board or wires. So I would use 20-50 mA.

Using a number of IR lEDs increases the chance that a seed will only block a part of the light to one detector.

For pulse of a few ms, the LM324 might be just fast enough.

The logical circuit would be a series resistor and 2-4 detectors in series.
The circuit in #9 should give a similar result if there is a pull up behind the diodes, but slightly less sensitive.
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: How to use multiple photo diodes as one?
« Reply #23 on: April 30, 2018, 10:11:47 pm »
I have LM324 IC in my home stock
In that case buffer the output of R1 first before you do the CR differentiation, without a buffer the size of the resistors you would need for R2&R3 would become problematic.
 

Offline ChrissTopic starter

  • Frequent Contributor
  • **
  • Posts: 534
  • Country: 00
Re: How to use multiple photo diodes as one?
« Reply #24 on: April 30, 2018, 11:30:33 pm »
I found some LM358 also, would that be a better choice?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf