Help with relay logic gate controller

Hi, i’m trying to wire up my gate to ESP home as a endstop cover.

My gate motor is a 24vdc single arm swing actuator. The motor is 2 wire so reverses on reverse polarity.

I can’t work out how to forward/reverse the motor using relays and I need to literally reverse the polarity in order to reverse the motor direction, then back to “normal” polarity for the other direction.

Anyone able to draft me up a diagram on how I can wire this. I know im close but cant quite crack it.

Maybe needing double poll relays in order to give each relay a positive and negative common at the same time?

Thanks

You will need 3 relays. 2 to pick the polarity (or 1 double switch) and 1 double contact for on/off
Excuse the crude drawing :smiley:

Thanks for taking the time to draw this.

I still don’t understand it, do you think you could try draw it again.

Well, before we go on i need to know what your level of expertise is with electronics.
Because just dry driving the motor might cause it to burn up when it reaches its ends, unless there are inbuilt end switches that stop it.

While the drawing i make is simple, the switching polarity is a very simple act that. You are literally just choosing between +/- with the relays.

I plan to use the endstop cover integration

Endstop Cover — ESPHome

Thank you