Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Guvnre
#89060 I'm building a monitoring system for our camper. In this camper we have a 4G modem, which I'm going to use to send out messages to my home automation system. From this system I have bot talking to telegram on my smartphone to alert me whenever needed.

One of the things I'm going to do is read the victron smartshunt through the ve direct port. This smartshunt will measure my second battery (first one is used for starting my engine and the second one is for the "home function" of the camper).

Whenever I'm in the camper, I'll turn on the 12v system, and then the power usage will be displayed on my central system, which is a raspberry pi with touch screen. When the 12v system is turned on, these readings will be done every 1 to 30 seconds (haven't determined yet what to choose). But whenever the 12v system is turned off, these measurements need to be done once every hour or so. After these readings, the esp will go in deep sleep mode, while the last readings will be saved in the RTC memory.

Now here is my problem. The 12v system will be somewhere between 12 and 16 volts (idle and when charging is happening or other influencing systems are turned on). I just can't figure out how to read if the 12v system (that's not always 12v) is turned on or off. I only need a binary value if it is on or off.

Could you guys advice me on this?
User avatar
By eriksl
#89074 Yes I'd also recommend an optocoupler, because supply voltage on a car is very dirty and can have mean spikes.

Optocouplers usually operate around 3 V, check the Vif and the consumed current to calculate an appropriate resistor (target at the max of 16 V, not 12 V).