Using an Arduino Nano to Customize Any IR Remote Control
AIRWidget is a device that allows you to examine infrared signals from a remote control. You can see, save, analyze, and display what is being transmitted, with more accuracy than you’d get with a digital storage oscilloscope. In this article, I explain how an AIRWidget works and how to build one, so you can modify or add functions to any IR remote control device.
How can I build my own IR signal recorder?
What projects can I build with an Arduino Nano?
How can I customize an IR remote control?About 15 years ago, a group known as the JP1 Forum was formed for the purpose of improving and modifying the performance of infrared remote controls. You might think of them as “benevolent hackers.” They studied the structure of remote control codes, usually stored in separate EEPROM chips at that time, and developed ways to upload changes that would create new control functions, swap functions among buttons, and various other modifications that customized a remote control. An example might be to change a button that rewound program material for 10 seconds so it rewound for 5 minutes.
The manufacturers of remote controls were aware of what the Forum was doing, and chose to ignore them rather than provide any help or encouragement. Since the Forum’s work was intimately involved with various protocols used in different brands and models of remote controls, they needed a way to examine signals to see what was being transmitted, so they could learn how to change things. One of the founding members of the JP1 forum, Kevin Timmerman, gave them just what they needed. He invented a tool for looking at an IR signal as it was being transmitted, saving it, analyzing it, and displaying it with precise details on the screen of a Windows PC; this provided even more information and accuracy than an expensive, digital storage oscilloscope.
There were two parts to Kevin’s invention: a small infrared signal receiver, which he called an “IR Widget,” and the Windows PC program used with it, which he called “IRScope.” The IR Widget collected all the data—particularly the timing of starts and stops of carrier modulation—and sent it to the PC for analysis and display. All the details of Widget construction and the Windows software program to go with it were published for anyone to use freely. However, the Widget was designed around a PIC microprocessor, and that was a deal-breaker. The complications and expense involved in obtaining a printed circuit board, soldering tiny surface-mount parts, and loading firmware into the PIC chip discouraged semi-technical hobbyists and experimenters from trying to build a Widget. Up until now, the only way for them to enjoy the Widget technology has been to fork over a tidy sum and buy an IR Widget.
Recently the Widget was redesigned to eliminate that problem and make it easy for anyone to use this technology. The new design is called an “AIRWidget” (short for Arduino IR Widget) because the main component is an Arduino Nano microcontroller board (Figure 1). You may think the Nano is over-qualified for this application, since only three of its 30 pins are used. The Nano was chosen because it is the smallest Arduino board made and costs less than $10. Yet it has all the features and speed necessary to do everything the PIC did in the original design. And its free support software and built-in bootloader make it easy to load the program (called a “sketch”) that gives it the brain of a Widget.
HOW AIRWIDGET WORKS
Here’s a somewhat over-simplified description of the way AIRWidget works. Assuming the Nano has its sketch uploaded and running, and the PC has its program installed and running, a mouse click on the PC’s CAPTURE button by the user alerts AIRWidget to begin looking for IR carrier pulses. You must then aim your remote at the AIRWidget and trigger a signal. If you wait longer than 5 seconds to send the signal, you’ll be flagged with an error. If that happens, just click on the error message to clear it, and start over.
The LED on the AIRWidget will flash to show that infrared data is being received. AIRWidget starts counting with an 8-bit counter the number of carrier pulses it detects. By just letting the counter roll-over and never wasting time to reset it, no carrier pulses are missed, but the PC recognizes roll-overs and keeps track of the actual total count.
Throughout the capture period, at precise, 100µs intervals, AIRWidget transmits to the PC over its USB connection a single byte containing the least significant 8 bits of the counter. At the end of the specified Capture Duration, the PC sends a signal to the AIRWidget to stop looking. That leaves the PC with a string of data from which it can calculate the carrier frequency, the start and stop times of each carrier burst, and the start and stop times of each pause between bursts. The PC then searches through its data files to identify the signal protocol and coding. It also does all the calculations necessary to produce the waveform display.
When the IRScope program in your PC is running, a window called the “Operating Window” (Figure 2) appears which has all the setup options and operating controls that determine how a signal is to be captured and what you can do with it. The large area in the center is initially blank, and as you capture signals they are numbered sequentially and listed there.
At the end of the Capture Duration the waveform window (Figure 3) appears, showing a picture of the demodulated signal drawn to the precise scale of 20µs per pixel. The first line is a thumbnail display of the entire capture. Numbers down the left side are elapsed time in microseconds since start of capture. Numbers beneath the baseline are durations in µs of ON and OFF portions of the waveform, and numbers above the baseline are the number of carrier cycles within ON bursts.
You can manipulate records in many ways. You can see an unfolded image of the entire message (without a change of scale), by dragging the right edge of the window with your mouse. You can save and recall previous records, export data in various formats, and select the recording time necessary to capture your signal or your macro (a group of signals), from 0.5 to 15 seconds.
Additional waveform displays are stacked on top of this one, without limit. Clicking on any part of a capture line in Figure 2 brings its waveform to the top of the stack in Figure 3, for review. Clicking anywhere on a waveform pops up an “IR Scope Config” box, which allows you to change the scale of the waveform to expand or shrink it over a range of 1-5,000µs per pixel.
BUILDING AN AIRWIDGET
The first step in building an AIRWidget is to gather the seven components, some of which may be found in your junk box. It is not necessary to use a genuine Arduino Nano microcontroller board with an FTDI UART. The Nano is an open design, and the AIRWidget firmware works equally well with less expensive clone boards that use the Chinese CH340 UART, or those that use a CP2102 UART made by Silicon Labs.The firmware may also work with clone boards that use a CP2102 UART made by Silicon Labs. Clone boards often sell for less than $10, and are available from Amazon, eBay, and some U.S. sources. Many are sold with both 15-pin headers installed and soldered, ready for plugging into a solderless breadboard. This is the type recommended. It may cost a little more, but you can be sure the headers are installed straight and vertical, so they plug into the breadboard easily. Be sure you have a Mini-USB Cable (not Micro-USB).
The QSE159 optical sensor is a 3-pin IC about the size of a TO92 transistor. It has a fast, side-looking, photo diode, a high-gain amplifier, a bandpass filter (for the carrier frequency), and an output driver, all in an infrared-transparent, daylight-filtering enclosure. It is available from DigiKey, Mouser, and other sources for less than $2. Do not substitute any other type of sensor. The other three items needed are an axial lead LED, diffused or clear, white or any color, and a couple of 0.25W or 0.5W resistors, 1kΩ and 4.7kΩ.
The fastest and simplest way to build an AIRWidget is to use a solderless breadboard. No soldering is required, and you can unplug the Nano and use it for something else whenever you want. Solderless breadboards come in three sizes: full size, half size, and mini (respectively 6”, 3”, and 2” long). Figure 4 shows the AIRWidget built on a half size breadboard. The four jumper wires (shown blue) can be made from solid wire, either insulated or bare #20 or #22 gage, or you can buy one of the jumper wire kits made for this purpose.
If you want something more compact, Figure 5 shows the AIRWidget built on a mini-size breadboard. Note that two of the jumper wires lie beneath the Nano. There are many small plastic boxes with covers sold online by Amazon and eBay, often in bunches of four to six boxes. The mini breadboard will fit inside one with inside dimensions of at least 1.5” x 2.0” x 0.8”. You will have to improvise openings for the USB cable, the optical sensor, and the LED.
Three software packages are required to use an AIRWidget, all available for free from various sources. Start by searching for, and downloading, a program called Arduino IDE 1.8.13. (Note: Do not use IDE version 2.) This is a sort of “do everything” software tool. Although it can be used to create, edit, debug, compile, and upload programs to an Arduino board, you won’t do most of that. You will use this program strictly to upload into the Nano, compiling as it does so, the program (or “sketch” as Arduino calls it) Nano needs to perform as an AIRWidget. In addition to the IDE, you must download the driver for the UART on the Nano. If it is a Chinese CH340 UART just search online for “ch341 driver.”
Next, go to the JP1 Forum’s JP1 Remotes webpage  to download a software bundle for IRScope v3.05, from which you can extract these six files:
- DecodeIR.dll Application extension
- DecodeIR.html Chrome HTML Document
- ExchangeIR.dll Application extension
- IRScope.exe Application
- MakeHex.dll Application extension
- ReadMe.txt Text Document
Installing the PC software consists simply of placing items 1 through 4 in the same folder (any folder of your choice). Items 5 and 6 are not essential to operation of the AIRWidget, and can be discarded if you don’t want to keep them. However, Item 5 is a good summary of the major features of IRScope, and also provides some useful information on drivers for the AIRWidget and how to install them. Likewise, Item 6 is an excellent reference on how protocols are decoded, and provides specifications for more than 100 of the most common infrared remote-control protocols. You might want to make a shortcut to Item 4, since that’s where you will go to start every session.
The last item we need is the sketch for the Nano, AIRWidget v1.00. You can download it from Circuit Cellar‘s Article Materials and Resources webpage , which has some additional instructions. The actual name of the sketch is AIRWidget.ino. Before you can upload, it you must place it in a folder entitled just “AIRWidget,” without the “.ino” extension, If you try to upload the .ino file, the IDE will remind you it needs to be in a folder. It may even offer to create the folder for you.
The first time you plug in your AIRWidget, Windows’ New Hardware Wizard will prompt you through the driver installation process in two phases. First, a driver ls installed for the USB Serial Converter function of AIRWidget. Second, a driver is installed for the USB Serial Port function of the AIRWidget. Windows may do it all automatically.
In case of problems, you can verify whether your driver installation is working by opening Device Manager and expanding both the Ports (COM & LPT) list and the Universal Serial Bus controllers list (Figure 6). Watch the lists as you plug in the AIRWidget. A new entry called “USB Serial Port (COMx)” (where “X” is the virtual COM port number assigned by Windows), should pop up. At the same time, a new entry called “USB Serial Converter” should pop up at the end of the Universal Serial Bus controllers list.
The top portion of the IDE display (Figure 7) should be checked for a few critical items. Ignore those first nine lines of code. They are just there to help you if you’re going to type in a sketch. Click on “Tools” to drop down a menu, and check the following selections:
- Board: “Arduino Nano.”
- Processor: “ATmega328P” or “ATmega328P (Old Bootloader)” Try one and if the software does not upload try the other.
- Port: “COMx.”
- Programmer: “ArduinoISP.”
Now go to FILE > OPEN, navigate to the downloaded sketch in its new folder, and select it. To upload the file, click on the right-pointing arrow directly below the word “Edit.” The green status bar at the bottom will keep you advised of what’s happening. First it will say “Compiling sketch,” then after a while it will say “Uploading,” and finally it will say “Done uploading.”
When you see that last message you are finished installing your AIRWidget. You can close the Arduino IDE. You do not need it anymore, unless you have problems, possibly with COM ports. The way Windows assigns virtual COM port numbers when you plug different devices into a USB connector can be challenging.
When you’re through using AIRWidget, just unplug it and store it away. When you want to use it again, open the IRScope program on your PC and power-up the AIRWidget by plugging it into the same PC connector that you used before.
For more details about the AIRWidget and how to use it, refer to “AIRWidget & IRScope Operating Instructions, Rev.1, January 20, 2023” .
 JP1 Forum’s J1 Remotes webpage, where you download a software bundle for IRScope v3.05:
 AIRWidget & IRScope Operating Instructions Rev. 1, January 20, 2023: http://www.hifi-remote.com/forums/dload.php?action=file&file_id=26682
Arduino | www.arduino.cc
PUBLISHED IN CIRCUIT CELLAR MAGAZINE • JULY 2023 #396 – Get a PDF of the issueSponsor this Article
Tommy Tyler is a design engineer with more than 40 years of experience in industrial instrumentation, medical electronics, consumer electronics, and robotics products, earning 17 patents in these fields. In retirement he still pursues his hobby of technical writing, for which he does all his own illustrations. Tommy's address is firstname.lastname@example.org (Include "C-B-G" in email subject).