3af958b69f
- LED matrix doorbell display with scrolling text - Non-blocking HTTP poll state machine for ntfy.sh - Ticker tape pressure gauge (12 cols, 3-min window, PWM decay) - Unix timestamp message filtering (readyTime after NTP sync) - BUILTIN LED sine-wave brightness heartbeat - Pending: remove backup file before merge
112 lines
3.4 KiB
Markdown
112 lines
3.4 KiB
Markdown
# Uno R4 WiFi Doorbell - Quick Start Guide
|
|
|
|
## Overview
|
|
This is a simplified doorbell notification system for the Arduino Uno R4 WiFi that displays incoming ntfy.sh messages on the built-in 12x8 LED matrix.
|
|
|
|
## Features
|
|
- Connects to WiFi and monitors a ntfy.sh topic
|
|
- Displays incoming messages as scrolling text on LED matrix
|
|
- Scrolls at 2 columns per second (configurable)
|
|
- Auto-silences after 60 seconds of display
|
|
- Simple state machine: CONNECTING → IDLE → DISPLAYING → SILENCED
|
|
|
|
## Setup Instructions
|
|
|
|
### 1. Configure WiFi Credentials
|
|
Edit `boards/uno-r4-wifi/uno-r4-wifi.ino`:
|
|
|
|
```cpp
|
|
#define WIFI_SSID "YOUR_WIFI_SSID"
|
|
#define WIFI_PASS "YOUR_WIFI_PASSWORD"
|
|
```
|
|
|
|
### 2. Configure ntfy.sh Topic
|
|
Edit `boards/uno-r4-wifi/uno-r4-wifi.ino`:
|
|
|
|
```cpp
|
|
#define NTFY_TOPIC "YOUR_TOPIC_HERE"
|
|
```
|
|
|
|
Create a free topic at https://ntfy.sh/ (e.g., "my-doorbell-12345")
|
|
|
|
### 3. Upload the Sketch
|
|
```bash
|
|
arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi boards/uno-r4-wifi/uno-r4-wifi.ino
|
|
arduino-cli upload --fqbn arduino:renesas_uno:unor4wifi -p /dev/ttyACM0 boards/uno-r4-wifi/uno-r4-wifi.ino
|
|
```
|
|
|
|
### 4. Test the System
|
|
Open a terminal and run the test script:
|
|
```bash
|
|
chmod +x boards/uno-r4-wifi/test_messages.sh
|
|
./boards/uno-r4-wifi/test_messages.sh
|
|
```
|
|
|
|
Or manually send a message:
|
|
```bash
|
|
curl -X POST https://ntfy.sh/YOUR_TOPIC_HERE -d "Hello from ntfy!"
|
|
```
|
|
|
|
## How It Works
|
|
|
|
### State Machine
|
|
1. **CONNECTING_WIFI** - Attempts to connect to WiFi
|
|
2. **IDLE** - Polls ntfy.sh every 5 seconds for new messages
|
|
3. **DISPLAYING_MESSAGE** - Shows scrolling text for 60 seconds
|
|
4. **SILENCED** - Clears matrix for 5 seconds before returning to IDLE
|
|
|
|
### LED Matrix Display
|
|
- Text scrolls from right to left across the 12x8 matrix
|
|
- Scroll rate: 2 columns per second (500ms per column)
|
|
- Characters are 5 pixels wide with 1 pixel spacing
|
|
- Only alphanumeric characters (A-Z, 0-9) and spaces are supported
|
|
|
|
### ntfy.sh Integration
|
|
- Uses HTTP GET with polling (`/json?poll=1`)
|
|
- Tracks last message ID to avoid duplicates
|
|
- Parses JSON response for message body
|
|
|
|
## Pinout Reference (Uno R4 WiFi)
|
|
- **D0-D13**: Standard digital pins
|
|
- **A0-A5**: Analog inputs
|
|
- **D26/D27**: Qwiic (I2C) connector (SCL/SDA)
|
|
- **LED Matrix**: Built-in 12x8 matrix (pins handled internally)
|
|
|
|
## Customization
|
|
|
|
### Adjust Timing
|
|
Edit constants in `uno-r4-wifi.ino`:
|
|
```cpp
|
|
#define POLL_INTERVAL_MS 5000 // How often to check for messages
|
|
#define DISPLAY_DURATION_MS 60000 // How long to display each message
|
|
#define SCROLL_SPEED_MS 500 // Scroll speed (lower = faster)
|
|
#define SILENCE_DURATION_MS 5000 // Time between messages
|
|
```
|
|
|
|
### Add More Characters
|
|
The font array in `drawCharToFrame()` can be extended to support additional characters.
|
|
|
|
## Troubleshooting
|
|
|
|
### WiFi Won't Connect
|
|
- Check WiFi credentials
|
|
- Ensure 2.4GHz network (Uno R4 WiFi doesn't support 5GHz)
|
|
- Verify WiFi signal strength
|
|
|
|
### LED Matrix Not Showing Text
|
|
- Ensure `matrix.begin()` is called in setup()
|
|
- Check that `matrix.loadFrame()` is called with valid data
|
|
- Verify text contains only supported characters
|
|
|
|
### No Messages Received
|
|
- Check ntfy.sh topic name matches exactly
|
|
- Ensure the topic is publicly accessible
|
|
- Test with curl command manually
|
|
- Check serial monitor for error messages
|
|
|
|
## Next Steps
|
|
- Add support for more characters in the font
|
|
- Implement different message types (Alert, Silence, etc.)
|
|
- Add color coding with different LED patterns
|
|
- Integrate with the main doorbell codebase
|