I am unsure if this is possible to convert the signal into a cleaner digital one like (in picture 2).
Some context on my project: Using Visible-light to transmit and receive lR protocol (NEC) signals.
I have managed to transmit the IR protocol signal using a 3W white LED and received it on a receiver circuit. Since I am using a photodiode instead of a phototransistor, the received pulses as seen in (picture 1) are not made up of digital signals but more sinusoid-like oscillations. I am aware that IR receiver modules come with a built-in demodulator to clean-up the signals like in (Picture 1) to a digital signal like in (Picture 2).
Just wondering if this demodulation can be done by using Arduino Analog input, and if so, How would that process be like ?
In my mind I have an idea of using the internal comparator on some of the Analog pins to do this.
Any thoughts or suggestions ?
I think that you missed that IR transmission is based on a carrier frequency of about 38kHz. That signal is turned on and off for a certain time according to the transmitted data and protocol. IR receivers include a filter for the carrier frequency. Either use such a receiver or implement your own filter/decoder for the carrier frequency.
Hi and thanks for the quick reply.
Yes, I have overlooked that key feature on an IR receiver.
I suppose that building my own filter/decoder circuit before the Arduino input would be the best step.
Do you think this document link below is a good place to start ?
Yes. My current circuit already has a transimpedance amplifier and automatic gain control section.
It is however, lacking a bandpass filter, automatic threshold control, Integrator and Schmitt trigger as seen in the document I attached.
Which one of these can be implemented in software as mentioned, if I may ask ?
One option, on an AVR processor like the UNO, Nano, or Mega, is to use the Input Capture feature to detect the time between each rising edge. A value around 421 clock ticks (38 kHz) will be ON, any much smaller number will be noise, and any larger number(typically MUCH larger) will be an OFF time.
If you need intervals longer than 4 milliseconds you can use a pre-scale of 8 to get a slower clock or use an overflow counter to extend the timer by another 8 or 16 bits.