Warning. More nerd stuff coming up.
A year ago I started monitoring various parts of the campervan using a Raspberry Pi, ESP32 microcontrollers, and the cloud based Blynk IoT framework. A short time later I added a Nextion touchscreen display:
Every Camper needs a Message Bus 😀 – Michael Janke
IoT – Dumb Camper gets Smart(er) – Michael Janke
After running with that setup for a bit, I decided to make a few improvements. First, I redesigned the display to emphasize the status of the new lithium battery, added a few toggles to control the fridge fans, a large clock on the sleep screen; and a few other marginally useful enhancements, such as a fan icon that spins in proportion to how fast the real fans are spinning:
Then, after a year of beating my head against the wall trying to get reliable Bluetooth communications from a Raspberry Pi, I decided to switch most of the inter-device communications over to a wireless protocol called ESP-NOW. It’s a proprietary protocol that uses the ESP32’s Wi-Fi radios but doesn’t depend on TCP/IP or a Wi-Fi access point.
I made it as simple as possible – all devices broadcast whatever they know via ESP-NOW, and any devices that need to know something listen for the broadcasts. No security, no encryption. If a nearby camper starts flinging ESP-NOW packets my way or snoops my packets, they can. The Nextion display controller and fridge controllers both send and receive ESP-NOW broadcast packets stuffed with useful information.
For example – I can toggle the fridge fans on and off via the Blynk app on my phone or the Nextion display. In either case the ‘turn the damn fans on’ message gets forwarded to the MQTT bus, which forwards it to the fridge fan controller. When the fridge fan controller successfully turns on the fans, it sends a ‘da fans is on’ message back to the MQTT bus via ESP-NOW, which in turn is forwarded to the Nextion display and the Blynk app, both of which update their UI’s to show the fan as ‘On’.
The interface between ESP-NOW and the MQTT message bus is a dedicated ESP32 that acts as a Serial<->ESP-NOW gateway and a python script that acts as a Serial<->MQTT forwarder. As before, the IoT/Cloud interface is handled via a python script that leverages the Blynk IoT libraries.
I used JSON to format the message contents. Mostly because everyone thinks JSON is cool and I want my project to be cool.
Compared to Bluetooth, ESP-NOW turned out to be simple to program and configure.
It looks something like this:
I also configured the Victron solar controllers and shunt to use USB communications with the Pi using an open-source library to decode the Victron messages and forward them to MQTT, rather than my own concoction.
It’s working… So far … Until it doesn’t.
Source code for Fridge fan controller is here, Nextion controller here.
New project ideas:
Vent fan: Of the things that I’d like to be able to control remotely, at the top of the list is the vent fan. The Fantastic fan is smart enough to close itself when it’s raining, but not smart enough to open itself back up when it’s not raining. The net is that a few drops of rain will close the vent until someone manually opens it back up. On a hot day, that sucks. Pretty simple concept. If <hot> and <not raining> then <open vent fan>. Unfortunately the various vent fans out there are pretty dumb, and none to my knowledge have any communications interfaces. This would be a soldering iron project – I’d have to poke around on the circuit board and see how to trigger the fan lid to open, then interface it to an ESP32.
Tank Gauges: The campervan came with the typical near-useless tank level sensors. Fresh water and propane work fine, black and grey are almost always inaccurate. On my last camper I installed SeeLevel gauges, which now are available with either Bluetooth or RV-C interfaces. New tank sensors are a priority, but being able to monitor them remotely or via a GUI control panel doesn’t add much value. The small control panel that comes with the SeeLevel gauges is useable. If I want to experiment with RV-C communications, this might be a place to play though.
Truma: The Truma Combi furnace/water heater communicates with its control panel via the LIN protocol on a LIN bus. Several open-source libraries (here, here and here) enable communication with the Truma. That would allow me to turn on and off the water heater and/or furnace remotely, control it via a GUI touch panel, and monitor its status. There is some value in being able to do that and learn how to interface to a LIN bus. Low priority.
Precision Circuits Multiplex: The Precision Circuits multiplex control panel controls the lights and awning. It’s capable of controlling the generator, water pump, and much more, but AFAIK, the stripped-down version OEM’d by Coachmen would need a firmware upgrade and some re-wiring to manage anything else, something that’s not feasible. It also uses a LIN bus. Controlling lights and the awning remotely doesn’t add much value and we never use the generator, so I’m not in a hurry to crack that one open. Low priority.
Commercial Products: There are commercial products such as Smart RV and RV Whisper that attempt to play in this space. RV Whisper supports quite a few sensors. For someone less technical, they might be useful. Hacking and building are fun, so I’m not as interested in commercial products – even if they work better than my DIY’s.
In the meantime, the 120V heating elements on my Truma Combi furnace/water heater stopped working. When plugged in to 120v, no heat. When on propane, lots of heat. Gotta either figure that one out or I’ll be stuck working with an RV dealer/service department.
Leave a Reply