Hardware wiring for IR LED & Detector
#1
Posted 05 November 2010 - 08:19 PM
#2
Posted 05 November 2010 - 08:28 PM
Could you post the schematic and part numbers? You probably cannot drive IR LED directly from Netduino pin, depending on its current requirement, which can be rather high (100 mA is not uncommon).What should I look up or compare to figure out how the schematic would translate?
#3
Posted 05 November 2010 - 08:50 PM
Could you post the schematic and part numbers? You probably cannot drive IR LED directly from Netduino pin, depending on its current requirement, which can be rather high (100 mA is not uncommon).
Here's a link for the schematics:
http://www.bing.com/...files/gif_1.gif
The IR Emitters use a 30kOhm resistor between the output pin and VSS. The IR Detectors use a 220 Ohm resistor.
- Falcon likes this
#4
Posted 05 November 2010 - 09:34 PM
Hm, those 30 kΩ resistors are a little bit confusing, as they result in 0.16 mA current (assuming 5V power supply) which is IMHO way too low and they are not even listed in the component list. So I would rather show the adjustment calculation for 220 Ω resistor (bottom left "IR Emitter Left" on the picture): Current I = U/R = (5 - 1.4) [V] / 220 [Ω] = ~16 mA, for Netduino resistor value is R = U/I = (3.3 - 1.4) [V] / 0.015 [A] = ~126 Ω.The IR Emitters use a 30kOhm resistor between the output pin and VSS. The IR Detectors use a 220 Ohm resistor.
The receiver (PNA4601M) can be used as depicted (powered from 5V rail), Netduino inputs are 5V tolerant.
Edit: Fixed the formulas to include IR LED voltage drop (~1.4 V, depending on the LED type).
#5
Posted 05 November 2010 - 09:47 PM
#6
Posted 05 November 2010 - 10:47 PM
I forgot one important thing: The IR receiver requires the signal to be modulated on 38 kHz carrier frequency - this means you have to switch the IR LED on and off very fast (at 38 kHz) for certain amount of time to produce a pulse on the receiver side (see the modulation picture). AFAIK this is not easily achievable in the current firmware implementation.
Thanks CW2 - this is hugely helpful. I'm not super picky about when the IR LEDs are turned on, in fact it may be fine to run them constantly for this project so long as it doesn't kill battery life or burn out the LED (not sure about either of those). Would a separate option be to build a circuit that could modulate the LED at 38kHz constantly? Any thoughts or direction are greatly appreciated and thank you for the previous explanations!
#7
Posted 06 November 2010 - 09:43 AM
In this case, you can use PWM.SetPulse(period, duration) method. The parameters are in microseconds, for 38 kHz and 50% duty cycle period = (1/38000) [s] = 26 [µs] and duration = 26/2 = 13 [µs]. So, if you call SetPulse(26, 13) the IR LED starts blinking at ~38 kHz, SetPulse(0, 0) turns it off. To produce pulses on the receiver side, put a delay between those two calls, i.e. Thread.Sleep(...). If you are interested in details, there is a nice tutorial on PWM.I'm not super picky about when the IR LEDs are turned on, in fact it may be fine to run them constantly for this project so long as it doesn't kill battery life or burn out the LED
Note: The article I referenced in the previous post discussed the problem with PWM that required very precise µs-resolution pulses - this is problematic, because there is no µs-delay function - both Thread.Sleep() and timers have millisecond resolution.
- James likes this
#8
Posted 25 January 2011 - 07:49 PM
What do you think of this idea to achieve IR modulation with the current version of the .Net Micro Framework on the netduino?
#1: use SetPulse() to drive an IR LED at the desired frequency, say 38.4kHz.
#2: configure SPI to clock data out at 38.4 kHz as well.
#3: use the SPI MOSI pin to drive a (fast) transistor to ground the IR LED circuit according to the bit stream sent through SPI.Write() (0=ground, 1=don't ground).
I have not tried it yet, but...because the IR LED and SPI run that the same frequency, this hack should work to achieve the desired bit stream modulation.
Thoughts?
Cheers,
-Fabien.
#9
Posted 25 January 2011 - 08:42 PM
IMHO this is a good idea. One question, though: why SPI at 38.4 kHz? The carrier modulation is done by PWM, so you'd need to configure SPI clock according to the desired waveform (i.e. pulse durations). However, the SPI clock rate is based on the microcontroller's Main Clock frequency (48 MHz) divided by a value from 1 to 255, which gives min. speed ~188 kHz (~5 µs), so it may require rather long bit stream to produce millisecond pulses, depending on what exactly you need (?)What do you think of this idea to achieve IR modulation with the current version of the .Net Micro Framework on the netduino?
#1: use SetPulse() to drive an IR LED at the desired frequency, say 38.4kHz.
#2: configure SPI to clock data out at 38.4 kHz as well.
#3: use the SPI MOSI pin to drive a (fast) transistor to ground the IR LED circuit according to the bit stream sent trough SPI.Write() (0=ground, 1=don't ground).
ad #3) Yep, with the first transistor needed to provide enough current for the IR LED, there will be in fact a TTL AND gate. Similar result can be achieved for example with a [constant-current] LED driver IC with Enable input wired to MOSI.
#10
Posted 25 January 2011 - 09:03 PM
One question, though: why SPI at 38.4 kHz?
SPI.Configuration() takes a Clock_RateKHz parameter in kHz, so it seemed perfect for matching the frequency of the IR LED carrier set with SetPulse().
I didn't realize that the max CPU clock divisor for SPI was 255 though. Hmmm...
The idea was to build a TV / Camera remote controller using this method.
#11
Posted 31 January 2011 - 10:05 AM
#12
Posted 10 February 2011 - 06:03 AM
#13
Posted 15 February 2011 - 04:26 PM
#14
Posted 11 November 2012 - 08:32 PM
I figured it out btw. Not with the SPI or PWN, but with the 555 timer. If anyone is still interested in the solution (schedule etc), i'd be happy to help (just pm me).
Right now i have the IR communincation working on COM1 (sending and receiving), and will use it to create the Netduino Laser Game
I know this post was over a year ago, but if you could tell me how to modulated using the 555 at 38Khz it would help me out. I'm trying to read an IR Sensor that detects at 38Khz and this could be the solution. Thanks
#15
Posted 12 November 2012 - 06:35 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users