Building a Raspberry Pi “smart” speaker

MustSeeMelons
Geek Culture
Published in
10 min readMay 23, 2021

--

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:

  1. Use NodeJS for the code. Python is usually all the rage but I was curious how well would Node fair here.
  2. 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.
  3. The old trusty HC-SR04 ultrasonic sensor. Also cheap and good enough.
  4. Last up I snagged a 3W 4 Ohm speaker off of aliexpress.

The feature list I had in my mind was as follows:

  1. Play some greeting once triggered
  2. Transition into playing some generic elevator music
  3. Play some farewell once triggered again

--

--