Removing a Varying DC Offset from a Digital Signal

In summary, the individual is building a visible light communication project but is facing issues with the ambient light in the room affecting the Vout of their photo diode amplification circuit. They have considered using a DC blocking capacitor and are open to other ideas. However, the fluctuating DC level due to different lighting conditions makes it more complicated. Some suggestions for filtering techniques and using IR technology are given, but the individual is also considering using a carrier frequency and Manchester/Biphase coding to address the DC offset issue.
  • #1
TomLund
2
0
I am currently ‎building a simple visible light communication project.

My issue is with the ambient light in the room. The Vout of my photo diode amplification circuit shows a square wave carrying the data on top of a varying DC level depending on the amount of ambient light .

I have read about a DC blocking capacitor but have yet to try it. I would love to hear other ideas.

What makes ‎this issue more complicated for me is that the DC level is not always the same due to different lighting.

Thanks,
 
Engineering news on Phys.org
  • #2
TomLund said:
I am currently ‎building a simple visible light communication project.

My issue is with the ambient light in the room. The Vout of my photo diode amplification circuit shows a square wave carrying the data on top of a varying DC level depending on the amount of ambient light .

I have read about a DC blocking capacitor but have yet to try it. I would love to hear other ideas.

What makes ‎this issue more complicated for me is that the DC level is not always the same due to different lighting.

Thanks,
Welcome to the PF.

It's probably easiest to just use digital filtering techniques (like a digital highpass filter) to remove the offset:

http://openenergymonitor.org/emon/buildingblocks/digital-filters-for-offset-removal

One simple way to think about it is you are taking a running average of the digital numbers, and subtracting off that running average from the data. :smile:
 
  • Like
Likes TomLund and donpacino
  • #3
BTW, are you using an IR LED for TX and an IR window at your RX photodiode? That will help you to reduce the influence of ambient light on your comm link. :smile:
 
  • Like
Likes TomLund
  • #4
berkeman said:
It's probably easiest to just use digital filtering techniques (like a digital highpass filter) to remove the offset:
That would be fine, as long as the range of DC offset is not too great. If the fluctuations in ambient light are very slow, compared with the digital data rate, a simple analogue low pass filter would do most of the work for you and you could fit and forget it. A simple rule of thumb suggests that a 1μF series 'blocking' capacitor and a 1MΩ resistor across the input to your ADC input would effectively attenuate signals varying at less than 1Hz. That should deal with the worst of your problem. Some digital high pass filtering would finish the job. There could be some Mains Hum on the ambient light level (some CFL lights) and that could require a higher cut off frequency for your input LP [Edit. Make that a HP -thanks Berkman] filter. No prpoblem at all if your signalling rate is hundreds of kHz or more.
 
Last edited:
  • Like
Likes TomLund
  • #5
I would lean towards a analog high pass filter as well.
-
Here is some food for thought. Maybe not practical but would be a fun project:
Use TWO transmitters and TWO receivers. Invert the data on one of the transmitters. The T/R pair would need to be basically side by side but arranged so they are isolated from each other for cross-talk. Maybe laser diodes? Invert one of the signals on the receiving end, sum the two signals and you will cancel ANY type of interference in the room whether it is high or low frequency and boost the received signal while you are at it.
 
  • Like
Likes TomLund and Merlin3189
  • #6
I'd recommend using IR TV remote control technology as your guide. It's very low cost, and a proven technology. :smile:
 
  • Like
Likes Merlin3189
  • #7
berkeman said:
I'd recommend using IR TV remote control technology as your guide. It's very low cost, and a proven technology. :smile:
If you want to fit and forget, then that is the clear favourite. Otoih, if you want to become an expert . . . . . . . . . But life's too short and you can read about all the pitfalls of signalling, rather than getting your hands dirty.
What you really need is a signalling system that uses a Carrier, which takes the signal spectrum above DC. The Manchester / Biphase coding system gives you just that. Instead of decoding zeros and ones directly, it uses 1-0 transitions to signify a 1 and a 0-1 transition to signify a 0 (or the other way round. It requires a clock frequency that's twice the binary data rate but it means that there is never a DC component ( which you will start to get with very long strings of ones or zeros that are possible with simple binary encoding.) There is lots of information about how to code and decode biphase signals. Google it and find out. It's a clever idea and only requires simple circuitry.
 
  • Like
Likes berkeman
  • #8
sophiecentaur said:
If you want to fit and forget, then that is the clear favourite. Otoih, if you want to become an expert . . . . . . . . . But life's too short and you can read about all the pitfalls of signalling, rather than getting your hands dirty.
What you really need is a signalling system that uses a Carrier, which takes the signal spectrum above DC. The Manchester / Biphase coding system gives you just that. Instead of decoding zeros and ones directly, it uses 1-0 transitions to signify a 1 and a 0-1 transition to signify a 0 (or the other way round. It requires a clock frequency that's twice the binary data rate but it means that there is never a DC component ( which you will start to get with very long strings of ones or zeros that are possible with simple binary encoding.) There is lots of information about how to code and decode biphase signals. Google it and find out. It's a clever idea and only requires simple circuitry.

I am using manchester coding but have not applied any carrier frequency, maybe this is my issue.

What i thought was the problem was not the main issue which is the dc offset. The current issue is if i look at the signal being received by my receiver circuit with all lights off in the room i see a perfectly recreated square wave. When the lights are turned on the scope shows the low side of my square wave to be much shorter.
To trouble shoot i simply sent a square wave at the same frequency of my data and view the output of my photo detector circuit on the scope. With the lights are off i see a perfect recreated wave (ie ¯¯¯___¯¯¯___¯¯¯___). When i turn the lights on i something like this ¯¯¯¯¯_¯¯¯¯¯_¯¯¯¯¯_.

Not a lot of information for you to go off. But this is my current problem
 
  • #9
TomLund said:
I am using manchester coding but have not applied any carrier frequency, maybe this is my issue.
Manchester coding has its own carrier - at twice the bit rate, phase modulated by the data (is one way to look at it) and no DC component. It is, of course, possible to put it on another carrier, way above any hum frequencies and a suitable band pass filter could be easy to implement.
The waveform that you describe could be indicating that the detector is being overloaded by the house lights. You could look at the analogue waveform from it, with the lights on. It could be a signal to interference problem. If you are using IR, then an optical LP filter could eliminate some of the spurious light input, otherwise you may need to use some directivity in your link of just BEEF UP your transmitter?
 
Last edited:
  • Like
Likes TomLund

1. How does a varying DC offset affect a digital signal?

A varying DC offset can introduce errors or distortions in a digital signal, making it difficult to accurately decode or process the signal. This can lead to incorrect data or unreliable results.

2. What causes a varying DC offset in a digital signal?

A varying DC offset can be caused by factors such as imperfect circuitry, electromagnetic interference, or temperature fluctuations. It can also occur naturally in some types of data, such as biological signals.

3. How can a varying DC offset be removed from a digital signal?

A varying DC offset can be removed using digital signal processing techniques, such as high-pass filtering or baseline correction algorithms. These methods can help isolate and remove the offset while preserving the underlying signal.

4. Are there any potential drawbacks to removing a varying DC offset from a digital signal?

While removing a varying DC offset can improve the accuracy and reliability of a digital signal, it can also introduce artifacts or distortions if not done carefully. It is important to carefully select and apply appropriate methods to avoid altering the underlying signal.

5. Is it possible to completely eliminate a varying DC offset from a digital signal?

In most cases, it is not possible to completely eliminate a varying DC offset from a digital signal. However, with careful signal processing techniques, it is possible to minimize the offset and reduce its impact on the accuracy of the signal.

Similar threads

Replies
24
Views
3K
Replies
3
Views
4K
Replies
13
Views
3K
  • Electrical Engineering
Replies
7
Views
14K
Replies
17
Views
25K
  • Electrical Engineering
Replies
6
Views
2K
Replies
9
Views
1K
Replies
11
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
23K
  • DIY Projects
Replies
7
Views
2K
Back
Top