-->
Page 1 of 2

Read if voltage on external line is on or off with esp12e

PostPosted: Thu Oct 08, 2020 4:08 am
by Guvnre
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?

Re: Read if voltage on external line is on or off with esp12

PostPosted: Fri Oct 09, 2020 12:19 am
by JurajA
a current sensor

Re: Read if voltage on external line is on or off with esp12

PostPosted: Fri Oct 09, 2020 3:59 am
by schufti
@jurajA: no, a voltage sensor.

just use a simple optocoupler for detection to keep esp and aux 12V supplies separated.
(I asume esp is powered by car 12V)

Re: Read if voltage on external line is on or off with esp12

PostPosted: Fri Oct 09, 2020 4:50 am
by eriksl
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).