Features of the the ESP32
The nice thing about the ESP32 is that it has lots of useful features that make it ideal for measuring and reacting to outside events and yet consume very little power. The board itself draws quite a bit more power than say an ESP8266 but because it can be put to sleep and wake up from outside events, net net is almost no drain on the boat battery. Here are the features I will be using:
- Wake up on time
- Wake up on external event in this case the large pump
- Read 12 volt inputs as On or Off
- Measure multiple battery voltages up to 16 volts.
- Control relays to turn on or off the fan or small bilge pump
Wake up on timeThe fundamental idea is that the unit will wake up every 30 minutes, check everything out, and do one of three things. 1) Go back to sleep. 2) Send the daily email. 3) Send an unscheduled email to alert me of a problem. Every 30 minutes seems like often enough and the unit seems to fail if you ask for more time which makes this the obvious choice. The only thing I would want to know sooner would be if the large pump went off.
Wake on external eventThe 12 volt line to the main pump is controlled by a float switch. If that line has 12 volts on it, the ESP32 wakes up, turns the small pump into automatic mode, and sends an email so that I can take corrective action. The unit is capable of waking up from a large number of external events but I have not taken advantage of that.
Read external inputsI use transistors (see next page) to take the 12 volt inputs and set input pins either high or low. This allows me to read if the main power switch is on which of course means I am on the boat. I could also use it to measure shore power but I infer shore power by the voltage on one of my batteries. When shore power is on, that battery sits at 14 volts. When shore power is off, it goes down to 12.6 volts. If my boat had shore power outlets I would just use a 5 volt wall wart and measure shore power directly but I don't. I just have an extension cord with a battery charger plugged into it. But the capability is there and would be simple to implement. There is also an input from the small pump that is 12 volts when the pump is running.
Read battery voltageOne really nice feature of the ESP32 is that it has a large number of analog to digital converters so a corresponding large number of things can be measured. I measure the battery voltage on each of my two batteries. My Dutch friend is going to measure a water sender to look for water in the boat. He does not have a bilge so no place for a float switch.
Control thingsAs I mentioned, I have a high capacity 12 volt fan to get air flow in the boat. I don't want to run that fan if shore power is off or if the battery voltage gets low. The fan and small pump run off one battery and the large pump runs off the one I measure to deduce shore power. The relays turn the fan off when I want and also turn the pump on per its schedule. When I command the pump to turn on, I monitor its line to make sure it goes on. If it doesn't, I will send an email. I measure the amount of time it is on and use that to adjust the schedule. As I write this, the schedule is once a day and the run time is 5 seconds. If the pump runs for over 60 seconds, I reset the schedule and the pump will start to run every half hour and adjust as needed. The goal is for the pump to run less than 15 seconds. I expect this to greatly extend the life of the pump. I have been replacing them every 4 years under the extended 5 year warranty so all it costs me is the cost of a new extended warranty. But it is a pain and I hope to avoid doing it in the future.
Please read website Cookie, Privacy, and Disclamers by clicking HERE.