Gate and Garage Project
Step-by-step instructions · Heltec WiFi LoRa 32 V3 · Mighty Mule gate and Genie 3055 garage opener
Contents
- How the system works
- Parts list
- Set up the computer
- Erase a board (factory reset)
- Test a board's screen
- Program the four boards
- Solder the pin headers
- Test on the breadboard
- Install at the gate
- Install in the garage
- Set up the phones
- Everyday use
- Power, solar and outages
- Troubleshooting
1. How the system works
| Board | Program | Where it lives | What it does |
| 1. Gate receiver | gate_receiver | Mighty Mule control box | Presses the gate's CYCL input with a relay; runs the 15-second gate light; reports open/closed |
| 2. Handheld remote | gate_remote | With you or in the car | Press PRG to open/close the gate over LoRa |
| 3. Gate bridge | gate_bridge | In the house, on WiFi | Phone page http://gate.local; ntfy alerts and commands; passes commands to the gate over LoRa |
| 4. Garage controller | garage_controller | Next to the Genie opener | Phone 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
| Part | For | What to look for |
| 4 × Heltec WiFi LoRa 32 V3 + antennas | All | Antenna screwed on before use |
| USB-C data cable | Programming | Must carry data, not charge only |
| 2-channel relay module | Gate | Works with 3.3 V logic |
| 1-channel relay module | Garage | Pins DC+, DC−, IN; trigger jumper on H |
| 12 V to 5 V USB-C converter | Gate | DC-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 light | Outdoor rated |
| Inline blade fuse holder + 2 A fuse | Gate light | Fit close to battery + |
| 18 AWG outdoor wire; bell wire | Gate; garage | 2-conductor |
| Breadboard kit | Testing | Male-female jumpers, LEDs, 330 Ω resistors |
| Soldering iron + solder | Headers | 30–60 W, 0.8 mm rosin-core solder |
| 3.7 V LiPo, 1.25 mm JST (optional) | Remote | Check + and − match the board before plugging in |
3. Set up the computer (once)
3.1 Install Arduino IDE
- Download Arduino IDE 2.x from arduino.cc/en/software and install it.
3.2 Install the USB driver (Windows)
- Plug in a board. Open Device Manager (right-click Start).
- If you see CP2102 USB to UART Bridge Controller with a yellow warning, the driver is missing.
- Go to silabs.com/developers/usb-to-uart-bridge-vcp-drivers → Downloads → CP210x Universal Windows Driver.
- Right-click the zip → Extract All. In the folder, right-click silabser.inf → (Show more options) → Install.
- 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
- File → Preferences → Additional boards manager URLs:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
- Tools → Board → Boards Manager → search esp32 → install esp32 by Espressif Systems (takes several minutes).
3.4 Install the libraries
- Tools → Manage Libraries → search RadioLib (by Jan Gromes). In the version dropdown, choose 7.1.2 (or another 7.0–7.2), then Install.
- 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)
- Click the board dropdown at the top → Select other board and port...
- Type heltec in the search box → tick Heltec WiFi LoRa 32(V3).
- Under PORTS tick the board's COM port → OK.
4. Erase a board (factory reset)
- File → New Sketch (leave the blank code as is).
- Tools → Erase All Flash Before Sketch Upload → Enabled.
- Upload. In the output, look for "Flash memory erased successfully".
- 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
- Open OLED_Test.ino, check board and port, Upload.
- The screen shows "OLED works!" with a count going up each second.
- 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
- File → Open → pick the .ino inside its folder (or File → New Sketch, click in the code, Ctrl+A, then Ctrl+V to paste).
- Change the settings listed below. Change only the text between quote marks; keep the quotes and the semicolon.
- 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)
| Line | Setting | Set to |
| 24 | SECRET_KEY | Your phrase (same in all three gate programs) |
| 29 | HAVE_REED_SWITCH | false until the gate reed switch is installed, then true |
| 30 | LIGHT_ON_SECONDS | 15 (light time after the gate closes) |
| 31 | REED_CLOSED_LEVEL | LOW; change to HIGH if the light comes on when the gate opens |
| 35 | HEARTBEAT_MIN | 30 (how often it checks in with the bridge) |
| 36 | HAVE_BATTERY_SENSE | true once the 2-resistor battery divider is fitted |
| 38 | BATT_DIVIDER | Adjust until the battery reading matches a multimeter |
| 44 | RELAY_ON | HIGH; 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)
| Line | Setting | Set to |
| 14 | SECRET_KEY | Same phrase |
| 114 | flipScreenVertically | Add // 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)
| Line | Setting | Set to |
| 31 | SECRET_KEY | Same phrase |
| 32 | WIFI_SSID | Your WiFi name (2.4 GHz) |
| 33 | WIFI_PASS | Your WiFi password |
| 34 | NTFY_TOPIC | Long random topic, e.g. gate-7fk29xq4mz81 |
| 35 | PIN | Your 4-digit PIN |
| 37 | GARAGE_URL | http://garage.local, or the garage controller's address |
| 39 | FLIP_SCREEN | false if the text is upside down |
| 43 | LOW_BATT_V | 12.0 ("Gate battery low" below this) |
| 44 | GATE_OFFLINE_MIN | 75 (minutes before "Gate receiver not responding") |
| 45 | WATCH_GARAGE | true (alert if the garage controller goes offline) |
| 46 | NIGHT_CHECK_HOUR | 22 = 10 PM; -1 = off |
| 47 | NIGHT_AUTO_CLOSE | true = 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)
| Line | Setting | Set to |
| 25 | WIFI_SSID | Your WiFi name |
| 26 | WIFI_PASS | Your WiFi password |
| 27 | NTFY_TOPIC | The SAME topic as the gate bridge |
| 28 | PIN | Your PIN |
| 30 | FLIP_SCREEN | false if the text is upside down |
| 35 | HAVE_GARAGE_REED | true once the door reed switch is installed |
| 36 | CLOSED_LEVEL | LOW; change to HIGH if open/closed are reversed |
| 37 | RELAY_ON | HIGH; change to LOW if the relay works backwards |
| 39 | LEFT_OPEN_MIN | Minutes before the "left open" alert (0 = off) |
| 40 | REMIND_EVERY_MIN | How often to repeat the reminder |
| 41 | NIGHT_CHECK_HOUR | 22 = 10 PM; -1 = off |
| 42 | NIGHT_AUTO_CLOSE | true = 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.
- Push the two long pin strips into the breadboard, long ends down, spaced to match the board's two rows of holes.
- Lay the Heltec on top so the short ends poke up through its holes. Unplug USB.
- Heat the iron to about 350 °C / 660 °F. Solder one pin at each end first.
- Solder each remaining pin: touch the iron to pin and pad 1–2 s, feed solder until a small shiny cone forms.
- 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
- Relay wiring: DC+ (VCC) → 5V, DC− (GND) → GND, IN → GPIO 7 (2-channel: IN1 → GPIO 7, IN2 → GPIO 6). Trigger jumper on H.
- Test load: 3V3 → relay COM; relay NO → 330 Ω resistor → LED long leg; LED short leg → GND.
- Press Open on the phone page: the relay clicks and the LED lights for half a second.
- 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.
- Turn the opener off with its rocker switch.
- 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.
- Converter input → AUX PWR + and −, alongside the existing red and yellow magnetometer wires. Converter USB-C → gate receiver.
- Relay 1 COM → CYCL; relay 1 NO → the empty COM terminal. Do not move the black (COM) or blue (EXIT) wires.
- Gate light: battery + → 2 A fuse → relay 2 COM; relay 2 NO → light +; light − → battery −.
- 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.
- 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).
- Quick test first: with the opener plugged in, briefly touch a wire across the two wall-button terminals. The door should move.
- Unplug the opener. Relay DC+ → 5V, DC− → GND, IN → GPIO 7.
- Relay COM and NO → the two wall-button terminals (same screws as the existing wall button; either way round). Use bell wire.
- Optional door reed switch on the frame, magnet on the door → GPIO 5 and GND; set HAVE_GARAGE_REED to true.
- 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)
- On home WiFi, open http://gate.local and http://garage.local (or the address on each board's screen).
- 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)
- Install the free ntfy app (App Store / Google Play). Tap + and subscribe to your topic (server ntfy.sh).
- 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
| To | At home (web page) | Anywhere (ntfy) |
| Open / close gate | Open gate / Close gate | open 4821 / close 4821 |
| Open gate for a time | Open 5 / 15 / 30 min | open 4821 15 (1–240 min) |
| Gate status | Shown at the top | status |
| Open / close garage | Open garage / Close garage | garage open 4821 / garage close 4821 |
| Garage status | Shown at the top | garage status |
- Handheld remote: press PRG. Pressing while the gate moves stops it (Mighty Mule CYCL behaviour).
- Timed open: a Close, a remote press, or the gate closing cancels the timer. Needs the reed switch.
- Open does nothing if already open; Close does nothing if already closed (needs the reed switches).
- ntfy commands take up to 10 s (gate) or 15 s (garage). Web buttons act at once.
- Alerts: Gate opened/closed (and by whom); Garage opened/closed; Garage left open after 10 min, then every 30 min; night check at 10 PM; gate battery low; gate receiver or garage controller not responding.
- Battery sense (gate receiver): gate battery + → 100 kΩ → GPIO 4; GPIO 4 → 22 kΩ → GND. Then set HAVE_BATTERY_SENSE to true.
- Close remotely only when you know the way is clear. Consider a photo beam on the Mighty Mule SAFE terminal.
13. Power, solar and outages
- The gate receiver adds about 5–6 Wh a day to the gate battery. A Mighty Mule solar panel in good sun usually covers it.
- Check the battery in the morning for the first weeks: 12.6 V or more is healthy; sliding toward 12.2 V means the panel isn't keeping up (aim it south, keep it clean and unshaded, or fit a 20 W panel).
- Power outage: the gate, gate receiver, magnetometer and a battery-powered remote keep working. The bridge, garage controller, WiFi and internet stop until power returns (a UPS keeps them running). Everything restarts by itself.
14. Troubleshooting
| Problem | Fix |
| "NO PORTS DISCOVERED" | Use a data USB-C cable; install the CP210x driver (3.2) |
| Board missing from the list | Install 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 start | Hold 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 blank | gate_remote not uploaded yet |
| Fast-blinking white LED on receiver | Radio failed to start: check board is V3; read the number in Serial Monitor |
| Slow blinking white LED | The 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 missing | Swipe 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 backwards | Set the trigger jumper to H, or change RELAY_ON to LOW |
| Text upside down | Change FLIP_SCREEN, or add/remove the flipScreenVertically line |