Author Topic: Ambient light rejection circuit don't reject it very well  (Read 3252 times)

0 Members and 1 Guest are viewing this topic.

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Ambient light rejection circuit don't reject it very well
« on: April 14, 2019, 07:29:11 pm »
I've been trying to design a slightly-better-than trivial "UART over laser pointers" circuit, and this is what i ended up with:



Ideally, this should remove the ambient light from the signal.
The photodiode's pre-amplified output is split in two, one side is fed through an RC filter and a buffer producing what is essentially the average DC level of the ambient light.
So far so good.

This average level is then subtracted from the actual signal by a differential amplifier, and the remaining "useful signal" is amplified and thresholded to produce the 0-1 a computer can digest.
And here comes the problem - above a certain ambient light level the output of IC2B starts tracking the brightness rather than subtracting it completely.
It looks like a rising sheet of paper covering the signal rather than the signal getting shifted up along with a zero point.

I've tried to vary R6-R9 values, the higher they are the more light it takes for it to start rising, but the less sensitive it becomes. 100k seem to be the optimal value.
Other than that nothing i tried made any difference.

I suspect the problem comes down to some case of "real op-amps don't work like ideal op-amps", but i don't know enough about it to even know where to start looking for the problem.

So, the question is - is this a workable design, and in either case what am i doing wrong?
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6420
  • Country: de
Re: Ambient light rejection circuit don't reject it very well
« Reply #1 on: April 14, 2019, 07:44:53 pm »
For this kind of circuit, you normally have two photodiodes. One for receiving and one for measuring ambient light to compensate.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: Ambient light rejection circuit don't reject it very well
« Reply #2 on: April 14, 2019, 08:05:15 pm »
If the DC part is much bigger than the AC part then you are sensitive to the "real" stuff like opamp offsets, resistor mismatch etc.
On the other hand, since subtracting the DC part will yield the AC part,  the AC part can be obtained simply with a high-pass filter.  Of course then you have a to shift your signal level to the 0-5 V range, this can be done with a comparator (a comparator with an open-collector output like the LM311 can do it without any additional components). 
BTW. I'm using exactly this approach in this similar project:
https://www.eevblog.com/forum/projects/simple-lifi-transmitting-audio-signal-with-a-led/msg2282771/#msg2282771
 

Edit:

Your lowpass transfer function is 1/(1+jwR1C1),  after the differentiating opamp IC2B the transfer function becomes
1-1/(1+jwR1C1)=R1/(R1+1/jwC1)  which is a high-pass made with R1 and C1.  So IC2B is useless, just invert R1 and C1.  Did I miss something here?
« Last Edit: April 14, 2019, 09:51:40 pm by pwlps »
 

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Re: Ambient light rejection circuit don't reject it very well
« Reply #3 on: April 14, 2019, 10:23:05 pm »
For this kind of circuit, you normally have two photodiodes.
I feel like this will only make things worse, since every slight difference  between them would be severely amplified.

Did I miss something here?
Yep, the whole idea is to not have to deal with AC-only nature of high pass filter, but rather have a regular OOK signal with ambient level removed.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17427
  • Country: us
  • DavidH
Re: Ambient light rejection circuit don't reject it very well
« Reply #4 on: April 14, 2019, 11:14:36 pm »
Reject the ambient signal by driving a current back into the input of the photodiode amplifier as shown in figure 4 of this Burr-Brown datasheet.
 

Offline ArtlavTopic starter

  • Frequent Contributor
  • **
  • Posts: 750
  • Country: mon
    • Orbital Designs
Re: Ambient light rejection circuit don't reject it very well
« Reply #5 on: April 15, 2019, 02:01:10 am »
Reject the ambient signal by driving a current back into the input of the photodiode amplifier as shown in figure 4 of this Burr-Brown datasheet.
That looks interesting. Is there a way to make it work from a single supply?
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: Ambient light rejection circuit don't reject it very well
« Reply #6 on: April 15, 2019, 06:31:40 am »
Reject the ambient signal by driving a current back into the input of the photodiode amplifier as shown in figure 4 of this Burr-Brown datasheet.

Driving a current back is only to protect the transimpedance from saturating (but this is apparently not the problem here), otherwise this circuit is equivalent to a transimpedance+highpass.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: Ambient light rejection circuit don't reject it very well
« Reply #7 on: April 15, 2019, 07:05:10 am »
Yep, the whole idea is to not have to deal with AC-only nature of high pass filter, but rather have a regular OOK signal with ambient level removed.

Ok, but with the values of R6-R9 given on the schematics your circuit IS actually a highpass, albeit constructed in a complicated way.

So on what basis you want to distinguish between the DC parts of the ambient background and of the signal ?

 Moreover they are not truly DC:  the ambient light may vary slowly (can also have 50 / 60 / 100 / 120 Hz lighting components) and the DC part of the OOK signal will vary according to the number of 0's and 1's in the data byte. You need some clever low-frequency discrimination. Even then it is not simple because the spectrum of the OOK signal may extend to arbitrary low freqs  (consider the first byte after a long pause, or a long sequence of 1's).  I don't think this is a workable design, at least in real conditions where the ambient light may vary.

Note also that high-gain DC amplification is more difficult than AC. In DC you will need to carefully balance all opamp offsets, whereas in AC you can use capacitive coupling between stages and don't care about offsets. This is why different data coding schemes used for long distance transmissions are usually designed so as to not to contain any information-carrying DC component.  For example with some carrier modulation, or Manchester coding, to not to rely on any DC components.



« Last Edit: April 15, 2019, 08:53:29 am by pwlps »
 

Offline nali

  • Frequent Contributor
  • **
  • Posts: 732
  • Country: gb
Re: Ambient light rejection circuit don't reject it very well
« Reply #8 on: April 15, 2019, 08:58:02 am »
Check the datasheet for your LM324 for output voltage swing, if you're only running it on a single 3V3 supply you'll be running out of headroom. E.g. the first datasheet hit on Google (TI) says output swing to Vcc - 1.5V so you'll be topping out at 1.8V.
 

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2812
  • Country: nz
Re: Ambient light rejection circuit don't reject it very well
« Reply #9 on: April 15, 2019, 09:45:16 am »
Have you tried a coding system that can be AC coupled?

 8b/10b comes to mind - it is pretty easy to implement and is pretty much the industry standard.

Maybe a variant of Manchester encoding could work too.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17427
  • Country: us
  • DavidH
Re: Ambient light rejection circuit don't reject it very well
« Reply #10 on: April 16, 2019, 01:32:02 am »
Reject the ambient signal by driving a current back into the input of the photodiode amplifier as shown in figure 4 of this Burr-Brown datasheet.

Driving a current back is only to protect the transimpedance from saturating (but this is apparently not the problem here), otherwise this circuit is equivalent to a transimpedance+highpass.

This idea is more common with instrumentation and difference amplifiers where it allows a high-pass response without compromising the common mode rejection of the amplifier but I knew it was also used with photodiode amplifiers to reject ambient light so that is the example I gave.

Of course it results in an AC coupled response.  But because the feedback is to the input of the first amplifier, it prevents that amplifier from saturating due to ambient lighting.  Rejecting the ambient lighting is the whole point.
 

Offline pwlps

  • Frequent Contributor
  • **
  • Posts: 372
  • Country: fr
Re: Ambient light rejection circuit don't reject it very well
« Reply #11 on: April 16, 2019, 03:12:26 pm »
Have you tried a coding system that can be AC coupled?

 8b/10b comes to mind - it is pretty easy to implement and is pretty much the industry standard.

Maybe a variant of Manchester encoding could work too.

For Manchester encoding it is possible to do it in the software, without any specialized IC, coding the data bytes in such a way that a standard RS232 UART will be able to send/receive it as a normal data stream :
http://www.quickbuilder.co.uk/qb/articles/Manchester_encoding_using_RS232.pdf

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf