This is the README.md
for the Einlassbot.
Thanks to everyone who wrote a piece of software or designed a piece of hardware used in this project.
The purpose of the Einlassbot is to announce a users name if he writes Tür (German for Door) into a specific Telegram group. It can therefore be considered as a replacement for a doorbell.
You may call this an overengineered solution for a doorbell. However, it was a present for Xmas, build in a couple of days and brought a lot of joy.
The system is made up of 3 components:
- A microcontroller, running the bot logic and playing audio
- A Telegram Bot, sitting in a Telegram group
- A backend providing TTS functionality
To use this you need at least your own Telegram Bot. Adapt bot.py
to connect to your WiFi, use the correct token for your bot and query your flask endpoint. You should also make sure to adapt the docker-compose.yml
so that the container is reachable for you.
- Create Telegram Bot and add to group
- Flash ESP32 with LoBo MicroPython
- Wire up the circuit
- Transfer the modified
bot.py
andmain.py
withampy
to the ESP32 - Run docker container
- Reboot ESP32 and enjoy (hopefully) ;-)
- ESP32 from AzDelivery the actual hardware
- MicroPython LoBo is a really awesome micropython port for ESP32
- esptool to flash the ESP32
- ampy transfer files from and to the microcontroller
- Kemo M031N Amplifier getting some power to that speaker
- Aukru 5V 3A Power Supply making it run
- 200-10k Ohm logarithmic potentiometer for controlling volume
- 4W, 105dB @ 1 kHz / 1 Volt, 4 Ohm speaker
Just connect everything as described for the Kemo M031N example circuit. Input to the potentiometer comes from one of the DAC pins, I use Pin(25)
. Supply voltage comes from the 5V pin of the ESP. Make sure your power supply can take the load. I use a probably total overkill 3A Raspberry Pi power supply. If you experience trouble with your power supply and are capable of reading the German language you may try this.
- Higher supply voltage (12V) for amp so it can actually reach 3.5W
- Use microcontroller with more than 100kB of RAM (less pain)
- First MicroPython project, probably lots of code improvements
- Stop using flask dev server (bad!)
- Audio quality?
Make sure the bot is part of your specific group.
The bot needs to receive all messages.
Command Botfather to set privacy mode to Disable
with /setprivacy
.
Longpolling Telegram BotAPI get_updates()
from microcontroller.
- Docker container based on
base/archlinux
- Docker Compose to build and run the container
- Flask as framework for the endpoint
- gTTS performing TTS with
translate.google.com
- pydub converting mp3 to wav
- SoX converting audio to 8bit PCM wav file
- nginx-proxy automatic reverse proxy magic for containers
- docker-letsencrypt-nginx-proxy-companion proxy magic + free TLS = magic²