Engine Temperature Monitoring
Introduction
The integration of oil pressure monitoring into our Smart Boat system has multiple benefits. Notably, it allows for setting alerts when oil pressure deviates from the desired range, triggering alarms, flashing lights, or sending notifications to devices. While many engines have built-in alarms, their effectiveness is often limited in volume. Our system also enables users to review historical oil pressure data, providing valuable insights into engine health and performance. The project utilizes the compact and affordable INA219 device, which is connected to the pressure sensor and linked to the ESP32. The final step involves some elementary configurations in Home Assistant.
Initially, I planned to adopt a similar approach for the oil pressure by introducing a separate dedicated sensor using a T-fitting. This T-fitting was designed to house two distinct oil sensors: the existing oil sensor from the engine and another dedicated exclusively to our smart boat.
However, space constraints around my engine prevented the addition of the T-fitting and an extra sensor. Given the reliability of standard oil sensors and the desire not to disturb the existing setup, I decided to utilize readings from the existing sensor for our smart boat project. If you’re contemplating the T-fitting route, be assured that this guide remains wholly applicable.
In our project, we’ll be using the compact INA219 device, which costs about $2 from AliExpress. It’s straightforward to set up. All we need to do is connect a single wire from our INA219 to our pressure sensor, link the INA219 to the ESP32, and then do some basic configuration in Home Assistant. So, let’s get started.
ESP32 and INA219 Overview
Please watch my previous video about how to set up the ESP32, connect power supplies, and integrate it with Home Assistant. I like to use one of these breakout boards when working with the ESP32. It makes it easier to work with, connect wires and sensors, and also makes it a little bit less fragile. It’s much more robust when connected to this board. Line up the pins, push them in left, right, left, right, until the pins go all the way in. Make sure you’ve oriented the pin numbers and names the right way between the ESP32 and the breakout board.
For this project, we’re going to use the INA219 board. It’s tiny, about the size of my finger. On the front, there are six tiny pins, of which we’ll use four. On the other side, we have two pins, VIN+ and VIN-.
Connect Oil Sender
Now, we need to connect the INA219 to our engine oil pressure sender. Connect the red wire to the VIN+ terminal on the INA219 and to the gauge terminal on your engine oil pressure sender. You might have to use a spade double adapter to share the one terminal between the analog gauge and the INA219 for our smart boat system.
Add to Home Assistant
To continue, you need to watch my ESP32 setup video and the engine temperature monitoring video. In Home Assistant, go to ESPHome and select the ESP32 set up previously as the engine monitor. We’ll add some YAML code, which you can find on my webpage smartboatinnovations.com. Copy the I2C part and paste it in just after the Dallas declaration section in the YAML. I2C is the communication protocol between the INA219 and the ESP32.
Add the platform declaration for the INA219 under the sensor section. Make sure the indentation lines up. Save, validate, and install the code wirelessly OTA. Check the logs to ensure the oil sender voltage reads 0.0 volts when not connected.
Sensor Configuration
Add the voltage reading to your dashboard for calibration. When the engine electrics are on, note the voltage at 0 bar and when the engine is running. Use these points to derive a formula to convert voltage to pressure. The formula I derived for my engine is: (voltage – 0.72) * 0.812.
Add this formula to Home Assistant by editing the ESPHome YAML. Copy the code snippet from my webpage, paste it at the end of the YAML, and replace the values with your derived ones. Validate and install the code wirelessly OTA. Add the pressure gauge to your dashboard and calibrate it with your engine running.
Conclusion
Now you have a digital oil pressure meter. You can set up alerts via automations for when the pressure deviates.