Introduction: 3d Printed Smart Speaker
this project is a custom smart speaker built using the raspberry pi SBC, 3d printed parts, and other common components
Supplies
tools:
3d printer
screw driver kit
materials
raspberry pi (model 3 or above)
2 9gram servos
4 m2 bolts
2 m6 bolts
speaker (must have 3.5 mm jack, must be smaller than 12x12x12 cm)
webcam (must have integrated microphone, modifications to the base may be necessary)
sd card (32GB or more)
power supply (5v 2a)
Ethernet cable
Step 1: Getting the OS
download raspberry pi imager (https://www.raspberrypi.com/software/) and insert the sd card into your computer, select the card in the imager and ubuntu server 22.10 (other general purpose os, ubuntu, ubuntu server 22.10 (32-bit)).
Step 2: First Boot
insert the sd card into the raspberry pi, plug a keyboard, power supply, and monitor into the raspberry pi, and wait for it to boot, ubuntu server DOES NOT HAVE A GUI, it will ask you for a login when it has booted. The default user name is “ubuntu” and the default password is “ubuntu”. It will then ask you to create a new password. A successful login should look like this:
Step 3: Adding Files
once you have logged in, shut down the raspberry pi by typing in “shutdown now” and pressing enter.
Once it has fully shut down, remove power from the raspberry pi and remove the sd card. Plug the sd card into your computer, DO NOT ALLOW IT TO FORMAT YOUR SD CARD, if you are using windows, you will need to install software to read ext4 file systems. Once you have inserted the card, there should be 2 drives that show up, select “writable”. Download the software you will need from https://github.com/Matt2D3/voiceAssitant/tree/demonAssistant. Download the files as a .zip, copy all of the .py, .service, and .sh files into /home/ubuntu. Eject the card from your computer. The contents of the folder should look like this:
Step 4: Setup
insert the sd card into the raspberry pi and plug it back in, you will need to have the raspberry pi connected to your router via an ethernet cable once you have logged in, type “ls” to list the files in the current directory, you should see the names of all of the files that you copied to the sd card.
Once you have confirmed that all of the files are there, plug in the webcam you intend to use, then type “sudo python3 install.py”. The installer should then update your raspberry pi, install packages from apt and pip3, set up start.service, and prompt you to connect to WiFi. After you enter the information for your WiFi, the raspberry pi will automatically restart itself, at this point it should be able to connect to your WiFi, so you will not need the ethernet cable again. (as of writing this, WiFi is currently not supported in the installer script, you will either have to wait for an updated installer or manually connect to WiFi, you will still need to connect your network cable. expect this update soon)
Step 5: First Test
once the raspberry pi restarts, it will automatically start the voice assistant program, it should then say "by the way I use Linux" from the connected speaker (most likely your monitor). It will then calibrate the microphone (you must be quiet when it does this) and then prompt you to say something (on the monitor). You can test if it is working by asking it “look up Autodesk on wikipedai”, it should respond within 2-3 seconds.
Step 6: Shutdown
once you have verified that the software is installed on the raspberry pi, stop the program by pressing “ctrl + c” on your keyboard, it should then return you to the linux terminal (if it does not return you to the normal terminal, press ctrl + c again until it does) type “shutdown now”
Step 7: Starting the Build
now we get to the build, assuming that you have printed the .stl files already (make sure you have 2 jawBrackets printed) the first thing you should do is install your speaker of choice into the large open cavity in demonAssistantBase.stl. Since the speaker that you are using will most likely be different from mine, you will need to find a way to secure the speaker (glue, tape, mounting hole, etc)
Step 8: Installing the Microphone / Webcam With Microphone
installing the microphone / webcam with a microphone should be easy, mount the microphone to the top of demonAssistantBase.stl by sliding it through the box on the top of the base
Step 9: Installing the Raspberry Pi
install the raspberry pi, use 4 m2 bolts to secure the pi to the back of demonAssistantBase.stl. Once you have done this, the sd card will be very difficult to remove, so make sure that you have all of the hardware and software working together BEFORE you install the raspberry pi.
Step 10: Installing the Servos
now that you have installed the raspberry pi, speaker, and microphone / webcam, you can install the mask, start with the bottom piece, install the 2 9gram servos in the mounting holes using 2 m2 bolts per servo
Step 11: Installing the Jaw Brackets
install the t-shaped servo horns to the servos on either side (note: when installing the servos, it is important that you make sure that the output shaft of the servo is centered) install the servo horn with the longest side facing forward (away from the raspberry pi) trim the long end by cutting off the first 2 screw holes. Then, attach the jawBracket.stl to the servo horns on both sides, make sure that they sit as far back as possible on the servo horns, attach them with the self-tapping screws that came with your 9-gram servos.
Step 12: Attaching the Jaw
now that the servos and brackets are installed, demonMaskBottom.stl can be installed, use 2 m2 bolts to attach the demonMaskBottom.stl to jawBracket.stl as shown. Do this on both sides
Step 13:
now that the demonMaskBottom.stl has been installed, you can move on to installing demonMaskTop.stl. DemonMaskTop.stl is very easy to install, it only requires 2 m6 bolts and should be installed as shown.
Step 14: Connecting the Speaker and Webcam
startnow that all of the hardware is built, you can connect all of the components to the raspberry pi, the microphone is easy, simply connect it to one of the available usb ports on the raspberry pi. Then, connect the speaker to the 3.5 mm jack and usb port for power. The last and hardest thing to plug in is the servos
Step 15: Preparing the Servos
remove the individual wires from the servo connector, this can be done by using a small, flathead screwdriver to pry up on the black plastic tab holding them in
Step 16: Connecting the Servos
once you have removed the wires from the connector, connect them to the raspberry pi, red goes to 5v, brown goes to gnd, and orange goes to gpio25 or gpio26 (please refer to a pinout for the raspberry pi for connecting these wires)
Step 17: Final Test
plug the assistant into power (micro USB plug on the raspberry pi), wait for it to boot and say “by the way I use linux”, then issue a command to test it. If the mouth moves the wrong way, swap the signal wires (orange) of the servos, this should solve the issue
Step 18: Done!
done! you should now be able to plug your assistant into power and have it start automatically
Step 19: Installing Future Updates
to install updates, repeat steps 3 and 4. expect an update soon to fix the wifi connectivity issue in the installer
Step 20: Making Your Own Features
to make your own features, simply edit main.py,
variables used
text: contains the transcript of the command spoken to the assistant
sayStr: contains the string of text to be said by the voice assistant (make sure you append to this. ex: sayStr += "example text. "
keep in mind that you should never look for an entire command. ex instead of looking for "what time is it" look for "what" and "time", that way you catch "what's the time", "what time is it", and "what is the date and time"