This Raspberry Pi Pico W project extends a traditional doorbell to send notifications through multiple channels including Telegram, WhatsApp, SMS, Slack, Discord, and more. It uses uasyncio for non-blocking tasks, ensuring the doorbell is monitored continuously while handling network operations efficiently. The system connects to Wi-Fi only when needed, preserving power and bandwidth.
- Doorbell Signal Monitoring: Detects doorbell button presses and sends notifications.
- Asynchronous Design: Utilizes
uasyncio
for concurrent LED heartbeats and pin monitoring without blocking. - Multiple Notification Channels:
- Telegram: Messages via bot API
- WhatsApp: Through Twilio's API
- SMS: Via Twilio
- Slack: Using webhooks
- Discord: Using webhooks
- Pushover: Native notifications
- Node-RED: HTTP endpoints
- Simple GET: Basic HTTP requests
- LED Status Indicator:
- Normal operation: Regular heartbeat pattern
- WiFi connecting: Fast blink (4x speed)
- Sending notifications: Solid ON
- Can be disabled in settings
- Power-Efficient Networking: Single WiFi connection for all notifications
-
WiFi Network
- Have your WiFi SSID and password ready
-
Telegram Bot
- Create a bot via BotFather
- Get the Bot Token and Chat IDs
-
Twilio Account (for WhatsApp/SMS)
- Create account at twilio.com
- Note your Account SID and Auth Token
- Set up WhatsApp sandbox or SMS number
-
Slack Integration
- Go to your Slack workspace
- Create new app or use existing
- Enable Incoming Webhooks
- Create and copy webhook URL
-
Discord Webhook
- Open server settings
- Go to Integrations → Webhooks
- Create webhook and copy URL
-
Pushover
- Create account at pushover.net
- Create application
- Note your user key and application token
-
Node-RED
- Set up flow with HTTP input node
- Configure endpoint path
- Note server IP and port
Note: The doorbell input uses a pull-up configuration, triggered when grounded.
+------------------+
| (signal)| (2.2k)
| GP10 +--------/\/\/\--------------------------- Signal (+)
| Raspberry |
| Pi (~3.3V)| +-------------------------+
| Pico W VSYS +-------+ VCC +------- VCC
| | | Boost-Buck Converter |
| GND +-------+ |
| |LED| | | GND +-------+
+------+---+-------+ +-------------------------+ |
|
--+--
---
- GP10 is the default doorbell pin (configurable in
settings.py
) - LED uses onboard LED (referenced as
"LED"
in code) - Power via USB or regulated 5V-3.3V supply
main.py
: Entry point and async task orchestrationconfig/
:credentials.py
: All sensitive configurationsettings.py
: General settings and provider configuration
core/
:heart_led.py
: LED status indicatornetwork_manager.py
: WiFi connection handling
notifications/
:notifier.py
: Notification orchestratorbase_provider.py
: Provider interfaceproviders/
:telegram.py
: Telegram bot implementationtwilio_whatsapp.py
: WhatsApp via Twiliotwilio_sms.py
: SMS via Twilioslack_webhook.py
: Slack integrationdiscord_webhook.py
: Discord integrationpushover.py
: Pushover notificationsnode_red.py
: Node-RED integrationsimple_get.py
: Basic GET requests
utils/
:logging.py
: Debug logging utilities
-
Get the Code
git clone https://github.com/yourusername/raspberry-pi-pico-w-doorbell.git cd raspberry-pi-pico-w-doorbell
-
Configure Credentials In
src/config/credentials.py
:# WiFi WIFI_SSID = "your_wifi_ssid" WIFI_PASS = "your_wifi_password" # Telegram TELEGRAM_BOT_TOKEN = "your_bot_token" TELEGRAM_CHAT_IDS = ["chat_id_1", "chat_id_2"] # Twilio TWILIO_ACCOUNT_SID = "your_account_sid" TWILIO_AUTH_TOKEN = "your_auth_token" TWILIO_FROM_PHONE = "+1234567890" TWILIO_TO_PHONES = [ "+1234567890", "+0987654321" ] TWILIO_WHATSAPP_FROM = "whatsapp:+14155238886" TWILIO_WHATSAPP_TO = [ "whatsapp:+1234567890" ] # Slack SLACK_WEBHOOK_URLS = [ "https://hooks.slack.com/services/YOUR/WEBHOOK/URL1", "https://hooks.slack.com/services/YOUR/WEBHOOK/URL2" ] # Discord DISCORD_WEBHOOK_URLS = [ "https://discord.com/api/webhooks/YOUR/WEBHOOK/URL1", "https://discord.com/api/webhooks/YOUR/WEBHOOK/URL2" ] # Pushover PUSHOVER_TOKEN = "your_app_token" PUSHOVER_USER_KEYS = [ "user_key_1", "user_key_2" ] # Node-RED NODE_RED_HOST = "10.0.0.10" NODE_RED_PORT = "1880"
-
Adjust Settings In
src/config/settings.py
, enable/disable providers:# Provider Enablement PROVIDER_TELEGRAM_ENABLED = True PROVIDER_TWILIO_WHATSAPP_ENABLED = True PROVIDER_TWILIO_SMS_ENABLED = True PROVIDER_SLACK_ENABLED = True PROVIDER_DISCORD_ENABLED = True PROVIDER_PUSHOVER_ENABLED = True PROVIDER_NODE_RED_ENABLED = True PROVIDER_SIMPLE_GET_ENABLED = True # LED Configuration LED_ENABLED = True LED_PATTERNS = { 'normal': {'pattern': [(0, 300), (1, 300)], 'repetitions': 1}, 'connecting': {'pattern': [(0, 75), (1, 75)], 'repetitions': 1}, 'sending': {'pattern': [(1, 1000)], 'repetitions': 1} }
-
Upload to Pico W
- Using Thonny: Open files and "Save as" to Pico W
- Using mpremote:
mpremote cp -r src/ :
- WiFi: Single connection shared among all providers
- LED Patterns:
- Normal: 300ms on/off
- Connecting: 75ms on/off
- Sending: Solid on
- Providers:
- Each can be independently enabled/disabled
- Separate configuration in settings
- Individual error handling
- Multiple recipients where supported
-
Power Up
- Connect Pico W to power
- LED starts heartbeat pattern if enabled
-
Operation States
- Normal: Regular LED heartbeat with "Alive" messages
- Doorbell Press:
- LED changes to connection pattern
- WiFi connects
- LED goes solid
- Notifications sent
- WiFi disconnects
- Returns to normal heartbeat
-
Monitoring
- Enable
SERIAL_LOGS = True
for detailed operation logs - Each provider reports success/failure
- Network status is logged
- Enable
-
LED States
Normal: ▁▁▁▁▆▆▆▆▁▁▁▁▆▆▆▆▁▁▁▁▆▆▆▆▁▁▁▁▆▆▆▆ Connecting: ▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆▁▆ Sending: ▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆▆
- No LED: Check
LED_ENABLED
in settings - No Notifications: Verify provider credentials and enable flags
- WiFi Issues: Check network credentials and connection timeout
- Provider Errors: Enable logging and check specific provider messages
- Enable only needed providers
- Providers are loaded only if enabled
- Single network connection for all notifications
- Resources cleaned up after each notification
- Async but Not Interrupt-Based: Uses polling for doorbell
- Single WiFi Network: No failover or multiple networks
- Memory Constraints: Enable only necessary providers
- Network Dependency: All providers require internet
Contributions welcome! Please:
- Fork the repository
- Create feature branch
- Follow code style
- Tests your code
- Submit pull request
MIT License - see license
- Open issues on GitHub
- Enable logging for troubleshooting
- Check provider documentation for specific issues