RoganDawes
Expert Member
I created an ESPHome-based controller for my automatic gate.
It is a Centurion D5, and has a number of terminals via which one can interact with the gate's controller. Included are Free Exit (for inductive loops to trigger opening), Pedestrian (opens the gate enough for a pedestrian to pass through, then closes it a few seconds later), and Trigger (steps through a state machine with each momentary activation - closed - opening - open - closing - closed). There is also an LED that flashes various patterns to provide state information. Off for Closed, slow flashing for opening, On for open, fast flashing for closing. And it can report errors with a pattern of 250ms flashes followed by 2500ms off, repeated.
I see a lot of posts where people use relay boards to switch 12v signals to triggers gates and garage doors, but a much smaller alternative is an optoisolator. This is basically a combination of a transistor and an LED, where activating the LED switches the transistor, allowing a small amount of current to flow in the 12V circuit, and registering as closing the circuit, exactly as would a relay. So, my circuit used 3 optoisolators on output GPIOs to activate the various signals, as well as one on an input gpio to convert the 4.5V LED signal to something that the ESP32 could safely consume.


To keep the board as compact as possible, I actually soldered the optos underneath the ESP32 dev board. You can see how the ESP32 is mounted on pins that have two spacers added instead of the usual one. If I were to make this a professional installation, I would likely make use of a bare module on a PCB, but this was good enough for a 1 day project.
I have attached the YAML (as a txt file), for those that are interested in replicating this.
It is a Centurion D5, and has a number of terminals via which one can interact with the gate's controller. Included are Free Exit (for inductive loops to trigger opening), Pedestrian (opens the gate enough for a pedestrian to pass through, then closes it a few seconds later), and Trigger (steps through a state machine with each momentary activation - closed - opening - open - closing - closed). There is also an LED that flashes various patterns to provide state information. Off for Closed, slow flashing for opening, On for open, fast flashing for closing. And it can report errors with a pattern of 250ms flashes followed by 2500ms off, repeated.
I see a lot of posts where people use relay boards to switch 12v signals to triggers gates and garage doors, but a much smaller alternative is an optoisolator. This is basically a combination of a transistor and an LED, where activating the LED switches the transistor, allowing a small amount of current to flow in the 12V circuit, and registering as closing the circuit, exactly as would a relay. So, my circuit used 3 optoisolators on output GPIOs to activate the various signals, as well as one on an input gpio to convert the 4.5V LED signal to something that the ESP32 could safely consume.


To keep the board as compact as possible, I actually soldered the optos underneath the ESP32 dev board. You can see how the ESP32 is mounted on pins that have two spacers added instead of the usual one. If I were to make this a professional installation, I would likely make use of a bare module on a PCB, but this was good enough for a 1 day project.
I have attached the YAML (as a txt file), for those that are interested in replicating this.
Attachments
Last edited: