ESPHome - Remote Monitoring and Management of an ADS-B Receiver

I have a Raspberry Pi-based ADS-B receiver (PiAware) running at home and I decided to use HA and ESPHome to make remote management of that system easier. Along the way, I had to address a few use cases and am documenting them here in case someone has similar needs in the future.

First, what is ADS-B? Well the short version is that its a real time radio system used by Pilots and Air Traffic Control to transmit aircraft position and other data to each other. Having an ADS-B receiver not only let’s me see cool maps of aircraft in the area, I also feed that data to a couple of the flight tracking sites for use by others.

My ADS-B receiver sits on top of the second story of my house which is great for line-of-sight range but requires rolling out two ladders to physically access. And I’m not the best with heights…

This also brings me to the first issue – reliably powering the whole system.

Remote Voltage Measurement

The PiAware is powered using a 5 volt DC feed which uses a 20m long USB cable to connect to a power supply that’s nearer to the ground. For some reason, the voltage drop over this cable is such that I need to push over 6 VDC into the cable to get 5V out on the roof. The Pi wants to see an input voltage of no more than 5.25V and much less than 5V seems to cause stability issues, probably due the overall current draw of the Pi and the Software Defined Radio (SDR) dongle. So, I wanted a way to remotely monitor the voltage that the Pi was seeing and adjust it if needed.

I decided to use the analog input on a Wemos D1 Mini to do just that. To make it cleaner, I also got a really nice breakout board that plugs right into the Pi’s I/O headers.

I added an INA219 on the D1’s I2C bus to measure both far-end current and voltage. I can now use an easily accessible variable buck convertor at ground level to adjust what goes into the long power wire and make sure that the Pi has the right voltage. I can also monitor for power supply failures too.

Remote Reset

Every so often, the PiAware’s flight tracking webpage becomes unresponsive and the Pi OS itself will no longer allow SSH access. The only way to ‘unfreeze’ the device is to power cycle it, which would mean getting on ladders again. So, I decided to add the capability to reset the Pi remotely.

It turns out that taking the ‘RUN’ pin low on the Pi PCB will reboot the device, so I connected one of the D1’s GPIO pins to this pin. This is normally just a pad on the Pi PCB, so I added a header pin to make it a bit cleaner.

I surface this to HA as a simple momentary switch and can now reboot anytime that I like. I have a Node-RED flow that periodically does HTTP calls to the Pi and, if it sees successive errors, can reboot the device through a service call to this virtual switch. No unplugging or physical access required!

Automatic Fan Management

The small, 2 litre enclosure that the PiAware sits in is very well sealed but also fully exposed to the sun. The Pi and SDR dongle inside generate enough heat that I was worried about overheating the Pis CPU in the Summer months. So, I added a weatherproof vent to the enclosure and installed a higher end 5V PWM cooling fan to push air out through that vent. The fan is controlled by another GPIO pin on the D1 and is surfaced to HA as a fan device. I control the fan speed using a PID thermostat in ESPHome.

To fully automate this, I also added a BME280 multi-sensor to measure the temperature inside the enclosure. This is connected to the D1 using an I2C interface which eats up another two I/O pins. Since I also surfaced the tachometer, I can also monitor for fan stalls or failures.

Summary

The cool thing for me is that this started off as a simple desire to monitor voltage and then became a platform to address other cases as well. The combination of ESPHome and the D1 makes this super easy to both build and surface all of this into HA. The hardest part of the whole exercise was some tricky pin configuration that required a bit of extra troubleshooting.

And, with the OTA capabilities of ESPHome, I can change the software whenever I like. And no more pesky ladders!

All in all, an interesting, useful and pretty much frustration free process.

7 Likes

Thank you, now I know what ADS-B is :slight_smile:

Thanks! And I’ve now added a really brief description of ADS-B in the preamble.