This program was written for a Jet AFS-1000B Air Filtration System.  There are a number of look-alike units for sale that also use IR remotes.  I don't know if the control codes are the same, but it is perhaps likely.  I made good use of my Siglent SDS-1202X-E Digital Storage Oscilloscope to capture the remote control signals and check my program that reproduces them.  The waveforms were captured and recorded with the EasyScopeX software from Siglent.  This project is not rocket science by any means, but it gave me a chance to use my new scope and get back to Arduino programming - crude though it is - I am annoyed at myself for using global variables so freely for one thing.  But this was a quick and dirty project to meet a need - and is quite useful for us.  

The Jet IR remote sends bursts of pulses that are composed of 9 microseconds on and 17 microseconds off cycles.  This is close to the limits of the delayMicroseconds(x) function, but using delayMicroseconds(7) and delayMicroseconds(15) with the loop control and I/O overhead is very close.  

Note that the waveforms captured from the original controller are shown and are inverted in the sense that they were captured looking at the cathode of the IR LED, so low=ON and high=OFF - i.e. the LED is being sunk.  My program is driving the LED (Arduino is capable), so low=OFF and high=ON.  If using an ESP or RPi, the LED would have to be sunk to turn on as it cannot supply the required current.

When the remote ON/OFF button is pressed, the IR LED sends a continuous 9 millisecond burst of these cycles. This is followed by a 4.6 mS delay, then a Slow burst of 21 of these cycles lasting about 550 microseconds, followed by a 1.7 mS delay.  Then there are a series of what I call Fast and Slow pulses that are comprised of  a 21 cycle burst followed by a delay of either 580 microseconds or 1.7 milliseconds.  For On/Off, the sequence is:  Burst, 4.6mS delay, 1 Slow, 8 Fast, 9 Slow, 8 Fast, 7 Slow, and then a delay of 40 mS before the same pattern is repeated for as long as the button is pressed.  Holding the button down and sending the same pattern over and over gives redundancy if there is some problem with receiving the pattern.  After some unknown time after the button is released, this same pattern toggles the air cleaner either on or off.  I have programmed for three repeats of the pattern using the IR LED half of an optical interrupter just to insure that the code is received should a fly go by or some other momentary interruption of the IR beam occurs.  Will modify program to include a sail switch to verify air flow when I am able to find a suitable one and eliminate the three tries and hope for success which does seem to work without any problems.

The program determines the state of the lights in the workshop by using the phototransistor half of an optical interrupter that is taped with black electrical tape onto one of the workshop lights.  The basement and workshop lights are on separate switches.  The idea is that just turning on the basement lights when popping down for a minute or so for a screwdriver, would not be sufficient to activate the air cleaner.  The workshop lights (where the dust generating table saw and such are) must be turned on to activate sending the ON code.  Once on, the program loops approximately once a second to check the light status.  If the light is still on, it just loops.  If the lights are turned off, the program delays for approximately 15 minutes to clear the air following a workshop session.  If the lights were to be turned back on in this period, the air cleaner would just stay on.

If the lights are turned off, and after the 15 minute clearing time has expired, if the lights are not turned back on for a period of time (about 24 hours in this program), then the air cleaner will be turned on for about 15...

Read more »