Go Down

Topic: Best way to pulse LED at certain frequency? (Read 4283 times) previous topic - next topic


Hello Arduino Forum!

I am currently working on a project involving an LED light source and a phototransistor.
I would now like to reduce the impact of ambient light on this setup by pulsing the LED at a certain frequency (40KHz for example) and then use a bandpass filter on the phototransistor to filter out any ambient light noise that does not occur at this frequency.

What would be the best way to pulse the LEDs at such a high frequency?
Directly through the Arduino or better using some timer?

Thank you very much for the input, being still very new to the electronics world I appreciate any help!

Have a great day!


Arduino as 3 timers inside, you can use them to generate that pulse, that pulse is called PWM.


I would suggest to save yourself a lot of effort and grief to utilize one of the standard IR remote control receiver chips. This handles the filtering, amplification and reflection discrimination. Then you only have to deal with generating a 38khz clocking source to wire to a IR emitter LED using arduino timer.



Thank you very much Senso and retrolefty for the advice, it is much appreciated! :)


I have code that runs an IR LED at 56kHz modulation to act as a remote control for a scientific atlanta set top box.  you should be able to get some ideas from it.  If you have any questions about the code, feel free to ask.  the link to the code is at the bottom of the page: http://www.controllerprojects.com/2011/03/31/automatic-audiovideo-channel-checker-part-3-%e2%80%93-ir-transmitter-circuit-take-2/

The code specifically runs it at 56kHz.  You can try varying the port accesses and NOPs to get it fine tuned.  If you have issues figuring out the needed delayMicroseconds() and number of NOPs to get the frequency you want, contact me and i can help figure it out... i got the 56kHz just by plaing around with the values and watching what changes i got on an oscilloscope.



I have just posted a blog to adjust the frequency on pulsing PWM on the Arduino UNO.

This lets the user pulse any where between 15Hz to 1MHz.


Go Up