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 minutes and then off again.  This periodic cleaning will continue until the workshop lights are once again turned on.  

The Arduino and IR LED are placed at the outlet where the air cleaner is plugged in with an unobstructed path to the back of the unit.  A length of two-conductor wire connects the phototransistor to the Arduino.  In this program I am using the LED_BUILTIN output to control the IR LED through a 220 ohm pullup.  This let me see the otherwise invisible output occurring.  I also used the serial monitor to check the light levels from the phototransistor.  When secured with black electrical tape, the ADC (using A2) goes from near zero with the light off to nearly 1024 with it on, so the threshold was arbitrarily set at 512.

Postscript:

I was just asked about the Speed and Time patterns for someone that had lost their controller and wanted to clone one.  Another query was to hook up a dust sensor and vary the speed.  I have just updated this project to include the additional captured patterns.  These and other options are "left as an exercise for the student" as my old textbooks were so fond of saying.  (As students, we felt this meant that the author couldn't get it worked out.)  I am confident that any readers can manage with the information given here.

The sequences are as follows, with the Burst, delays, Slow and Fast as described in the program docs:

Speed:  Burst, 4.6mS delay, 1 Slow, 8 Fast, 10 Slow, 8 Fast, 5 Slow, 40mS delay

Time:  Burst, 4.6mS delay, 1 Slow, 8 Fast, 9 Slow, 1 Fast, 1 Slow, 6 Fast, 1 Slow, 1 Fast, 5 Slow, 40mS delay

On/Off:  Burst, 4.6mS delay, 1 Slow, 8 Fast, 9 Slow, 8 Fast, 7 Slow, 40 mS delay

These are all toggles that simply step through the available choices with no knowledge of where you are in the list.  To set a particular Speed or Time, one would need to use additional phototransistors to monitor the LEDs on the back of the filter to know where you were.