Simple Infrared PWM on Arduino, Part 3 – Hex IR Signals
In Part 1 of this series, we demonstrated how to send signals using soft or Simple Infrared PWM on Arduino. In our Part 2 post we looked at sending RAW IR signals – specifically a RAW NEC signal and a longer RAW Mitsubishi Air Conditioner signal using soft PWM. We have since improved the PWM method shown in Part 1 Part 2 to provide better performance and improve portability. In this Part 3, we will take the signals from Part 2 and show how to send them using their binary (or Hex) representation, which can save lots of SRAM in many projects, particularly when dealing with longer AC signals.
The image above shows the 2 signals we will be using, from Part 2. The first is an NEC 32 bit signal from an LG TV, and includes one NEC repeat header. The second is a signal from a Mitsubishi Air Conditioner with 88 bits of data. In this post, we will provide the source code showing how to send these signals using their Hex representation and for comparison we also include the less efficient methods for sending them as RAW encoded signals. Please note that the easiest way to get the Hex representation of a signal is by using a tool like AnalysIR (or libraries like IRremote IRLib which may work for a limited set of signals up to 32 bits, which unfortunately excludes most AC signals)
The reason for publishing this series includes:
- See the rationale provided in Part 2, plus …
- Sending from the Hex representation, allows users to save valuable MCU resources such as SRAM.
- Using soft PWM as presented in this post also saves MCU resources such as Timers and allows users to use any pin for output, instead of the limited set of pins tied to a particular timer on the MCU.
- Much of the support requests on the Arduino forum relate to conflicts between libraries and the approach presented here will remove many of these conflicts. However, we would always recommend using hardware generated PWM for sending IR signals, where possible and a soft PWM approach for other situations.
- As before, we will post a link to the complete Arduino sketch at the bottom of this post.
For more Details: Simple Infrared PWM on Arduino, Part 3 – Hex IR Signals
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w