Gate and Garage Project

Step-by-step instructions · Heltec WiFi LoRa 32 V3 · Mighty Mule gate and Genie 3055 garage opener

Contents

  1. How the system works
  2. Parts list
  3. Set up the computer
  4. Erase a board (factory reset)
  5. Test a board's screen
  6. Program the four boards
  7. Solder the pin headers
  8. Test on the breadboard
  9. Install at the gate
  10. Install in the garage
  11. Set up the phones
  12. Everyday use
  13. Power, solar and outages
  14. Troubleshooting

1. How the system works

BoardProgramWhere it livesWhat it does
1. Gate receivergate_receiverMighty Mule control boxPresses the gate's CYCL input with a relay; runs the 15-second gate light; reports open/closed
2. Handheld remotegate_remoteWith you or in the carPress PRG to open/close the gate over LoRa
3. Gate bridgegate_bridgeIn the house, on WiFiPhone page http://gate.local; ntfy alerts and commands; passes commands to the gate over LoRa
4. Garage controllergarage_controllerNext to the Genie openerPhone page http://garage.local; ntfy commands; "left open" reminder (WiFi only, no LoRa)

Your magnetometer keeps opening the gate as it does today. Commands are signed with a secret key, so nobody else's radio can open the gate.

2. Parts list

PartForWhat to look for
4 × Heltec WiFi LoRa 32 V3 + antennasAllAntenna screwed on before use
USB-C data cableProgrammingMust carry data, not charge only
2-channel relay moduleGateWorks with 3.3 V logic
1-channel relay moduleGaragePins DC+, DC−, IN; trigger jumper on H
12 V to 5 V USB-C converterGateDC-DC step-down with USB-C output
Magnetic reed switches (normally open)Gate, garage (optional)Wired door/window contact; overhead-door type for the garage
12 V DC LED light (<1 A)Gate lightOutdoor rated
Inline blade fuse holder + 2 A fuseGate lightFit close to battery +
18 AWG outdoor wire; bell wireGate; garage2-conductor
Breadboard kitTestingMale-female jumpers, LEDs, 330 Ω resistors
Soldering iron + solderHeaders30–60 W, 0.8 mm rosin-core solder
3.7 V LiPo, 1.25 mm JST (optional)RemoteCheck + and − match the board before plugging in

3. Set up the computer (once)

3.1 Install Arduino IDE

  1. Download Arduino IDE 2.x from arduino.cc/en/software and install it.

3.2 Install the USB driver (Windows)

  1. Plug in a board. Open Device Manager (right-click Start).
  2. If you see CP2102 USB to UART Bridge Controller with a yellow warning, the driver is missing.
  3. Go to silabs.com/developers/usb-to-uart-bridge-vcp-drivers → Downloads → CP210x Universal Windows Driver.
  4. Right-click the zip → Extract All. In the folder, right-click silabser.inf → (Show more options) → Install.
  5. Unplug and replug the board. It should appear under Ports (COM & LPT) as Silicon Labs CP210x USB to UART Bridge (COMx).

3.3 Install the ESP32 board package

  1. File → Preferences → Additional boards manager URLs: https://espressif.github.io/arduino-esp32/package_esp32_index.json
  2. Tools → Board → Boards Manager → search esp32 → install esp32 by Espressif Systems (takes several minutes).

3.4 Install the libraries

  1. Tools → Manage Libraries → search RadioLib (by Jan Gromes). In the version dropdown, choose 7.1.2 (or another 7.0–7.2), then Install.
  2. Search SSD1306 → install ESP8266 and ESP32 OLED driver for SSD1306 displays (ThingPulse).
Important: RadioLib 7.7 and newer (including 7.8.1) changed how the radio starts and will not compile with these programs. Ignore any "update available" prompt for RadioLib.

3.5 Select the board and port (every time you plug in a board)

  1. Click the board dropdown at the top → Select other board and port...
  2. Type heltec in the search box → tick Heltec WiFi LoRa 32(V3).
  3. Under PORTS tick the board's COM port → OK.

4. Erase a board (factory reset)

  1. File → New Sketch (leave the blank code as is).
  2. Tools → Erase All Flash Before Sketch Upload → Enabled.
  3. Upload. In the output, look for "Flash memory erased successfully".
  4. Set Erase All Flash back to Disabled.

A blank screen afterwards is normal. Erasing also clears the remote's counter: if you erase one gate board, erase and reprogram all three gate boards.

5. Test a board's screen

  1. Open OLED_Test.ino, check board and port, Upload.
  2. The screen shows "OLED works!" with a count going up each second.
  3. If the text is upside down, add or remove display.flipScreenVertically(); right after display.init();.

6. Program the four boards

How to load a program

  1. File → Open → pick the .ino inside its folder (or File → New Sketch, click in the code, Ctrl+A, then Ctrl+V to paste).
  2. Change the settings listed below. Change only the text between quote marks; keep the quotes and the semicolon.
  3. Select board and port (3.5), then click Upload. Success ends with "Hash of data verified" and "Hard resetting via RTS pin...".

Line numbers: File → Preferences → tick "Show line numbers". The SECRET_KEY is case sensitive and must be identical in all three gate programs.

6.1 gate_receiver (board 1)

LineSettingSet to
24SECRET_KEYYour phrase (same in all three gate programs)
29HAVE_REED_SWITCHfalse until the gate reed switch is installed, then true
30LIGHT_ON_SECONDS15 (light time after the gate closes)
31REED_CLOSED_LEVELLOW; change to HIGH if the light comes on when the gate opens
35HEARTBEAT_MIN30 (how often it checks in with the bridge)
36HAVE_BATTERY_SENSEtrue once the 2-resistor battery divider is fitted
38BATT_DIVIDERAdjust until the battery reading matches a multimeter
44RELAY_ONHIGH; change to LOW if the relays work backwards

Check: Serial Monitor at 115200, press RST → "Gate receiver ready". Its screen stays dark on purpose (saves the gate battery).

6.2 gate_remote (board 2)

LineSettingSet to
14SECRET_KEYSame phrase
114flipScreenVerticallyAdd // at the start if the text is upside down

Check: the screen shows Gate Remote / Ready. Press PRG → "Gate OK".

6.3 gate_bridge (board 3)

LineSettingSet to
31SECRET_KEYSame phrase
32WIFI_SSIDYour WiFi name (2.4 GHz)
33WIFI_PASSYour WiFi password
34NTFY_TOPICLong random topic, e.g. gate-7fk29xq4mz81
35PINYour 4-digit PIN
37GARAGE_URLhttp://garage.local, or the garage controller's address
39FLIP_SCREENfalse if the text is upside down
43LOW_BATT_V12.0 ("Gate battery low" below this)
44GATE_OFFLINE_MIN75 (minutes before "Gate receiver not responding")
45WATCH_GARAGEtrue (alert if the garage controller goes offline)
46NIGHT_CHECK_HOUR22 = 10 PM; -1 = off
47NIGHT_AUTO_CLOSEtrue = close the gate at the night check instead of alerting

Check: the screen shows Gate Bridge, its address (e.g. 192.168.1.45) and Ready. The gate page at http://gate.local now also has a Garage section.

6.4 garage_controller (board 4)

LineSettingSet to
25WIFI_SSIDYour WiFi name
26WIFI_PASSYour WiFi password
27NTFY_TOPICThe SAME topic as the gate bridge
28PINYour PIN
30FLIP_SCREENfalse if the text is upside down
35HAVE_GARAGE_REEDtrue once the door reed switch is installed
36CLOSED_LEVELLOW; change to HIGH if open/closed are reversed
37RELAY_ONHIGH; change to LOW if the relay works backwards
39LEFT_OPEN_MINMinutes before the "left open" alert (0 = off)
40REMIND_EVERY_MINHow often to repeat the reminder
41NIGHT_CHECK_HOUR22 = 10 PM; -1 = off
42NIGHT_AUTO_CLOSEtrue = close the door at the night check instead of alerting

No SECRET_KEY here: this board does not use LoRa. Check: the screen shows Garage Controller, its address and Ready.

7. Solder the pin headers

Only the gate receiver and garage controller need headers (they connect to wires). The bridge and remote don't.

  1. Push the two long pin strips into the breadboard, long ends down, spaced to match the board's two rows of holes.
  2. Lay the Heltec on top so the short ends poke up through its holes. Unplug USB.
  3. Heat the iron to about 350 °C / 660 °F. Solder one pin at each end first.
  4. Solder each remaining pin: touch the iron to pin and pad 1–2 s, feed solder until a small shiny cone forms.
  5. Check that no solder joins two neighbouring pins. Keep the iron away from the screen and antenna cable.

Pin names: GPIO 5, 6, 7 are the pins with 5, 6, 7 printed beside them, not the 5th or 7th pin counted along the row.

8. Test on the breadboard

  1. Relay wiring: DC+ (VCC) → 5V, DC− (GND) → GND, IN → GPIO 7 (2-channel: IN1 → GPIO 7, IN2 → GPIO 6). Trigger jumper on H.
  2. Test load: 3V3 → relay COM; relay NO → 330 Ω resistor → LED long leg; LED short leg → GND.
  3. Press Open on the phone page: the relay clicks and the LED lights for half a second.
  4. Reed test without a switch: set HAVE_REED_SWITCH to true, upload, touch a wire between GPIO 5 and GND → phone gets "Gate closed"; remove it → "Gate opened".

9. Install at the gate

See page 1 of Gate_and_Garage_Wiring.pdf.

  1. Turn the opener off with its rocker switch.
  2. Measure AUX PWR with a multimeter: it should read 12–14 V. If not, feed the converter from the battery through a 2 A fuse instead.
  3. Converter input → AUX PWR + and −, alongside the existing red and yellow magnetometer wires. Converter USB-C → gate receiver.
  4. Relay 1 COM → CYCL; relay 1 NO → the empty COM terminal. Do not move the black (COM) or blue (EXIT) wires.
  5. Gate light: battery + → 2 A fuse → relay 2 COM; relay 2 NO → light +; light − → battery −.
  6. Reed switch on the gate post, magnet on the gate (within about 1/2 inch when closed), wired to GPIO 5 and GND. Set HAVE_REED_SWITCH to true and upload.
  7. Mount the Heltec in the open area on the right of the box or in a small weatherproof box beside it, antenna pointing up. Turn the opener back on.

10. Install in the garage

See page 2 of the wiring PDF (use the garage controller in place of the bridge).

  1. Quick test first: with the opener plugged in, briefly touch a wire across the two wall-button terminals. The door should move.
  2. Unplug the opener. Relay DC+ → 5V, DC− → GND, IN → GPIO 7.
  3. Relay COM and NO → the two wall-button terminals (same screws as the existing wall button; either way round). Use bell wire.
  4. Optional door reed switch on the frame, magnet on the door → GPIO 5 and GND; set HAVE_GARAGE_REED to true.
  5. Power the controller from a USB charger. Plug the opener back in and test.

11. Set up the phones (iPhone or Android)

Home-screen buttons (home WiFi)

  1. On home WiFi, open http://gate.local and http://garage.local (or the address on each board's screen).
  2. iPhone (Safari): Share → Add to Home Screen → tap Add at the top right. Android (Chrome): ⋮ → Add to Home screen → Add.

Alerts and control from anywhere (ntfy)

  1. Install the free ntfy app (App Store / Google Play). Tap + and subscribe to your topic (server ntfy.sh).
  2. To send commands, open https://ntfy.sh/<your topic> in the browser and type a command. Add this page to the home screen as "Gate away".
The topic name works like a password: keep it long and random, and use a PIN you don't use elsewhere.

12. Everyday use

ToAt home (web page)Anywhere (ntfy)
Open / close gateOpen gate / Close gateopen 4821 / close 4821
Open gate for a timeOpen 5 / 15 / 30 minopen 4821 15 (1–240 min)
Gate statusShown at the topstatus
Open / close garageOpen garage / Close garagegarage open 4821 / garage close 4821
Garage statusShown at the topgarage status

13. Power, solar and outages

14. Troubleshooting

ProblemFix
"NO PORTS DISCOVERED"Use a data USB-C cable; install the CP210x driver (3.2)
Board missing from the listInstall esp32 by Espressif (3.3); restart Arduino IDE; type "heltec" in the search box
"Missing FQBN"No board selected: do 3.5
"RadioLib.h: No such file"Install RadioLib (3.4)
"no matching function for call to SX1262::begin"RadioLib too new: install 7.1.2
"SECRET_KEY was not declared"The SECRET_KEY line was damaged: const char SECRET_KEY[] = "your-phrase";
"'isplay' was not declared"A typo: the d of display is missing
Upload won't startHold PRG, tap RST, release PRG, Upload again; set Upload Speed to 115200
Remote shows "No reply"Receiver powered? Antennas on? SECRET_KEY identical in all programs? Boards at least 1 m apart
Remote screen blankgate_remote not uploaded yet
Fast-blinking white LED on receiverRadio failed to start: check board is V3; read the number in Serial Monitor
Slow blinking white LEDThe blink test program is still loaded: upload the real program
Page says "Bridge not reachable" / "not available"Phone on home WiFi? Board screen shows Ready? Address changed → use gate.local / garage.local or the new address; reserve the address in your router (DHCP reservation)
Home-screen icon missingSwipe through pages or search; repeat Add to Home Screen and tap Add
"Timed open needs the reed switch"Normal until the gate reed switch is installed and HAVE_REED_SWITCH is true
Relay works backwardsSet the trigger jumper to H, or change RELAY_ON to LOW
Text upside downChange FLIP_SCREEN, or add/remove the flipScreenVertically line