
Type e
google/mozc-devices
Circuit diagrams and firmware source code for Gboard DIY keyboards

An ESP32-based mouse trap monitoring system that integrates with Home Assistant via MQTT. The system uses light-dependent resistors (LDRs) to detect both the trap state (triggered/ready) and battery status (ok/low)…
WakeCircuit is an open-source printed circuit board by Tailslide, from the Tailslide/ha_light_sensor repository on GitHub. It is a 2-layer board of 34 × 21.3 mm with 16 parts on 27 nets, routed with 128 tracks and 20 vias.
Its parts include 5 resistors, 4 capacitors, 3 connectors, 2 ICs and 1 diode.
An ESP32-based mouse trap monitoring system that integrates with Home Assistant via MQTT. The system uses light-dependent resistors (LDRs) to detect both the trap state (triggered/ready) and battery status (ok/low), providing real-time updates to your Home Assistant instance.
The project follows a modular architecture for better organization and maintainability:
├── main/ # Core application code
│ ├── include/ # Header files
│ │ ├── common.h # Common definitions and utilities
│ │ ├── wifi_manager.h # WiFi connection management
│ │ ├── mqtt_manager.h # MQTT client operations
│ │ ├── sensor_manager.h # ADC and sensor handling
│ │ ├── led_controller.h # LED control functions
│ │ └── diagnostic.h # Diagnostic mode operations
│ ├── src/ # Source files
│ │ ├── main.c # Main application entry
│ │ ├── wifi_manager.c # WiFi implementation
│ │ ├── mqtt_manager.c # MQTT implementation
│ │ ├── sensor_manager.c # Sensor implementation
│ │ ├── led_controller.c # LED implementation
│ │ └── diagnostic.c # Diagnostic implementation
│ └── CMakeLists.txt # Component build configuration
└── traps/ # Trap-specific configurations
├── backdoor/ # Back door trap config
│ ├── config.h.template # Configuration template
│ └── secrets.h.template # Credentials template
├── garage_near/ # Garage near trap config
│ ├── config.h.template # Configuration template
│ └── secrets.h.template # Credentials template
└── template/ # Template for new traps
├── config.h.template # Configuration template
└── secrets.h.template # Credentials templateIf using the optional wake circuit:
LDR Circuit:
3.3V ----[LDR]----+----[10kΩ]---- GND
|
+---- TLV7011 Pin 3 (IN+)Trim Pot Circuit:
3.3V ----[10kΩ Trim Pot]----+---- GND
|
+---- TLV7011 Pin 4 (IN-)The project now supports multiple mouse traps with individual configurations. Each trap has its own configuration directory under traps/.
backdoor - Back door mouse trap (original)garage_near - Garage near entrance traptemplate directoryThe project includes a sdkconfig.defaults file with optimized settings for power consumption:
# Power Management - Enable automatic power saving
CONFIG_PM_ENABLE=y
CONFIG_PM_DFS_INIT_AUTO=y
CONFIG_PM_USE_RTC_TIMER_REF=y
# CPU Frequency - Lower to 80MHz to save power
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80=y
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=80
# Flash Power Down in Deep Sleep
CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y
# WiFi Power Saving
CONFIG_ESP_WIFI_SLP_IRAM_OPT=y
CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME=100
CONFIG_ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME=5
CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE=y
# Minimize Logging
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y
CONFIG_LOG_DEFAULT_LEVEL=1These settings are automatically applied during the build process and significantly reduce power consumption.
Clone this repository
Choose a trap to build:
traps/ directorytraps/template:
copy traps\template traps\your_new_trapConfigure the trap:
a. Copy traps/your_trap/secrets.h.template to secrets.h in the same directory:
#define WIFI_SSID "your_wifi_ssid"
#define WIFI_PASS "your_wifi_password"
#define MQTT_BROKER "your.mqtt.broker.ip"
#define MQTT_USERNAME "your_mqtt_username"
#define MQTT_PASSWORD "your_mqtt_password"b. Edit traps/your_trap/config.h:
Build and flash for a specific trap:
# For backdoor trap (default if no trap specified)
powershell -Command "& {. 'C:\Users\username\esp\v5.4\esp-idf\export.ps1'; idf.py build flash}"
# For garage near trap (clean first when switching targets)
powershell -Command "& {. 'C:\Users\username\esp\v5.4\esp-idf\export.ps1'; idf.py clean; idf.py -DTRAP_ID=garage_near build flash}"Note: Always run idf.py clean before building for a different trap target to ensure the correct configuration is used.
Copy the template directory:
copy traps\template traps\new_trap_nameEdit the new trap's config.h:
Configure secrets.h as above
Build using:
# Clean first when switching from another target
powershell -Command "& {. 'C:\Users\username\esp\v5.4\esp-idf\export.ps1'; idf.py clean; idf.py -DTRAP_ID=new_trap_name build flash}"DEBUG_LOGS: Set to 1 to enable debug messages, 0 to disable (default: 0)
MQTT_PORT: MQTT broker port (default: 1883)MQTT_TOPIC_CAUGHT: Topic for trap state updates (default: "home/mousetrap/backdoor/state")MQTT_TOPIC_BATTERY: Topic for battery status updates (default: "home/mousetrap/backdoor/battery")MQTT_TOPIC_AVAILABILITY: Topic for device availability status (default: "home/mousetrap/backdoor/availability")BURST_DURATION_MS: Duration of each sampling burst (default: 12000ms)SAMPLE_INTERVAL_MS: Interval between samples during burst (default: 20ms)SLEEP_TIME_SECONDS: Deep sleep duration between bursts (default: 30 minutes)HEARTBEAT_INTERVAL_HOURS: How often to force publish state updates (default: 24 hours)CYCLES_PER_HOUR: Automatically calculated based on sleep time (2 cycles per hour with default sleep time)CYCLES_FOR_PUBLISH: Automatically calculated based on HEARTBEAT_INTERVAL_HOURS and sleep time
(e.g., with 30-minute sleep time and 24-hour interval: 2 cycles/hour * 24 hours = 48 cycles)TRAP_THRESHOLD: ADC threshold for trap triggered state (default: 50)BATTERY_THRESHOLD: ADC threshold for low battery state (default: 200)USE_WAKE_CIRCUIT: Set to 1 to enable external comparator wake circuit, 0 to use standard ADC sampling (default: 0)WAKE_PIN: GPIO pin connected to comparator output (default: GPIO5)Add configurations for each trap to your Home Assistant configuration. Here's the complete setup for both existing traps:
mqtt:
binary_sensor:
# Back Door Trap
- name: "Back Door Mouse Trap"
unique_id: "backdoor_mousetrap_state"
state_topic: "home/mousetrap/backdoor/state"
payload_on: "triggered"
payload_off: "ready"
device_class: occupancy
availability_topic: "home/mousetrap/backdoor/availability"
payload_available: "online"
payload_not_available: "offline"
- name: "Back Door Mouse Trap Battery"
unique_id: "backdoor_mousetrap_battery"
state_topic: "home/mousetrap/backdoor/battery"
payload_on: "low"
payload_off: "ok"
device_class: problem
availability_topic: "home/mousetrap/backdoor/availability"
payload_available: "online"
payload_not_available: "offline"
# Garage Near TrapThe MQTT will message feature ensures that sensors will automatically become unavailable if the device disconnects unexpectedly. This provides more accurate and immediate monitoring of device health compared to the previous expire_after approach.
Benefits of using MQTT will messages:
You can still create automations to monitor device health using the unavailable state:
automation:
- alias: "Back Door Mouse Trap Disconnected"
trigger:
- platform: state
entity_id: binary_sensor.back_door_mouse_trap
to: unavailable
action:
- service: notify.notify
data:
message: Your Back Door mouse trap hasn't reported in over 36 hours.
- alias: "Garage Near Mouse Trap Disconnected"
trigger:
- platform: state
entity_id: binary_sensor.garage_near_mouse_trap
to: unavailable
action:
- service: notify.notify
data:
message: Your Garage Near mouse trap hasn't reported in over 36 hours.These automations will notify you if any trap becomes unavailable, which happens automatically after 36 hours without updates (allowing a buffer over the 24-hour heartbeat).
When the device is started by holding down the button on boot, it enters diagnostic mode:
This mode allows for real-time adjustment of the trim pot to set the desired light threshold when using the wake circuit.
If the device disconnects unexpectedly, the MQTT broker will automatically publish the configured will message ("offline") to the availability topic, allowing Home Assistant to immediately mark the device as unavailable.
The device is designed to be power efficient:
The dual sleep mode strategy maximizes power efficiency:
TRAP_THRESHOLD and BATTERY_THRESHOLD values in config.hSLEEP_TIME_SECONDSBURST_DURATION_MS or decrease SAMPLE_INTERVAL_MSDEBUG_LOGS to 1 in config.h
esp_deep_sleep_enable_gpio_wakeup() instead of gpio_wakeup_enable() and esp_sleep_enable_gpio_wakeup()ESP_SLEEP_WAKEUP_GPIO and ESP_SLEEP_WAKEUP_EXT0 wake causes in your codeThis project is open source and available under the MIT License.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 3 | 10K | Resistor_SMD:R_0805_2012Metric | R1, R3, R4 |
| 2 | 100nF | Capacitor_SMD:C_0805_2012Metric | C1, C3 |
| 1 | 1.2K | Resistor_SMD:R_0805_2012Metric | R5 |
| 1 | 10K | Potentiometer_SMD:Potentiometer_Bourns_3214J_Horizontal | RV1 |
| 1 | 10uF | Capacitor_SMD:C_0805_2012Metric | C4 |
| 1 | 1N4148 | Diode_SMD:D_SOD-123F | D1 |
| 1 | 2.2M | Resistor_SMD:R_0805_2012Metric | R2 |
| 1 | 22uF | Capacitor_Tantalum_SMD:CP_EIA-3216-18_Kemet-A | C2 |
| 1 | 4013 | Package_SO:TSSOP-14_4.4x5mm_P0.65mm | U3 |
| 1 | Conn_01x03_Socket | Connector_JST:JST_PH_S3B-PH-K_1x03_P2.00mm_Horizontal | J4 |
| 1 | Conn_01x10_Socket | Connector_PinSocket_2.54mm:PinSocket_1x10_P2.54mm_Vertical | J2 |
| 1 | Conn_01x12_Socket | Connector_PinSocket_2.54mm:PinSocket_1x12_P2.54mm_Vertical | J1 |
| 1 | TLV7011DBVR | TLV7011DBVR:SOT_1DBVR_TEX | U1 |
It measures 34 × 21.3 mm and has 2 copper layers, 1.6 mm thick.
16 parts. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the Tailslide/ha_light_sensor repository on GitHub, at the commit this page was made from: the board is kicad/WakeCircuit/WakeCircuit.kicad_pcb and its schematic kicad/WakeCircuit/WakeCircuit.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask Tailslide before reusing the design.

google/mozc-devices
Circuit diagrams and firmware source code for Gboard DIY keyboards

conorpp/u2f-zero
U2F USB token optimized for physical security, affordability, and style

rusefi/rusefi
rusefi - GPL internal combustion engine control unit

VoronDesign/Voron-Hardware
Cool Hardware designed by the Voron Design group

hoglet67/RGBtoHDMI
Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

hackclub/OnBoard
💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

