Let's Make Robots!

PWM at 38KHZ with Arduino

Hi guys.

I'm trying to modulate my IR led at 38KHz so that the receiver will pick up the signal. I've googled around and all i've seen is some people modding the wiring.c file, but this way the only get a limited number of possible frequencies. Some other guys say that you have to use a 555 cause you can't do that with arduino. Then i've found this: http://www.arduino.cc/playground/Code/Timer1 and i thought it could work, since it gives you the pwm command which also lets you specify the period....but it doesn't work, my IR receiver doesn't pick it. Maybe i just specified a wrong period? (i wrote 26, which is 26 micro seconds)

 Did i get something wrong? Do you know another method to achieve custom frequencies on PWM?

this is the circuit (not really needed though) 

thank you! Immagine_0.png

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Yes the code goes direct into your program IDE - simple and sweet......... 

I used the same code here in my PWM Luxeon light. (i had to use it because the normal servo PWM was too slow for me)

 

When you use PWM to drive your IR LEDs make sure it is 50% duty cycle. Serial data is then transmitted by turning this modulated pulse on and off (high/low). The high and low periods cannot be too fast as the receiver may need to read several 38KHz pulses before a high signal is recognised so this only works for low baud rates (2400 or lower).
Thanks OddBot. I'll try to keep the baud rate low.