02-13-2014 12:42 AM - edited 02-13-2014 12:47 AM
Hi,
I hope some one can share your knowledge on how to demodulate the infrared signal using LabVIEW.
I modulate the infrared (IR) light using the counter pulse generation with frequency of 500Hz and 50% duty cycle. A photodiode is used to acquire the PPG signal based on the IR modulation. And now, how am I able to demodulate the IR signal.
Thank you.
02-13-2014 08:11 AM
There are too many unknowns for us to give you a good answer.
Knowns:
Unknowns:
Possible solutions, depending upon the answers to the above:
Please give us more information so we can help you better.
02-16-2014 08:19 PM - edited 02-16-2014 08:20 PM
Dear DFGray,
Sorry for my late reply.
To answer the unknowns:
1. The photodetector will take the data at on and off times of the LED
2. The typical response time of the detector is 190ns which is approximately 5.26MHz. But how this may affect the LED modulation frequency?
3. I have not done any signal processing before the signal is received by the LabVIEW. I wish to do it in the LabVIEW as I want to minimize the analogue circuit at the front-end system.
According to your first possible solution, how can the LabVIEW know how to separate the alternating light and dark sections? My guess is it must have to do with the swicth timing of the LED? But how can I do this?
Thank you.
Anida
02-17-2014 02:37 AM
I have not done any signal processing before the signal is received by the LabVIEW. I wish to do it in the LabVIEW as I want to minimize the analogue circuit at the front-end system.
500Hz and minimal front-end.... maybe a a resistor and the photodiode together with the (biased) mic input of the soundcard will do it 😄
Usually, if you want to transport information with ligth , you use some kind of encoding. just light on/off is prone to errors (other lightsources/flashes)
the most simple way is a amplitude modulation (ASK) of your 500Hz signal (ether by pulse length of pulse amplitude)
the decoder simply filter the 500Hz signal , and detect the changes of the amplitude
here I played around wiht this approach
http://forums.ni.com/t5/Dynamic-Signal-Acquisition/ask-demodulation/m-p/2659295#M3198
But take a look at FSK too 😉
02-17-2014
08:34 AM
- last edited on
04-26-2025
10:59 PM
by
Content Cleaner
Answering question 2, if your detector has response time similar to the modulation time of the LED, you can significantly distort your signal, making accurate measurements difficult. This is not the case here, so there should be no issue.
We are still missing one very important piece of information. How are you amplifying and digitizing the output of the photodiode? Henrik mentioned the microphone input of your computer, since it includes a fair amount of amplification. This may not be enough. You may need to add a transimpedance amplifier. Watch your frequency characteristics, if you do.
Once you get the photodiode signal properly amplified, you need to digitize it so the computer can do something with the signal. The sound inputs (both line and microphone) can be used for this, provided you properly amplify the photodiode output. Some sort of data acquisition device may make this easier. Examples include an Arduino using the LabVIEW interface VIs, a myDAQ, or plug-in DAQ card. I have done this sort of thing successfully using everything from a photodarlington (photodiode with darlington transitor pair amplifier integrated into the package) and an Arduino to a commercial transimpedance amplifier and a high-end DAQ card. Your financial constraints will determine how you do it. It was easier with the DAQ card, since the DAQ card can both drive the LED and read the photodiode output in a highly synchronized manner. But you can get the same results using the sound inputs of your computer and driving one channel with the photodiode output and the other with the LED modulation signal. Since the sound inputs are synchronized, this allows you do process the data in a more intelligent fashion (such as using a software lock-in amplifier).
To more directly answer your final question, you have several options, depending upon how you take the data.
If you only have the digitized output of the photodiode:
If you have digitized both the photodiode output and the LED driver, you can use the software lock-in mentioned above or roll your own lock-in. Learning about lock-in amplifiers is a good thing, but beyond the scope of a simple discussion forum post. You can find lots of information online.
One final comment, if you live in a portion of the world where the power line frequency is 50Hz, you probably want to change your LED modulation frequency to something other than 500Hz. 500Hz is an overtone of 50Hz and may get synchronous noise from fluorescent lights and power lines. A frequency which is not a multiple of 50Hz would be better.
02-17-2014 08:49 PM
Hi Henrik and DFGray! I forgot to mention in my previous post, I use a transimpedance amplifier to convert the current of the photodiode into a voltage. And then, the output from the transimpedance amplifier is fed into the plug-in DAQ-card (USB NI 6356). That is how the photodiode signal is being digitized. I have also changed the frequency of the LED from 500Hz to 455Hz as to avoid the noise from fluorescent lights and power lines. I also cover the LED as well as the photodiode during the measurement.
DFGray, thanks for your suggestions, however, based on your recommendations, I'm not sure which method I should apply. You did mention about the software lock-in and it can be applied if i have digitized the photodiode and the led driver.
1. Care to share what do you mean by digitized led driver? In my case, I drive the on and off of the LED via plug-in DAQ card and fed it into the LED driver circuit.
2. I studied a bit about software lock-in from the NI example program here. I understand, that this topic is not covered here but I just want a clarification to confirm my understanding on this. I notice that there are two waveforms; one for noisy-signal with reference and another one is the lock-in signal. So in my case, the reference signal is the modulation frequency of LED, the noisy signal is the modulated digitized photodiode signal and the lock-in signal is the clean digitized photodiode signal. Am I right?
I try to get a clear picture on the photodiode signal. For that reason, I'm trying to get the PPG (photoplethysmography) signal from my thumb. Now, if the LED is on and off, the photodiode signal will acquire the signal when the light is on as well as during off.
3. So, If I want to use you first suggestion (using decimate array and you also mentioned that the LED and dectector must be synchronized) Then, how can I know whether the LED and detector is synchronized or not? My plug-in DAQ card has 8 simultaneosly sampling channels. So, can I just assume that both are already synchronized? Or does it mean I have to put the LabVIEW codings (acquire signal and counter output) within the same while loop?
Thank you
02-18-2014 08:08 AM
1. Care to share what do you mean by digitized led driver? In my case, I drive the on and off of the LED via plug-in DAQ card and fed it into the LED driver circuit.
To digitize the LED driver, you need to wire it to one of your analog inputs as well as wiring it into the LED driver circuit. You have a relatively high end DAQ board, so you do have the inputs. Wire the output of the photodiode amplifer to one input and the LED driver signal to another. Note that your DAQ board does not simultaneously sample the channels, but scans them. This results in a small, but constant, timing difference between the two signals. This is important if you implement the phase locked loop method, as it effects your phase.
...I notice that there are two waveforms; one for noisy-signal with reference and another one is the lock-in signal. So in my case, the reference signal is the modulation frequency of LED, the noisy signal is the modulated digitized photodiode signal and the lock-in signal is the clean digitized photodiode signal. Am I right?
Yes. Your photodiode signal is your noisy signal. The digitized LED driver signal is your reference (with a slight phase offset, as mentioned above).
I try to get a clear picture on the photodiode signal. For that reason, I'm trying to get the PPG (photoplethysmography) signal from my thumb. Now, if the LED is on and off, the photodiode signal will acquire the signal when the light is on as well as during off.
You may be running into the awesome scattering properties of human tissue. Tissue is very transparent but has lots of scattering centers. As a result, light can bounce around inside it for a long time. It has been awhile (20yrs) since I did anything like this, but I think the time constants are on the order of milliseconds. At 500Hz modulation rate, you are pushing this limit. Try a very slow modulation, about 1Hz, and look at the rise and fall times of the edges to see if this is the issue. You should also do the test without a thumb to make sure everything is working OK in that case.
3. So, If I want to use you first suggestion (using decimate array and you also mentioned that the LED and dectector must be synchronized) Then, how can I know whether the LED and detector is synchronized or not? My plug-in DAQ card has 8 simultaneosly sampling channels. So, can I just assume that both are already synchronized? Or does it mean I have to put the LabVIEW codings (acquire signal and counter output) within the same while loop?
To use my first suggestion, your LED driver signal and the acquisition must be synchronized to the same frequency and be in phase. You can do that with your DAQ card, although I am not the one to give you specifics, since I have not done this in awhile. Try the DAQ Assistant first, then search for synchronized input and output examples, if that fails. Or search our DAQ forums for the answer. This is a common use case.
That said, I would recommend the lock-in approach. It will give you much better signal-to-noise. And when you go to two LEDs, you will be able to relatively easily do this by modulating two LEDs at different frequencies, then detecting them both with the same photodiode, but using two software lock-ins to get the two signals (different frequencies) out of the same photodiode signal.
Good luck!