Building a Raspberry Pi “smart” speaker
One autumn day I decided to I wanted to build something with my unutilized first-generation Pi. I landed on making a “smart” speaker that would greet people entering a room and play some elevator music until they left, bidding farewell at the end as well. I made a rule to not use the AUX jack to make it more interesting. The triggering of the device shall make use of an ultrasonic sensor because I already had one and my landlord would not be happy If I'd start attaching switches to the door frame. There is also something magical about waving your hand to make stuff happen.
After some thinking the stack looked like this:
- Use NodeJS for the code. Python is usually all the rage but I was curious how well would Node fair here.
- To get audio going I landed on an
MAX98357
amplifier that can run a 3W 4 Ohm speaker. It is cheap, easy to use, and aliexpress has a lot of them. - The old trusty
HC-SR04
ultrasonic sensor. Also cheap and good enough. - Last up I snagged a 3W 4 Ohm speaker off of
aliexpress
.
The feature list I had in my mind was as follows:
- Play some greeting once triggered
- Transition into playing some generic elevator music
- Play some farewell once triggered again