AC Voltage Sensor ESPHome -Solved-

I just bought a new Orbit B Hyve sprinkler controller and only it shows the status of the external rain sensor when the program is schedule to run. I would like a simple solution to detect when the rain sensor is open or closed. The voltage is AC and when the switch is made the voltage around 14 VAC (rain sensor terminal to common) 0 VAC when open. I am wondering if I can use ZMPT101B to sense the voltage or is there a simpler solution. I saw one other topic on the ZMPT101B but I believe they were looking for accurate voltage measurement.

Update- Used a MID400 for the AC voltage. Simple circuit to provide Rain Sensor status from B Hyve.

Rectifier and capacitor to convert it to DC, voltage divider to reduce the voltage to around 2–3V, GPIO input. Professional schematic:

Note: only use this for AC voltages that are “low” and isolated from the mains. DO NOT use it for detecting / measuring mains AC!

The ZMPT101B seems to be optimized for measuring 230VAC (good tip, I will try the module for that :wink: ) In your case with 14V AC I would guess that the microcontroller output of the ZMPT101B is so low, that you will not get accurate on/off signals to HA (just a educated guess without having the module itself).
The solution by troon seems to be the easiest and most straightforward. There are modules for this available:

With this module, you just have to adjust the output voltage to 2-3 V as said by troon. This could be done by f.ex. a simple potentiometer.

Hi,
I am trying to use esphome with ZMPT101B on esp32 for voltage measurement but cant find the right formula after reading the ADC value.
Any idea on that will be really appreciated.

Regards,

without any further information, this is the best I found: https://innovatorsguru.com/zmpt101b/

It gives you (btw. 4th hit in google) the math involved.
Basically: Measure your AC voltage and the ESP sampled voltage and calculate a factor from this. Alter the ac voltage if possible and check the ESP recalculated results.

Thank you for reply.
Actually I have checked this link but couldn’t find out the formula using the details mentioned here.
The thing is my ADC reads some where around 630 (Sine wave calibrated) while the AC voltage on multi meter is 228 volts.

Any help with this will be great.

Thanks in Advance,
Sorry if its a silly question.
I am very new to all IOT thing.

Regards,

Are your ADC counting floating between 630 and zero or are they sort of stable at 630?
If they are somewhat stable, I would assume that they are somehow RMS values then the formula is quite simple:

Vout = 228/630 * Vadc

But your would have to check with a lower AC voltage to see whether there is still an offset. Maybe you have one one those acient power supplys laying around that just have a transformer inside and output f.ex. 12V AC? You could connect this thing to the ESP and then see whether the formula gives good values with this lower values. If not we can easily do a linear compensation.