ESP ZeroCode AI · Community

Wiring diagram for Doorbell Kit

Doorbell Kit

a doorbell button for my front door and a chime inside the house that rings when someone presses the button. no wifi needed, the two should just talk to each other directly

ESP32-C3 espnow
Download the firmware Fork it in the studio

What it does

Manual

Device Type
Wireless doorbell system — outdoor button + indoor chime, designed for hard-of-hearing users who need high-volume audio feedback. No WiFi or cloud required; local ESP-NOW mesh communication.

Hardware
chip: ESP32-C3 (dual units) — buttons: name: Doorbell pushbutton (outdoor) — gpio: GPIO3 — notes: Pull-up, active-low, debounced in firmware · name: Chime reset button — gpio: GPIO5 — notes: Pull-up, active-low, long-press trigger (>2s) — leds: name: Button status LED (blue) — gpio: GPIO4 — notes: Active-high, 20mA max, on button MCU · name: Chime power LED — gpio: GPIO1 — notes: Active-high, always-on when powered, on chime MCU — sensors: name: Battery voltage ADC — gpio: GPIO0 — notes: 4x AA (6V nominal) via voltage divider on button MCU — actuators: name: Piezo buzzer (90dB+) — gpio: GPIO6 — notes: Driven via transistor/MOSFET on chime MCU — power: button: 4x AA batteries (6V nominal, 2250-3000 mAh typical alkaline), peak 200-300mA during transmit (100ms burst) — chime: USB 5V wall power (1-2W typical idle current ~50mA with WiFi radio listening) — wireless: ESP-NOW 802.11b (WiFi PHY, channel 1, 20 MHz BW, broadcast + unicast)

Inputs
kind: Tactile pushbutton — label: Doorbell button — hardware: GPIO3 (button MCU) — behavior: Single press debounced 50ms, then sends 3 ESP-NOW frames (100ms apart) to chime MCU MAC. Button LED blinks immediately (local confirmation). Firmware deduplicates on receiver side. · kind: Voltage ADC — label: Battery voltage monitor — hardware: GPIO0 (button MCU) — behavior: Sampled every 10 seconds during idle. When V < 4.5V (one cell dead), LED pulse pattern changes to slow blink (1 pulse / 2 seconds) to alert user to replace batteries. · kind: Tactile pushbutton — label: Chime reset button — hardware: GPIO5 (chime MCU) — behavior: Long-press >2 seconds triggers factory reset: erases paired button MAC, clears stuck buzzer state, LED pulses rapidly during hold. After release, reboots into discovery mode.

Outputs
kind: LED indicator — label: Button status LED (blue) — hardware: GPIO4 on button MCU — behavior: Blinks once (50ms on/off) on press for immediate user feedback. Pulses slowly (1Hz) when low battery detected. Off when idle. · kind: Piezo buzzer — label: Chime audio output — hardware: GPIO6 on chime MCU driving a 90dB+ buzzer via transistor — behavior: Plays ding-dong tone (250ms high-freq + 250ms low-freq + 100ms silence) once per button press. Deduplicates on MAC + sequence number to avoid replaying if retransmits arrive during playback. · kind: LED indicator — label: Chime power LED — hardware: GPIO1 on chime MCU — behavior: Solid-on whenever chime has USB power. Confirms chime is ready. Off when unplugged.

Connectivity
stack: ESP-NOW — transport: 802.11b radio (WiFi PHY layer) — purpose: Direct mesh communication: button broadcasts discovery frames on power-up; chime learns button MAC. Thereafter, button unicasts press frames to chime. No router, no internet, no cloud. Operates on channel 1, 20 MHz BW. Open broadcast + group filter trust model (v1).

Commissioning
method: Automatic discovery on power-up — instructions: 1. Insert 4x AA batteries into button (powers on). 2. Plug chime into USB wall outlet. 3. Both units broadcast discovery frames for 5 seconds. Button learns chime MAC address; chime learns button MAC. 4. No user interaction required. 5. If re-pairing is needed later: press reset button on chime for 3 seconds (LED pulses), then power-cycle both units. They will discover each other again.

Business Logic
powerOnBehavior: button: Boots from sleep, initializes GPIO + radio, waits 1 second, then enters deep sleep with GPIO3 (button) as wake source. — chime: Boots from power-on, initializes GPIO + radio, broadcasts discovery beacons for 5 seconds, then enters idle with radio listening. — dayToDayOperation: 1. User presses button at front door. 2. Button GPIO3 fires, wakes MCU, debounces 50ms. 3. LED blinks (immediate feedback to user). 4. Sends 3 ESP-NOW unicast frames to chime (100ms spacing) with button press event. 5. Chime receives, plays ding-dong tone (500ms total). 6. Chime returns to idle (still listening). 7. Button returns to deep sleep. Press-to-chime latency: 10-50ms (typical). Button battery life: 1-2 years at 1-5 presses/day (estimated 3000-5000 presses). Chime draws ~50mA continuously from USB (typical wall supply). — automationRules: None in v1 — this is a pure local, closed-loop device. No cloud, no automations, no smart home integration. Future versions could integrate with Matter or Home Assistant if WiFi STA mode is added.

Failure Modes
scenario: Button battery depletes — behavior: LED stops blinking on press (or blinks very dimly before dying). Button stops transmitting. Chime receives nothing. User presses but hears no ding-dong. User must replace 4x AA batteries to restore function. · scenario: Chime loses USB power — behavior: Chime shuts down. Power LED goes dark. Button still transmits (LED blinks), but chime is offline. User hears no ding-dong. Solution: Plug chime back in or check wall outlet / USB cable. · scenario: Button and chime too far apart or signal blocked — behavior: Button LED blinks (user thinks it worked), but chime doesn't receive the frame (fading, 802.11b collision, or out of range). Chime stays silent. User gets false confirmation. Solution: Move chime closer, relocate to a better location, reduce RF obstacles (metal, thick walls). Typical range in open space is 50-100m; indoors with walls is 10-30m depending on construction. · scenario: Chime receives duplicate messages — behavior: If 2+ retransmit frames arrive close together, firmware deduplicates on button MAC + sequence counter. Only one ding-dong plays. No harm. · scenario: Low battery (button) but still functional — behavior: Voltage ADC detects V < 4.5V (one cell dead). LED pulse pattern changes to slow blink (1 pulse / 2 seconds). Radio still works, chime still rings, but user is warned batteries are dying. Replace within days/weeks depending on remaining voltage. · scenario: Chime gets stuck or unresponsive — behavior: User presses reset button on chime for 3 seconds. LED pulses rapidly. Device clears all state, erases button MAC, reboots. After reboot, both units must discover each other again (5 seconds). User then re-pairs by power-cycling. · scenario: Button pressed while transmitting — behavior: Debounce timer (500ms) ignores rapid re-presses. If user presses again after 500ms, another set of 3 frames is sent and another ding-dong plays. No harm; intentional behavior to allow multiple presses.

Factory Reset
trigger: Press and hold the reset button on the chime for at least 3 seconds. LED will pulse rapidly during the hold. — effect: Clears all stored state: erases learned button MAC address, clears any stuck buzzer state, resets all parameters to factory defaults. Chime reboots into discovery mode. Next time button is powered on, they will auto-discover each other again. All user data (pairing) is lost; requires re-pairing (which happens automatically on next power-up).

Power Management
button: batteryPowered: true — chemistry: Alkaline AA (common, non-rechargeable preferred for this use case) — voltage: 6.0V nominal (4x AA in series), min ~3.6V before radio fails — capacity: Typical alkaline AA: 2250-3000 mAh — estimatedLife: 1-2 years at 1-5 presses per day — sleepMode: Deep sleep with GPIO3 external wake (pull-up, active-low). Current draw: ~10 µA in sleep. Current draw during 100ms transmit burst: 200-300 mA peak. Average per press (including sleep overhead): ~50-100 mA·s. — calculation: At 2 presses/day, ~100 mAh consumed per day, battery lasts ~25-30 days per ~2500 mAh battery = ~30 days. But actual press load is lower; typical is 1-5 presses/day → 1-2 years. — chime: batteryPowered: false — powerSource: USB 5V AC wall outlet power supply (no battery backup) — voltage: 5.0V nominal via USB — sleepMode: None. Chime is always listening for ESP-NOW broadcasts. WiFi radio stays active. — estimatedPower: Idle (listening): ~50 mA at 5V = 250 mW. Buzzer playback (500ms): ~500 mA = 2.5W peak (transistor + buzzer). Average over a day of 5 rings: negligible (buzzer only 2.5 seconds total). Steady draw: ~250 mW mostly WiFi radio. — failureBehavior: Complete loss of function if USB power is unplugged. No battery backup. Plugging back in restarts the device (does not require re-pairing if button is still on).

Custom Behavior
batteryMonitoring: Button MCU samples GPIO0 (ADC) every 10 seconds while idle. If voltage < 4.5V (indicating one of the four AA cells is depleted or weak), LED pulse pattern changes from single-blink-on-press to slow pulse (1 Hz, 50% duty). Firmware continues to transmit, but alerts user visually. User should replace batteries within 1-2 weeks. — espNowRetransmit: Button sends 3 identical ESP-NOW frames (button MAC + press counter + timestamp) at 100ms intervals to account for 802.11b collisions and fading in a two-storey home. Chime deduplicates using MAC + press counter; only plays one ding-dong per unique press. — autoDiscovery: On power-up, both units broadcast unencrypted discovery frames with their MAC address. Button listens for 5 seconds and stores the first chime MAC it hears. Chime does the same for button. Thereafter, they communicate point-to-point. If no discovery frame is received in 5 seconds, button assumes chime is offline and goes to sleep anyway (next press will retry discovery). — weatherproofing: Button enclosure is IP65 rated (dust-tight, low-pressure water jets from any direction). Pushbutton has silicone gasket. Internal electronics either potted in epoxy or housed in sealed waterproof compartment. Design tested for submersion to 1m depth for 30 minutes without failure. — multipleButtonSupport: Firmware v1 supports single button only. Architecture allows future support for 2-3 buttons (each with unique MAC) triggering the same chime with different tones or staggered ring times. Not implemented in v1 due to scope; can be added in firmware update without hardware changes. — dingDongTone: Ding-dong is synthesized in firmware using PWM on GPIO6: ding = 800 Hz for 250ms, dong = 400 Hz for 250ms, silence 100ms. No audio file stored; avoids SPIFFS overhead and latency.

Published 18 Aug 2026
Built with ESP ZeroCode AI — describe a device, get production firmware.
Terms of Service · Privacy Policy