Backdoor uPWM Hack on Photon for Infrared signals using UART

We have finally found an easy way to get Hardware PWM for Infrared signals using the Photon, using the UART hack below.

It may also be of use to others looking for faster PWM and variable duty cycles at 10% intervals.

The full source code and IR driver circuit are availabe via the link above or via

PS: This should also work on Spark & other fast MCUs, if needed. (untested)




I tried out this circuit using the IR components I ordered from your website.
Loaded up the Photon with a modified version of the firmware which would allow me to turn my TV on and off by calling a Particle cloud function passing the command name (ON or OFF) as the parameter.

With everything hooked up and flashed I pointed the IR emitter toward the TV and send a post request to the Particle cloud API using the very useful Postman tool. Sure enough the TV responded, almost instantly too. I had just turned my TV on over the internet :smile:

I used your AnalysIR software (which is excellent by the way) to decode the signals from my TV remote and generate the raw data necessary to paste into the Photon firmware. This decoding was using the Photon too, over wifi, which is pretty awesome :smile:



Any idea if this would work to control a computers fan speed control PWM at 25khz ?

Thank you,

yes, it could work…output is inverted

or by searching the forum, you will find hardware PWM which would be the standard/preferred method.

Why 25kHz?

Did you consider analogWrite (at circa 500Hz variable duty cycle)?

see app note on fan pwm

1 Like