I am a student and I have to design a visible light communications project. The requirements are 20 cm distance between the receiver and transmitter, 20 kbps/s data rate and it must work in an already light environment. I have made a schematic and set it up on a bread board. schematic

It works and I could probably fulfill my requirements, but barely. I'm driving my leds with a 20kHz square wave and you can see the result in the picture. The upper oscillograms are 1V per division and 50us per division(20 kHz) and are taken when I turn the leds towards the receiver. The lower ones are 0.3V per division and 20 ms per devision(50 Hz) and are taken when the leds are turned off so you can see the room lightning interference.

So my questions are:

  1. How could I filter the 50Hz interference better? It is not showing too much when I transmit with the leds, but without them I have a lot of noise.
  2. Should I choose larger caps and smaller resistors for my filters or the other way around? And what should be a good filtering frequency? For now I just played around with available component values and chose a frequency well above 50 Hz.
  3. If you have any design advice I will be very thankful. I am a beginner at electronics so probably have some flaws.
  • \$\begingroup\$ Consider operating input diode in REVERSE BIAS mode with high R pullup - much on web on this. \$\endgroup\$ – Russell McMahon Apr 1 '15 at 2:16
  • \$\begingroup\$ Nicely asked, @elq255. Plenty of info to allow for useful answers. \$\endgroup\$ – Scott Seidman Apr 2 '15 at 12:28
  • \$\begingroup\$ If there is a chance that this circuit will be used under CFL lighting, make sure you test under those conditions as well. I believe the frequencies used with those bulbs may be close to your modulation rate or higher. \$\endgroup\$ – Tut Apr 2 '15 at 13:36

You've got the right basic idea, but I'd change a few things. Yes, you want to high pass filter the received signal, but I don't like capacitively coupling the detector directly.

The first stage should be about handling the raw detector optimally, and providing a low impedance voltage signal out. A little gain will be useful here, but that's not the main point of the first stage.

There are basically two ways to run a photodiode, in leakage mode and in solar cell mode.

In leakage mode, the diode is reverse biased, and the leakage current is proportional to light. This leakage current is quite small, usually just a few µA. The current will be largely independent of the reverse voltage, so any convenient "a few volts" pf reverse bias will usually do. In photocell mode, you keep the diode shorted and measure the current it produces. Either way, the first stage ends up being a transimpedance amp (current in, voltage out).

After that you want to AC couple (high pass filter) and gain up the signal in probably two stages. High pass filtering between stages will lose the 50 Hz noise, and will prevent input offset voltage from getting gained up along with the desired signal.

You want 20 kbits/s, so frequency content up to around 100 kHz. Keep the gain-bandwidth of the opamps in mind and don't try to get too much gain in any one stage. For example, with 10 MHz gain-bandwidth (easy to find), leaving let's say 5x for the feedback to work properly, that means a maximum of 20x if you consider your highest frequency of interest to be 100 kHz. Two 20x gain stages gives you overall 400x, which is probably enough after some gain from the first stage too.

Your encoding scheme will also be critical in making this work well. You want to use encoding that guarantees all content is above some minimum frequency. This allows you to aggressively high pass filter to eliminate lower frequencies, particularly the 50 Hz light flicker and at least its first few harmonics. You could use something like manchester code, or 1/3 2/3 duty cycle, etc. With three poles of high pass filtering set to maybe 5 kHz rolloff, 500 Hz (up to 10th harmonic of light flicker) will be attenuated by 1000. That will still pass a 20-40 kHz pulses nicely.

After that, you apply normal techniques of data slicing to turn the analog pulses signal into a digital pulse train, then decode digitally from there.

  • \$\begingroup\$ I like your idea of Manchester encoding ... in addition to your points, it is better for AC coupling since it is DC balanced. \$\endgroup\$ – Tut Apr 2 '15 at 13:47

I'd consider heavily high-pass filtering the received data so that 50Hz is left way behind. I'm thinking something like a filter that virtually differentiates the data like this: -

enter image description here

Next, make a lower and upper threshold comparator circuit and trigger a d type flip flop on the positive transistion and reset the D type on the negative transition. The result is your data is recovered.

  • \$\begingroup\$ Thanks for the advice. I got the parts I needed and will try to set up the schematic later in the week. \$\endgroup\$ – elq255 Apr 1 '15 at 18:46
  • \$\begingroup\$ Isn't just raising the threshold of the existing comparator easier (though possibly not as bulletproof)? \$\endgroup\$ – Scott Seidman Apr 2 '15 at 12:32
  • \$\begingroup\$ @ScottSeidman You need to trigger on positive red pulse and negative red pulse edges. You can use a comparator with decent hysteresis that does the same but my first time trying this idea used a d type. \$\endgroup\$ – Andy aka Apr 2 '15 at 12:43

I'm not the most qualified to answer this question, I'm sure others will come later on with better information. First two questions. You're sure all of that 50Hz is from the room lighting right? Have you tried covering the light sensor and making sure it's all still there? Just curious stuff like that can come from your supply, or not grounding your scope probes correctly.

Assuming it is all from your sensor what about adding a 50Hz notch filter in there?

Second thought is that you are probably at home using incandescent light bulbs as your ambient source? When you go to school to present, you'll probably have florescent lights, which at least in the US are double the 60Hz frequency if I remember correctly.

  • \$\begingroup\$ I don't remember if this is true or not, but I wonder... Does fluorescent lighting have harmonics that go way above the fundamental frequency? \$\endgroup\$ – Solomon Slow Mar 31 '15 at 21:31
  • \$\begingroup\$ Did not think of checking the schematic with all lights turned off. I will definitely try it out. If this would be from the power supply would a large cap on the input solve the problem? Yes you are right about the lightning, I will keep that in mind and test the schematic in different lightning also. Thanks! \$\endgroup\$ – elq255 Apr 1 '15 at 18:50

If you're having interference from the room lights, I suggest using a COLORED LIGHT for your communication, and either a photodiode sensitive to mainly that color or a gel filter that only passes that color to clean that up.

Also, take a look at the height of the top vs the bottom. The top is much bigger, so you can mess around with the voltage division on the negative side of your output comparator to clean things up. I don't see exactly what VCC is, but try replacing the 100 Ohm resistor with a 2 kOhm - 5 kOhm (or even 2-4 10K's in parallel, if you don't have other resistors in the right range), and see if that helps. In fact, you might consider replacing that resistor with something like a 5K trimpot, and turn it till you get good pass through of your communication and none of the room light artifact.


You can get some information from here: www.openvlc.org
And this paper may help you: "An Open-Source Research Platform for Embedded Visible Light Networking"


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.