Brownout Detector for ESPHome

Hi,

I am relatively new to ESPHome. Currently building my second device, which is a well water level monitoring device utilizing an air pump, an air valve, a pressure sensor and two relays to drive the pump and the valve.

When I use the relays to be powered in OFF state, everything works fine. But when I reverse the logic and have the relays powered in ON state (to save power) the ESP looses crashes and reboots.

Just to be sure it’s a brownout I am hunting down, I thought it would be great to be able to implement a brownout logging.

I found this to implement a brownout interrupt: Brownout Detection Interrupt - ESP32 Forum

As there is no direct way to define interrupts in ESPHome, I thought about a lambda which defines the interrupt and registers it in the esp → on_boot section.

Is this possible, or will I overwrite something essential by doing this?

Just to be clear, with OFF you mean NC?
We need to see your configuration and how things was connected.

Thanks for chiming in!

Sorry, explanation had been sloppy. What I mean:

Working:

  • on_boot output.turn_off
  • relay LED is switched on / draws current in relay spool
  • cable is connected to NO and is off from boot on
  • on event:
    • ESP changes output.turn_on
    • delay some seconds
    • ESP changes output.turn_off

Not working:

  • on_boot output.turn_on
  • relay LED is switched off / no current in relay spool
  • cable is connected to NC and is off from boot on
  • on event:
    • ESP changes output.turn_off
    • delay some seconds
    • ESP changes output.turn_on

At not working configuration it resets after some event cycles at random time. It’s not really related to switching the relays (or starting / stoping the valve or the pump).

I will draw a circuit later, have to leave now.

Two things:

1.) Set up adc to measure the vcc of the esp chip

2.) Set up some serial logging to catch the reset/restart events.

Hopefully you will get more insights what’s going wrong!

Sadly the VCC measuring is a ESP8266 only feature…

I’ll try to measure it with an additional input adc later on.
It’s a good idea :slight_smile:

Indeed, missed that you are using a esp32…

You also might want to try some additional caps close to the esp32 on VCC/GND and see if the resets/restarts continue to happen

Try to connect RC Snubber.

Thanks for the tip!

Do you know, how they are wired?

The description states it has to be connected in parallel to the inductive load (my pump and the valve with an electro magnet, I assume).

I know adding a capacitor in parallel can help. Also a freewheel diode antiparallel to the pump.
But never heard of 2 capacitors and a resistor. :man_shrugging:

I am just curious, how this would help.

Of course! The Snubber is conneted in parallel to the load, as you assumed.
rc-snubber

Either way, the part is not 2 capacitors and a resistor, but a capacitor, resistor and a varistor.

1 Like

TIL, or better: today I learned again! :smiley:
thx