ANAVI Infrared pHAT

by ANAVI Technology

Transform your Raspberry Pi into a smart remote control.

View all updates Feb 25, 2020

Field Report: Making a "dumb" home-entertainment system smart with Anavi Infrared pHAT

by Crowd Supply

by Phil P.

I’m Anavi backer Phil P. I used an Infrared pHAT to remotely control my “non-smart” home entertainment system. I connected the pHAT to a Raspberry Pi to which I can send signals over my LAN or the Internet and control my A/V gear by emulating its remote controls.

Specifically, the setup consists of the following:


  • Raspberry Pi 3 Model B
  • Anavi Infrared pHAT
  • LG “non-smart” TV
  • Sony “non-smart” Stereo Receiver


  • Lircd 0.9.4c & irexec 0.9.4c for infrared control
  • Node.js v10.15.3 & node-lirc 0.0.4 for Node.js access to lirc
  • Pm2 3.5.1 for startup/restart of InfraredServer.js
  • InfraredServer.js (the custom code)
  • Ngrok for a secure tunnel to Infared.js
  • IFTTT Apps for voice control from Alexa/Google Home via ngrok

InfraredServer.js is a simple Javascript server program I wrote that accepts JSON-format commands on port 8080 of the Pi, executes the command using node.lirc, and then returns a JSON-format response containing the present state of the controlled devices (the LG TV and Sony Stereo). The program also provides a web-server for web pages that provide virtual-remote functionality for both the TV and the stereo.

Separately, an ngrok tunnel and IFTTT Apps (Google Assistant-Webhook) are used to provide voice-control access from Google Home to the server (e.g., "Hey, Google: TV on"). Irexec is used to monitor infrared commands from any physical remote in order to update the InfraredServer present state.

The challenges for this project included finding the appropriate infrared commands for the devices (e.g., the LG Technician remote codes for separate power-on and power-off), debugging the infrared timing (most remotes send infrared commands twice to ensure the TV and stereo responds), and maintaining "sync" between the server and the actual state of the devices.

The ANAVI pHAT replaced an earlier version of this device which had used discrete components and a breadboard. This greatly improved the range and reliability of the server. The Pi3B+HAT now sit unobtrusively on my media table below the TV and above the stereo. Now, when I ask Google for "Movie Mode," the TV turns on to the right HDMI input and the stereo turns on to the TV input at the same time. I’ve even scheduled the TV to turn on every lunchtime, tuned to the news.

About the Author

Crowd Supply

 Portland, OR

$21,784 raised

of $1 goal

Funded! Order Below

Product Choices


ANAVI Infrared pHAT

The open source add-on board that converts your Raspberry Pi to a smart remote control. Includes one ANAVI Infrared pHAT (1).


Starter Kit

The perfect kit for scanning remote controls and controlling the air conditioning. Includes one ANAVI Infrared pHAT (1) and temperature & humidity sensor (1).


Advanced Kit

ANAVI Infrared pHAT and all sensors needed to do an awesome home automation. Includes sensors for temperature & humidity (1), barometric pressure (1), and light (1).


Developer Kit

Anything that a developer needs to master infrared on a Raspberry Pi. Includes sensors for temperature & humidity (1), barometric pressure (1), and light (1). Also comes with mini remote control and USB to serial debug cable.


ANAVI Technology

Open source hardware created and powered by free and open source software

ANAVI Technology


Mouser Electronics


Components and Hardware Sourcing

TME Electronic Components

Components and Hardware Sourcing

Comet Electronics


Components and Hardware Sourcing

See Also

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects: