Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Removing a Varying DC Offset from a Digital Signal

  1. Feb 3, 2016 #1
    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,
     
  2. jcsd
  3. Feb 3, 2016 #2

    berkeman

    User Avatar

    Staff: Mentor

    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:
     
  4. Feb 3, 2016 #3

    berkeman

    User Avatar

    Staff: Mentor

    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:
     
  5. Feb 3, 2016 #4

    sophiecentaur

    User Avatar
    Science Advisor
    Gold Member

    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: Feb 4, 2016
  6. Feb 3, 2016 #5

    Averagesupernova

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  7. Feb 3, 2016 #6

    berkeman

    User Avatar

    Staff: Mentor

    I'd recommend using IR TV remote control technology as your guide. It's very low cost, and a proven technology. :smile:
     
  8. Feb 4, 2016 #7

    sophiecentaur

    User Avatar
    Science Advisor
    Gold Member

    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.
     
  9. Feb 10, 2016 #8
    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
     
  10. Feb 10, 2016 #9

    sophiecentaur

    User Avatar
    Science Advisor
    Gold Member

    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: Feb 10, 2016
  11. Feb 10, 2016 #10

    Svein

    User Avatar
    Science Advisor

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Removing a Varying DC Offset from a Digital Signal
  1. DC Offset (Replies: 2)

  2. DC offset (Replies: 7)

Loading...