This is only a preview of the February 2022 issue of Silicon Chip. You can view 35 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Items relevant to "Dual Hybrid Power Supply – Pt1":
Articles in this series:
Items relevant to "Fan Controller & Loudspeaker Protector":
Items relevant to "Solid-State Tesla Coil":
Items relevant to "Remote Gate Controller":
Purchase a printed copy of this issue for $11.50. |
Driveway Gate
Remote Control
for sliding and swinging electric Gates
Sliding/swinging gate controllers inevitably fail after some years of service.
The more poorly made models will die after just a few years, so you will
end up repairing or replacing them frequently. The solution is to replace the
controller with this much more robust design, and as you build it yourself, it’s
easy to fix if it does go wrong.
By Dr Hugo Holden
W
hen I moved into my current
home some 20 years ago, I
enjoyed the fact that the front
fence had a sliding electric driveway
gate. However, after about a year, the
gate started to malfunction, initially
with intermittent behaviour and then
total failure.
I inspected the gate control module, which was based around a controller CPU. The motor switching
relays looked somewhat small for the
task, and I could see significant contact burning through their transparent covers.
I called the manufacturers for a schematic, but they did not want to provide
any assistance. Instead, they directed
me to their local repair agents. A fellow
at the company seemed quite sympathetic, but it was apparent he ‘wasn’t
allowed’ to help a customer to effect
their own repairs.
As is often the case, the repair agents
were unable to make PCB-level repairs
and could only replace the whole
76
Silicon Chip
control board for hundreds of dollars.
Initially, I accepted this.
It failed again a year later, and again,
I had to buy a new PCB. Further failures appeared after lightning storms
on two occasions.
After repeated episodes of the system failing, I was getting fed up. I
took one of the original boards and
replaced the relays, to good effect. I
also replaced some aged electrolytic
capacitors, but the writing was on
the wall.
Fortunately, the radio receiver board
(a generic third-party product) had
always been very reliable, so I kept
that and decided to design a new controller board to connect to it.
My solution
I decided to throw the original controller PCB in the bin and design my
own from scratch. Looking around at
the parts in my workshop, I had a good
supply of 74-series vintage TTL logic
ICs (some of which were were used
Australia's electronics magazine
in a Pong system; see the June 2021
issue) . These are rugged and reliable,
also highly resistant to damage from
electrostatic discharge (ESD).
The task of an electric driveway gate
appears simple on its face. But like
many automation systems, the devil
is in the detail.
My sliding gate is powered by a
24V DC bidirectional brush motor.
It has two standard micro-switches
as motion limit switches. These are
mounted close together in the motor
drive unit and are mechanically activated at each end of the gate travel,
via a spring arm, when the gate is fully
closed or fully open.
A swinging gate is likely to have a
similar arrangement, so my controller
could be suitable for that type of gate.
However, I have not tested it as such.
You would have to check how your
gate system works before deciding to
use my controller.
The controller logic needs to take
account of the states of these limit
siliconchip.com.au
Easy to service; no software and all through-hole parts
Triggered by a single remote or local button (or both)
High long-term reliability and EMI tolerance
Stops the gate if it hits an obstacle
Safe power-on reset
Power input: 24V AC
Motor current limit: adjustable from 0A to 8.33A
Power for remote control board: 5V DC or 24V DC
Motor drive: 24V DC or rectified AC at up to 8.33A (200W)
switches during the use of the gate.
It must then control the motor direction appropriately when the gate starts
from a fully closed or fully open, or
perhaps intermediate position.
It also needs to detect the motor current in case the gate strikes an obstacle, to stop the gate motor.
The gate is controlled by a handheld remote via a radio receiver board,
its output being a momentary closed
contact from a small relay on the radio
receiver board. But it could also be
controlled by a manual pushbutton.
Finally, the control logic requires a
very effective reset function to ensure
that the gate remains in its stopped
position with any kind of rapid, slow,
or variable mains power cycling. Otherwise, a brownout, blackout or other
event could trigger the gate’s motion
and maybe open up the gate when you
are not home.
there are four fundamental modes of
operation, cycled through by a button press.
Initially ignoring the two limit
switches, the remote control needs to
cycle the gate through four operational
states, shown in Fig.1.
Therefore, a two-bit counter is
needed, giving four logic states. I
achieved that using a 7474 dual D-type
flip-flop IC. These flip flops can be
preset or cleared, which is required to
take account of the gate limit switch
conditions.
Fig.1: the gate is controlled using a
‘state machine’ with four states: fully open,
fully closed, opening or closing. The
remote button cycles to the next state in
the loop, while the limit switches on
the gate force the machine into one
of the stopped states.
The state machine
Considering these requirements,
siliconchip.com.au
Australia's electronics magazine
February 2022 77
Fig.2 shows how the state machine
is controlled by a combination of the
limit switches and the remote control.
For example, when the gate is opening and it reaches the limit switch, a
100ms pulse is gated via the OR gate
and the lower AND gate, the state
machine changes to the ‘stop before
forward’ state, and the gate motor
stops.
If the control button is then pressed
on the remote, upon the button initially being pressed, the ‘stop before
forward’ state is reset to be 100% sure
the state machine is in the correct
condition according to the now-static
switch data. On the trailing edge of
the pulse, the state machine is then
clocked to the ‘forward’ state, and the
gate begins to close.
The closed switch is triggered when
it is shut, and the machine is set to the
‘stop before reverse’ state. If the button
is pressed again, the state machine is
reset to this condition on the leading
edge of the pulse, then clocked to the
‘reverse’ state on the trailing edge, and
the gate starts to open.
The stopped states are applied on
the leading edge of the control pulse
to ensure that, whatever state the
This is the
type of universal
motor typically
used to drive a sliding
or swinging gate.
They are typically
powered from 24-48V
DC or rectified AC
although some run
from as little as 12V.
controller was in before, the motor
stops before it starts moving. This
way, the gate always starts in the correct direction and doesn’t attempt to
run itself past the stops set by the two
limit switches.
Circuit details
The circuit is shown in Fig.3. Either
power-cycling or gate over-current is
designed to set the gate into the ‘stop
before reverse’ condition. This does
not cause a problem even if the gate is
power cycled in the fully reversed condition, as with the next activation of
the remote control, the state machine
is forced into the correct condition (ie,
‘stop before forward’) before the gate
starts its motion.
One important feature of the
design is that the limit switches
are debounced. The cross-coupled
Fig.2: more detail on how the state machine is implemented using digital logic chips. When either the remote button
is pressed or a limit switch is activated, a pulse is generated. These pulses are ORed to create a pulse that advances
the state machine to the next state. The pulses are also ANDed with the limit switch signals to force the machine into
either the fully closed or fully opened states when needed.
78
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
inverter gates (IC1a, IC1b, IC1e & IC1f)
very effectively debounce a changeover switch, unlike other methods
using RC networks, Schmitt triggers,
delay timers etc.
This method is mainly time-domain
independent, and the 7404 logic ICs
are not harmed because their outputs
are only forced low for the very brief
propagation time of the inverter gate.
74-series ICs, while good at sinking
current, only weakly source it.
One interesting consideration
is whether to regard the two limit
switches as independent items, or two
items acting together.
The two limit switches are entirely
isolated from the mechanical perspective, and it is essentially impossible to
activate them simultaneously. After
all, the gate cannot physically be in
two places at once (open and closed),
and the spring arm that activates the
switch can only be pushed in one
direction at a time.
However, the switches are mounted
close together, and the cables to them
are in one bunch. So very heavy RFI
(eg, from a nearby lightning strike)
could possibly fool the electronics
that both switches are activated at
once.
Therefore, I concluded it was best
to XOR the signals from the two gate
microswitches using gate IC2d as a
form of ‘digital common-mode noise
pulse immunity’ because an XOR
only responds if its inputs are complimentary. In other words, if both
switches are seen as closed at once, it
is treated as if neither is closed.
The debounced and XORed limit
switch outputs are then strobed into
the state machine’s clear & preset terminals, with approx 100ms pulses
from 555 timers IC7 & IC8. These
are triggered by a command from the
remote control (or pushbutton) or a
state change when a limit switch is
activated.
This arrangement ensures that the
limit switch states set the correct state
machine state (via the CLR and preset
inputs of the two 7474 flip flops, IC6a
& IC6b), while the remote control can
also cycle through the sequence by
clocking the first flip-flop, which in
turn clocks the second flip-flop.
The outputs of the state machine
(labelled A & B) are uniquely decoded
into two simple control signals, forward and reverse by another XOR gate
(IC2a) and a pair of NAND gates (IC4c
siliconchip.com.au
Parts List – Remote Gate Controller
1 double-sided PCB coded 11009121, 209.5 x 134.5mm
1 sealed ABS enclosure, 222 x 146 x 75mm [Jaycar HB6132 ➊]
1 24V AC power supply (plugpack or mains transformer, sufficient to handle
the full motor current)
1 radio receiver board with relay output, plus one or more matching keyfobs
2 3-way terminal blocks (CON1, CON2)
1 2-way terminal block (CON3)
1 6-way PCB-mount barrier terminal (CON4) [Altronics P2106]
1 3-way pin header with jumper shunt (JP1)
2 24V DC coil 24V/30A SPDT relays (RLY1, RLY2) [Jaycar SY4047]
2 M205 PCB fuse clips (F1)
1 M205 4A slow-blow fuse (F1)
1 5kW mini horizontal trimpot (VR1)
2 6073B-type 19x19mm TO-220 mini flag heatsinks (for REG1 & D8)
[Jaycar HH8502, Altronics H0630]
4 M3 x 8-10mm panhead machine screws
4 M3 flat washers
4 M3 star washers
4 M3 hex nuts
4 M3 x 6mm self-tapping screws
1 or more cable glands (to suit installation)
➊ it will fit in Altronics H0312A or H0313 boxes, but the mounting holes will
not line up with the plastic posts in the base
Semiconductors
1 7404 or 74LS04 hex inverter, DIP-14 (IC1)
1 7486 or 74LS86 quad 2-input XOR gate, DIP-14 (IC2)
1 7408 or 74LS08 quad 2-input AND gate, DIP-14 (IC3)
1 7400 or 74LS00 quad 2-input NAND gate, DIP-14 (IC4)
1 7402 or 74LS02 quad 2-input NOR gate, DIP-14 (IC5)
1 7474 or 74LS74 dual D-type flip-flop (IC6)
3 555 timer ICs, DIP-8 (IC7-9)
1 7805 5V 1A linear regulator (REG1)
2 BC639 60V 1A NPN transistors (Q1, Q2)
2 BC548 30V 100mA NPN transistors (Q3, Q4)
1 BS270 P-channel small signal Mosfet (Q5) [Digi-Key, Mouser element14]
3 1N4148 signal diodes (D1-D3)
4 1N4004 400V 1A diodes (D4-D6, D8)
1 30A rectifier diode, TO-220-2 (D7) [eg, SDUR30Q60 or STTH30R04W]
Capacitors
1 4700μF 63V snap-in radial electrolytic (optional)
1 1000μF 63V radial electrolytic
2 100μF 50V radial electrolytic
4 10μF 50V radial electrolytic
1 2.2μF 50V multi-layer ceramic
15 100nF 63V MKT
5 10nF 63V MKT
Resistors (all 1/4W 1% metal film unless otherwise stated)
1 1MW
1 120kW
3 47kW
2 9.1kW
1 4.7kW
6 1.5kW
1 1kW
2 620W
2 430W
2 100W
3 68W 5W 10% wirewound
1 0.68W 50W 10% wirewound [element14 Cat 2478215 or 2946343]
Australia's electronics magazine
February 2022 79
& IC4d). These signals are inverted by
two 7404 gates (IC1c & IC1d) and used
to drive two BC639 transistors (Q1 &
Q2) that switch the two 24V relays,
driving the gate motor forward or in
reverse.
Current sensing resistor (R1), in
series with the motor, develops a voltage proportional to the motor current.
80
Silicon Chip
The commutator noise is filtered out
by an RC-low pass filter comprising a
1kW series resistor and a 100μF capacitor to ground.
If the gate collides with an obstacle, the output voltage of the filter
increases and this forward-biases the
base-emitter junction of transistor Q4,
generating the OVR signal.
Australia's electronics magazine
This stops the gate and sets the state
machine to ‘stop before reverse’.
However, when the gate starts up
and accelerates from a stopped position, there is a motor current surge. To
ensure the current detector is deactivated when the motor starts in either
the forward or reverse direction, timer
IC9 generates a pulse of around 1.3s
siliconchip.com.au
Fig.3: the full circuit for the Gate Controller is somewhat complex but you can compare it to Fig.2 to get an idea of
which section does what. The three timers, IC7-IC9, each act as pulse stretchers to ensure that brief events such as a
short button press are not missed.
duration, which causes Q3 to inhibit
the charging of the 100μF filter capacitor.
The motor can be powered by halfwave pulsed DC using just the power
rectifier, but you can speed it up with
the addition of the 4700μF capacitor.
I used an IXYS 30A rectifier to ensure
that it would not fail.
siliconchip.com.au
Pull-up resistors
One subtlety of the design that isn’t
immediately obvious is the need for
the 1.5kW pull-up resistor at the output of IC5a. The 74xx TTL logic device
outputs only go up to about +3V when
high, despite running from a 5V supply. That isn’t a problem when they
feed the inputs of other 74xx devices,
Australia's electronics magazine
as the inputs are designed to handle
this.
Note that 3V is above the ~1.7V
trigger threshold of a 555 with a 5V
supply. But given the weak pull-up
current from a 74xx device (around
0.4mA), it’s much better to have an
external pull-up resistor so that the
555 is reliably triggered, especially
February 2022 81
since the trigger signal is capacitively
coupled.
Construction
The Gate Controller is built on a
double-sided PCB coded 11009121,
which measures 209.5 x 134.5mm.
Refer to the PCB overlay diagram,
Fig.4, as a guide during construction.
There is nothing particularly difficult about assembling this board, so
the usual technique of starting with
the lowest profile components and
working your way up should work
well. Start with the small resistors,
checking the value of each lot with a
DMM before fitting them. Then mount
the diodes, ensuring that the striped
cathode ends are orientated as shown
in Fig.4.
Next, install the ICs, taking care that
their pin 1 ends are located as shown.
I don’t recommend using sockets as
they are a potential failure point, and
as mentioned earlier, all the ICs used
in this design are very reliable. We
only fitted them to the board shown
for development reasons. Follow with
the sole trimpot.
Then fit the smaller transistors,
being careful not to get the different types mixed up, followed by the
smaller MKT and ceramic capacitors,
which are not polarised. Next, mount
the larger resistors, spacing them off
the PCB by a few millimetres to allow
cooling air to circulate. Follow with
the fuse clips, ensuring the retaining
tabs are towards the outside so you
can insert the fuse later.
Bend the leads of REG1 and D8 to fit
their respective pads, with the device
tab holes located over the matching
mounting holes on the PCB. Slip the
heatsinks between the PCB and the
device’s tabs, then attach the tabs
securely using M3 machine screws,
nuts and washers on either side.
Ensure they are secure and the bodies
and heatsinks are straight before soldering and trimming the leads.
The large 50W resistor is held to the
board using two M3 screws, nuts and
washers on either side. Once you’ve
mounted it in place, bend a lead offcut from one of the 5W resistors so that
it reaches from the pad towards the
centre of the PCB to the 50W resistor
lead, then solder it in place.
The tabs of the relays should drop
right into the slots provided on the
PCB. Make sure they’re pressed all
the way down, and use a generous
amount of solder on each pin to hold
them securely to the PCB.
Now mount the terminal blocks
(wire entries towards the outer edge of
the PCB), barrier terminal strip and the
larger electrolytic capacitors, ensuring
the latter are orientated with the longer positive leads to the pads marked
+ on the PCB.
Bend another off-cut to go from
the other lead to the AC terminal as
shown in Fig.4 and the photo, then
solder it to the other end of the resistor and clamp it down in the screw
terminal.
Wiring it up
Before mounting the PCB in the
case, you will need to figure out where
the radio receiver module will be
mounted (it might be possible to fit it to
the inside of the enclosure lid), which
wires need to enter the box and where
the best place is for them to enter.
The wire entry will need to be waterproof if the unit will live outside,
which can be done either using one
or more cable glands (as mentioned
in the parts list) or seal the holes with
neutral cure silicone sealant after running the wires through.
Most likely, you will have ten wires
to run in two twin leads and two multicore cables: two for the low-voltage AC
power input, two wires going to the
motor and five or six wires going to the
limit switches. Ideally, use cables with
a round profile and run each through
its own cable gland.
You could use a four-core screened
cable for the limit switches and twocore round cable for the others, meaning you need three glands and thus
three holes in the case.
If you can’t fit the radio receiver in
The finished Driveway
Gate Controller is
located in a plastic
enclosure near my
gate with a liberal
amount of waterproof
tape applied (shown
on the lead image).
This means I can still
open it up to access
the board (however
unlikely that is now)
while still keeping the
water out. I certainly
wouldn’t want
water getting in and
corroding away all my
hard work!
82
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
the case, you will need to run
some additional wires to the
outside. These are two wires
to power the receiver board
(assuming you aren’t supplying it with power externally)
and two which run from the
receiver’s relay contacts to input
connector CON3. They could be
run together using three- or fourcore screened cable.
Note that, as there is no room
in the box for a mains transformer, you will either need to
use an AC plugpack or (more
likely) mount a mains transformer, mains input socket (or
captive cord), fuseholder and
wiring in a separate insulated
box.
We won’t give any instructions on how to do this, except
to say that you need to use
correctly-coloured mainsrated wire where appropriate
(Active = brown, Neutral = light
blue and Earth = green/yellow
striped). You will also need to
ensure that all exposed mains
conductors are insulated (eg,
with heatshrink tubing) and tied
up neatly with cable ties so they
can’t float around in the box if
they break loose.
If you aren’t experienced
with building mains-powered
equipment, you will be better
off finding a suitable plugpack
instead.
Drill holes for these glands
(or the bare wires, if using silicone) near where the relevant
connectors will be once the PCB
is mounted in the case. Mount
the glands securely, then install
the PCB, insert the wires, attach
them to the relevant terminals
(as shown in Fig.4), pull out
most of the slack and tighten
the gland nuts.
If you have room to fit the
receiver in the box, you could
attach it to the inside of the lid
using neutral cure silicone sealant –
make sure it isn’t going to foul any
components on the main PCB when
the cover is in place. Another option
is to use tapped spacers and screws
(assuming it has mounting holes), but
if you do that, make sure you seal the
screw holes through the lid so moisture can’t get in.
If mounting it on the lid, that also
siliconchip.com.au
Fig.4: assembling the PCB is straightforward. Fit the parts in the locations and
orientations shown here. Note how the large resistor is attached to the PCB
using machine screws, then two wires are soldered to its exposed terminals. One
goes straight down to a pad on the PCB, while the other end connects to one of
the low-voltage AC input terminals on CON4.
Australia's electronics magazine
February 2022 83
The electrolytic capacitor
sandwiched between Q3 and
VR1 should be 100μF as shown
in the circuit and overlay not
10μF as shown in silkscreen
of the photos. Our first batch
of PCB that we are selling
have this listed incorrectly,
so keep an eye out when
assembling! Subsequent
PCB batches will have this
problem fixed.
allows you to run the receiver antenna
around the inside of the lid, assuming
it is using a length of wire as a whip.
Testing, setup & use
There isn’t much to go wrong, but
since the motor will not be running
initially, you could connect a safety
resistor (say 10W 5W) in series with
the AC supply the first time you set it
up. Check the AC voltage across that
resistor; it should be well under 1V.
If it’s more, switch off and check the
board and wiring for faults.
Assuming it’s OK, measure the voltage between pins 1 and 14 of IC6 (or
just about any of the 74xx ICs). You
should get a reading close to 5V. Next,
check the voltage at the 68W 5W resistor leads right near the edge of the PCB
relative to the tab of REG1.
This reading should be between
about 22V and 28V if a radio receiver
board is connected, but it could be
somewhat higher than that (up to about
35V) if there is no radio receiver board
drawing power from the unit.
If that all checks out, remove
the safety resistor and connect the
low-voltage AC supply directly to the
board. Now is also a good time to fit
the onboard fuse, which protects the
motor.
The remainder of testing assumes
84
Silicon Chip
you have the unit wired up to your
gate. Double-check that the connections to the limit switches and motor
are correct before proceeding. We’ll
assume the gate is initially closed,
although it would be best if you could
manually open it slightly.
It is ideal if you are near the gate
and can manually activate the limit
switches easily.
Set VR1 to its midpoint, then power
the controller up. It should reset in a
state where it’s ready to open. Press
the button on the remote or short the
terminals of CON3. The gate should
start to open.
If it tries to close instead, remove the
power and swap the wires to the motor
terminals. If it simply doesn’t budge,
or move a tiny amount then stops, you
might need to wind VR1 up to allow
more motor current.
Assuming it starts to open, actuate
the fully open limit switch and verify
that it stops. Then press the remote
button again and check that it starts
to close. Actuate the fully closed limit
switch and verify that it stops, and
that if you press the button again, it
begins to open.
Assuming it does that, check that it
opens and closes all the way. If it stops
partway, turn VR1 slightly clockwise
and try again.
Australia's electronics magazine
If it opens and closes all the way the
first time, try winding VR1 anti-clockwise a bit and repeat. Continue until it
stops working reliably, then turn VR1
clockwise slightly and verify that it
works reliably again.
The idea is to set VR1 just far enough
clockwise that it opens and closes
every time, but not too much further
than the minimum setting to achieve
this. That way, it will stop quickly if
something gets in its way.
All that’s left is to seal it up and tuck
it away. Your Gate Controller should
work reliably for many years to come!
Conclusion
One great advantage of this gate controller is that it uses standard garden-
variety 74 or 74LS series TTL digital
logic ICs. These are rugged and generally very reliable.
Many commercial gate controller
manufacturers will not release their
firmware or schematics; even if they
did, it would require the specific programming hardware and utilities to
re-program a new microcontroller if
needed. On the other hand, this design
can be repaired easily and at minimal
cost if it goes wrong.
Mine has been running for over 15
years now and has proven to be very
reliable and trouble-free.
SC
siliconchip.com.au
|