Monday, July 21, 2014

Visible Light Communication - Updates

While i wait for my new sensors to arrive, here are a few updates that i have done to the existing circuits to get the maximum performance using the TEMT 6000, from the sensor point-of-view. With these upgrades i am able to transmit and receive signals upto 20KHz in frequency, distorted of course but not so distorted that they cannot be recovered. Due to certain limitations of the LM324N the output exhibits excessive slew but the signal gets reproduced.

Transmitter Modifications:






Using one of the papers published by Texas Instruments - Design and Application Guide for High Speed MOSFET Gate Drive Circuits i modified my circuit using the components available with me. The rise time at the mosfet drain when it was switched off was significantly improved. This however introduced some ringing at the drain (parasitic drain oscillations). Now this is wierd and could possibly be because of bad probes. Infact i am not using probes at all. The probes on the Digilent Analog Discovery are just regular connectors. The figure below shows the signal at the drain in orange. Ignore the blue signal it is the output of the op-amp at the receiver side. The blue signal needs to be shifted to the left to align it with the drain signal's off period. The other figure is that of the oscillations at the drain.



Receiver Modifications:

The original sparkfun breakout circuit for the phototransistor can be seen here. This utilizes a 10K resistor across which the signal output is obtained. I did an initial analysis for this which is shown in the figure below. As per the datasheet from Vishay, the collector to emitter capacitance is 16pF. At a light intensity of 100 lux the device outputs a current of 50uA when the supply is 5V. So, assuming these conditions and that if i want the output signal Vo to have atleast a 5V swing i.e. Vo = Vcc, the value of the load resistor needs to be computed. Using the datasheet values this evaluates to 100K as shown below. Alternatively this value along with the capacitance will give a time constant of around 1.6 microseconds thereby restricting the bandwidth of the device. I shall leave the bandwidth calculation to you.

THAT's 1.6 Micro Seconds up there !!

So, now if we apply the same to the default sparkfun board with load resistor of 10K we get a maximum output voltage of 500mV and a time constant of 0.16 1.6 microseconds. Hence both circuits have their pros and cons. After doing some more research on the switching times of phototransistor i came across one app note. This app note suggests several techniques to improve rise and fall times of phototransistor. As my circuit is taking output across the emitter which makes it a common collector configuration, this paper states that for a common collector configuration the miller capacitance is absent and it therefore has fast rise times and slow fall times as demonstrated in my earlier posts. The cascode topology was thus feasible option to implement in my circuit. For more information goto the paper. The modified circuit is shown below. Yes, i have an endless supply of BC547s and 557s :P

In this topology, the phototransistor does not see the load resistor R3, only the input resistance of the common base transistor Q3. The output of the sensor is shown below in orange and the output of the op-amp voltage follower is in blue. The transmitter is connected to a 20 KHz square wave signal source. The op-amps are LM324N in quad package.


The slewing in the output starts around  frequencies higher than 900 Hz. The same can be verified by a simple simulation.




Tuesday, July 8, 2014

Visible Light Communications

My experiments with Visible Light Communication can be found here. Most of the circuit components are selected according to their easy availability in my geographical area without spending too much on shipping (seriously a photodiode from Digikey is 1.5 USD + 60 USD shipping !!! ).

All of this can act as a reference for someone in designing a VLC system or atleast act as a guide on how to evaluate sensors etc. Of course sensors may vary but the workflow would somewhat remain the same...

Stage I
Stage One is all about figuring out if i have the right sensors for the job. A sensor with fast rise and fall times and a fast MOSFET based LED driver. Level: Basic



 Stage II



Visible Light Communication Chronicles Part III

Welcome to Part 3 of my experiments with visible light communication. In this post i will reveal the final circuit that i used for transmitting UART data over the link. Alternatively i also managed a successful Manchester encoded data transmission over the VLC link. The circuits for the transmitter and receiver are shown below. This is the most basic configuration and yields a maximum UART data transmission rate of 2400 Baud (with flicker) and transmission of Manchester encoded data stream at 1200 Baud (no flicker).

The transmitter above consists of a P55NF06 N-Channel MOSFET whose gate is driven by one of the Arduino pins. The data stream is directly connected to the gate. This causes variations in the drain to source current and varies the drain source voltage Vds and hence the intensity of the LED. This circuit just acts as a modulator. VDD is kept at 13 Volts and in the ON state the LED draws approximately 0.87 A. In the next iteration of this circuit i plan to buffer the gate input and also add a gate driver for a faster response. The code on the transmitter side is hown below. This is the Manchester encoded data stream using the Manchester library for Arduino that you can find here. The test code is pretty basic and just transmits a string of data. As a homework you've got to figure out other parts of the code yourself. No freebies !! Same goes for most circuits.


As mentioned in earlier posts the receiver consists of a TEMT 6000 ambient light sensor whose output is coupled through a capacitor into a LM324N based non-inverting comparator. The reference voltage to the comparator is selectable between 2.5V and 3.3V. This determines how accurately the signal is re-constructed. The output of the OP-AMP is then connected to an Arduino pin as input via a buffer. The various signals are shown below. The power rails of the LM324N quad are connected to 5V and GND.


The output of the TEMT 6000 is in orange. This signal is fed into the OP-AMP non-inverting input. Observe the non-linearity due to the fall time. This is the signal for a Manchester encoded data at 1200 baud. The signal in blue color is the output of the comparator. Based on the reference voltage set the timing of the manchester data stream is not affected and can be decoded easily.


In the above case i reduced the drain-source voltage Vds to around 8V thereby reducing the intensity of light. Observe the non-linearity in both the rise and fall-times of the TEMT 6000 sensor. However the comparator was successfully able to re-construct the signal. The code on the receiver side is shown below


The plots for UART data are shown below. The first plot is the UART data at 2400 Baud with Vds = 13V. The second plot is the same data at 2400 Baud but with Vds = 8V. Note the effects of LED brightness on the output of the sensor. The orange plot is the sensor output and the blue plot is the comparator output. The dark black horizontal line is Vref at 2.5V.


Complete loss of timing information in this one

This concludes the initial stages of experimentation for the visible light communication link that i want to build. The primary objective right now is to find a high speed sensor whose rise and fall times are in the nanosecond range. Less than or equal to 100 ns preferably. Once i get my hands on the new sensor i will post the details about it here. Until then, take it easy.....




Friday, July 4, 2014

Visible Light Communication Chronicles Part II


This is the continuation from Part I on my experiments with visible light communication that i posted sometime ago here. I set up a basic transmitter - receiver circuit, a square wave was given as an input to the transmitter and the output of the reciever was monitored. The transmitter consisted of a N-channel power MOSFET - P55NF06 driving a LED and the receiver consisted of the TEMT 6000 ambient light sensor. The square wave signal was generated using an Arduino MEGA and all the I/O signals were monitored using the Digilent Analog Discovery. Why i chose the above mentioned MOSFET ? because i already had it in stock and decided to use it. The light source is a commercially available 10 W high power LED which i got over here.

Transmitter

The overall circuit is shown below. The gate of the MOSFET is driven by one of the arduino pins. The sketch on the arduino is nothing but the blinky sketch. By adjusting the parameters to the delay function i could generate a square wave from 2 KHz (delay(1)) to 0.5 Hz (delay(1000). The gate resistors Rs and Rg were chosen such thar R1 << R2. From the datasheet, the P55NF06 N-channel mosfet has a drain-source voltage of 60V and a max drain current of 50A.The gate threshold voltage is around 2-4V. The LED forward voltage is around 7V. When turned ON the LED draws approximately 0.5 A which is within the spec of the MOSFET. The transmitter is assembled on a breadboard (yeah kind of not a good choice for a circuit like this, specially considering the mosfet parasitics, you never know...)


Receiver:

The receiver consists of the TEMT 6000 breakout board powered via a 3.3 V supply and it's output fed into the analog discovery. 

The distance between the RXR and TXR is 6 cm. I kept it small for initial measurements. All the signals seen on the scope of the analog discovery are shown below.


The above square wave has a time period of  2 seconds, 0.5 Hz. The blue signal is the input signal and the orange signal has been captured at the output of the ambient light sensor. Note that the rise time and fall time of both the signals appear to be instantaeneous. Also note that when the LED is OFF the TEMT sensor output does not drop to zero but goes to around 48 mV which as i mentioned in an earlier post is the interference from the fluorescent light in my room. The interference is visible in the above image when the input signal is 0V.


The input signal here is of 5 Hz. The output of the ambient light sensor follows the input given to the MOSFET. Note the ripple in the output when input goes to 0V.



In this case the input signal is of 50 Hz. Notice that the output signal starts exhibiting some non-linearity when the MOSFET turns OFF. The interference due to the fluorescent light starts getting negligible. More on this a scroll later.


In this case the input signal has a frequency of 500 Hz. If we continue to increase the frequency the signal at the output of the TEMT 6000 almost disappears and all we get is a DC voltage. with very faint signs of the input signal. After this initial test i decided to give the output of the UART to the TXR circuit and observe the output on the TEMT 6000. Here are the output response of the light sensor to different baud rates


300 Baud.


600 Baud. OFF time non-linearity starts kicking in.


2400 Baud.


4800 Baud. A still noticeable signal that can be recovered using some extra circuitry.


9600 Baud. Beyond 9600 you can only imagine what will happen to the signal at the sensor output.

To investigate on the TXR side. I used a 5V drain-source supply and switched the MOSFET using a 500 Hz gate signal. The following image shows the scope output. The output (orange) was taken at the drain hence the signal inversion. It can be seen that when the gate voltage drops to 0V, turning off the mosfet, the output voltage increases non-linearly with time.(based on the mosfet turn-off delay parameters). The delta is 46.7 usec. The datasheet says that the turn-off delay is around 30 nsec for the specified test conditions.



Allrighty that is a lot of information in this post. Part 3 of this series will elaborate on the analysis of the circuit, MOSFET parameters and the above plots.  Until then, take it easy...

Update

I did one more test in which i plotted the TEMT6000 output over the drain-source voltage Vds.


The orange plot is the output of the light sensor and the blue plot is Vds, which is inverted as i connected the scope to the drain as shown in the schematic. The nonlinearity that i had seen before was therefore confirmed to be due to the TEMTP 6000 sensor. I did a couple of tests with varying input frequencies and found that in all cases the time it took for the sensor outout to go from maximum to 0V was 1.4 msec.which means that it can handle signals from 1 Hz to 714 Hz approximately. This was true as seen in the output plots above. Increasing the Vcc for the sensor to 5V does not help. Time to find a better sendor or fix the output of this one. I will probably have to make a new board and change the 10K resistor to a more feasible value.


Wednesday, July 2, 2014

Visible Light Communication Chronicles Part I - The Light

I've begun experimenting with Visible Light Communication recently and hope to design a complete system using it. VLC is a promising means of communication having it's own bunch of pros and cons which i will not detail out here and waste my time and yours. Google It !! Nevertheless it is worth a try to design it and share the data with everyone on this planet.

I purchased a TEMT 6000 ambient light sensor breakout from Sparkfun as my first choice for a light sensor and check out it's performance. From the datasheet it can be seen that it has a fairly decent response in the visible light spectrum from around 400nm to 800 nm with peak sensitivity around 570 nm. I hooked it up to a 3.3V power supply and fed the ouput signal into my scope.



Now let me mention that my room has a flourescent light source - A tubelight. The light from this source is incident on the TEMT 6000 sensor. As i had expected the output on my scope is shown below. The signal was around 100 mV with an average frequency of 100 Hz. This was the "default" lighting of my room, call it the base lighting value. This is the output of the TEMT 6000. When i turned the light OFF and observed the output, the frequency component was not present, just a very small DC voltage resulting from the light from my laptop display.


When i superimposed light from an LED source directly on the sensor the effect of the flourescent light became negligible. The LED that i am using is this one. It is very bright, runs on 12V and draws around 2A of current. My first step is to modulate the LED source using a MOSFET whose gate will be driven by a UART TX pin from an Arduino. I will also find a way to eliminate the low frequency component in the output signal and get a a clean DC signal at the output. Alternatively i might go for a totem pole gate driver for the MOSFET. Once that is done i shall post about it here soon. So stay tuned...

Continue Here