New project time - Equipment / component ideas please

Hi guys,
Another problem on the farm needs a solution!

I have 24V solar pannels & 2x12V batteries connected to a Ubiquiti MQTT charger with built in 24V Passive POE switch. For the past couple of years its been working great and shuts devices off 24V POE power to switch ports if / when the battery voltage drops below a set threshold.

My problem is that I wanted to attach a couple of 802.3af POE cameras, so I cant use the 24V passive POE. The solution is to use a POE intector that is powered from 24V and injects the 80.23af power and then connect the non POE side of the injector into the unifi switch - This works perfectly but has created another problem (that I was half expecting).

As the injector is powered directly from the battery there is no power management on the injector and downstream, so on poor solar days the batteries cant charge sufficiently to meet the exta power demand and the batteries discharge to flat.

I have half a solution figured out, but I need help with it - I have enabled SNMP on the Ubiquiti SunMax and can now query the battery voltage directly from within HomeAssistant. Knowing the battery voltage I can then create an automation to trigger a GPIO on an ESP32 device which would turn on/off a relay to shut off the intector.

Question is what device to use that can handle the power, as its too much to drive it directly from a GPIO.

This is the injector I have:

This is the Ubiquiti SunMax:

Simplistically I suppose I could use any automotive 12V relay (I know I have some 40A ones in the shed) and connect a GPIO to drive that high and turn on the power to the injector. But, is there something a bit more elegant? Perhaps something solid state, maybe even a hat for a PICO (running ESPHOME)??? Thoughts please.

I hope Ive eplained the problem enough, if not, shout out and I’ll try to better explain.



Hi Jon,

Welcome back, what a sick project!

I’d be keen to see some pics :smiley:

I like these modules from Pololu: Big MOSFET Slide Switch with Reverse Voltage Protection, HP | POLOLU-2815 | Core Electronics Australia

And they have the added bonus of reverse polarity protection

1 Like

Thanks Liam,
That looks like it could be a perfect solution. Question though. The website / specifications say that it operates from 4.5V-32V. Is this the trigger voltage? Further to the below, I only have 3.3V from a GPIO to trigger it. The heavy current side will be 24V. I am wondering if I should be using the LV variant? I guess it depends on which side of the switch the “operating voltage” relates to.

If you could confirm, I’ll get one ordered today.

I had a look through my parts box and I will be using a 3.3V TYWE2S module and it will be powered from the 24VDC from the SunMax via a Pololu 24V-3.3V Step Down Voltage Regulator.

The MOSFET will be triggered by sending a GPIO pin HIGH or LOW, based on the battery voltage.

I am assuming that the 300mA at 3.3V will be sufficient to power the TYWE2S and the MOSFET.

The final product / end result wont be as neat as I would normally like because the TYWE2S isnt breadboard compatible, but its what I have and will work!

Diagramatically, this is what I am thinking the end result will look like:
BRN3C2AF4D90CA0_002322.pdf (244.6 KB)

I’ll let you know how I get on with the coding:)


1 Like

Having a look at the description any voltage over 1V will turn it on so 3.3V should work well for controlling it.
The Max voltage the switch input can take is the voltage you supply the in side of the board.

I hope this helps get the project up and running.

1 Like

Thanks Aaron. Ive ordered the HP version.



Update time guys…

This project works a treat. My parts list included the big mosfet, a D24V5F3 Step-Down regulator and an old TYWE2s ESP chip I had laying around.

I flashed the ESP with ESPHome in Homeassistant, powered it from the Vin on the Big Mosfet and connected the ON/OFF pin on the Mosfet to a GPIO on the ESP.

Homeassistant monitors the battery voltage thats powering Vin via the solar charger and when the voltage dips below a threshold an Automation in Homeassistant changes thet state of the GPIO on the ESP and thus turns off the power via the GPIO. When the voltage comes back above a threshold the same thing happens and it turns it back on.

Thanks for the input re the mosfet selection - great advice.



Hi @Jon13024,

Thanks for the update :slight_smile:

Glad to hear its all working well!