Darth Vader Speaker

by CJA3D in Circuits > Raspberry Pi

3463 Views, 25 Favorites, 0 Comments

Darth Vader Speaker

VaderSpeaker.jpg
3D Printed Darth Vader Speaker
Components_VaderSpeaker.jpg

If you are big fan of Star Wars movies, follow the steps below to make your very own Darth Vader Speaker. As part of the build we are going to use a Raspberry Pi Zero W as the heart of the project, and an I2S class D mono amplifier and 4 ohms speaker, to play our favourite tunes !!

In my case, I have a mp3 songs that I have been collecting over the years, which I have download to the SD card on my Pi and running a software called Mopidy , which is an extensible music server written in Python. And you can play songs using a web browser on your mobile/tablet/laptop as you see in the video.

In addition, if you have your song collection online on Spotify, SoundCloud or Google Play Music you an install an mopidy extension to play songs from your collection in addition to the songs on the Pi.

Things You'll Need to Complete the Build

PiAmpSpeaker.jpg
Zpoxy.jpg

Here are the list of electronic components you will need

Other things you need

  • 3D filament Black - 1.75 mm PLA
  • Z Poxy resign Kit for finishing the 3D printed Vader head

Tools you'll need

  • Hot Glue sticks and gun
  • 3D Printer
  • 3D pen to attach the parts together
  • Rotary tool like a Dremel for sanding the parts faster.
  • Xacto Knife
  • sand paper to cleaning the 3D prints
  • Container to mix the resign
  • Gloves and Safety glasses
  • Soldering Iron and solder

3D Print the STL Files Attached

3DPrinting.jpg
3DPrintedParts.jpg

Download the STL files attached and using 3D printing software slice and 3D print the files.If you don't have a 3D printer handy you can use one at your local maker club or library or use a 3D printing service like 3D hubs.

In my case, I printed the STl files using the Flashforge creator pro and 1.75 mm black PLA to print. In addition for slicing I am using Slic3r with the layer height set to 0.3mm and fill density to 25 %.

Black 1.75 mm Filament used can be found - http://digitmakers.ca/shop/3d-printers/filament/3d-printer-filaments-pla-black/

Putting PLA Parts Together Using 3D Printing Pen

3DpartsDremel.jpg
3DpartsJoiningusing3DPen.jpg
3DpartsJoiningusingBeforeSanding.jpg

Now to put the part together instead of using super glue, we are going to use a 3D printing pen.

Once you have your parts printed ,use the Rotary tool in my case a Dremel/sand paper to file the edges of the parts to put together. Use a hot glue gun to put the parts together ,this will temporarily hold the part in place,and will make it easier to use 3D printing pen to melt PLA on the inside of the part.

Now once the inside of your part is done, remove the hot glue using an xacto knife from the outside as shown in the picture above, and extrude out filament from the Pen to apply to the outside of the part.

Note

Using this method can test your patience!! , so remember take breaks.

In addition, remember to do this in a well ventilated area and wear protective glasses to cover your eyes while sanding.

Sanding and More Sanding..

Sanding_dremel.jpg
Sanding_sandPaper.jpg
Sanding_after.jpg

Now comes the hard part , Sanding !!

Use a rotary tool like Dremel to speed up the sanding process and they use sand paper. Wash the part once you done , you will see sand marks on you 3D printed part as shown above, but that should not be a problem as you are going to finish it with one of the steps mentioned below.

Since you have used a 3D printing pen with the same filament you printed STL files with , this method will prevent the parts from coming apart in a few month , when compared to if you had used hot glue..

Applying Z Poxy

Zpoxy_application.jpg
Zpoxy.jpg
Zpoxy_application_2.jpg

As part of the Z poxy kit it comes with two bottles, on contains the resin and the other the hardener.

Approximately pour equal quantities of the resin and hardener in a container. Mix it using the end of a brush or one of your test prints, this takes about 3-4 mins and wait till the liquid turns a whitish color. Use a combination of small and large paint brushes to pain the model, start with the part of the 3D print which has more details , like the eyes and the mouth of the Darth Vader Planter. Let the part to dry for at-least 4 hours and keep it away from dust.The time 4 hour can vary, and depends upon the portions of hardener and resin .

Here the safest bet is to leave the part overnight to dry. Do not lift the part up before the part is completely dries , or else you will end up leaving your finger prints on the model. If you don't have Z Poxy available , you can also try out XTC-3D buy a company called Smooth-On.

Tips for applying Z Poxy to the 3D printed part

  • Buy the Z Poxy which say 30 mins on it, so that you have more time to work with the solution before it gets hard.
  • If you are applying this to a small figurines, you may want to hot glue the base of the 3D printed part to piece of wood, so that using the brush is much easier and you don't leave finger prints/glove marks on the model.
  • In addition, try and place you model on a base that you can move around like a box or a piece of wood , if you don't have one of them fancy turn tables.
  • Try and use a transparent tupperware container so that you can see the mixture turn a cloudy white color.
  • Do this in a well ventilated area , though it say it is odorless on the box, it has a slight pungent smell to it
  • Use gloves, as this solution can stick to hands just like super glue and can be difficult to get off.
  • Try and keep you model at a room temperature,in about 15-30 C and away from dust.

Circuit Connections

Circuit.jpg

Solder the header pins on the Raspberry Pi Zero W and and also solder the speaker to the +ve and -ve on the Adafruit MAX98357 I2S Class-D amplifier.

And here are the pin connections between the Raspberry Pi Zero W and MAX98357 I2S Class-D amplifier.

  • Vin to pin 4 on Pi 5V
  • GND to pin 9 Pi GND
  • DIN to pin 40 on the Pi
  • BCLK to pin 12
  • LRCLK to pin 35

Setting Up Raspbian and Installing Mopidy Music Player on the Pi

mopidy_screenshot.png

Using your computer flash the latest version of Rasbian-lite img on an SD card (Download link for the img file https://www.raspberrypi.org/downloads/raspbian/). And then add the SD card to the Raspberry Pi and connect your Pi to the your WiFi router and make a note of the IP address, then SSH into your Pi

Start by running the two commands below to update and upgrade the packages on the Pi.

sudo apt-get update  
sudo apt-get upgrade

Now to setup and test the Adafruit’s MAX98357 I2S Class-D Mono Amp, follow the guide on the Adafruit Learning system at - https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp/pinouts?view=all. Basically as part of the setup there is an easy setup and a difficult setup, if you plan to run the easy route just download and run the following shell script

curl -s https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/i2samp.sh | bash

To check if the shell script ran successfully, and you are able to hear sound from the speaker run

speaker-test -c2 --test=wav -w /usr/share/sounds/alsa/Front_Center.wav  

And to adjust the volume use alsamixer command

Setting up Mopidy to play your favorite tunes
Now to play you favorite tunes we are going to setup Mopidy and a web client for mopidy, so that you can play your song from your mobile/table. Mopidy plays music from local disk, Spotify, SoundCloud, Google Play Music, and more. You edit the playlist from any phone, tablet, or computer using a range of MPD and web clients.

Now lets install Mopidy run the following command

sudo apt-get install mopidy

for more info check out the documentation at - Installation — Mopidy 2.0.1 documentation

Modify the mopidy.conf to enable the HTTP,MPD and Files sections, here is my mopidy.conf, and my local directory to store musing is /home/pi/Music , so if you plan on using the .conf file below create a “Music” directory in the home folder

sudo nano /etc/mopidy/mopidy.conf

I have attached my mopidy.conf, just in case you would like to make a copy of it.

If you plan on using a web app on the phone/tablet, you will need an http web client, I like the Mopidy-Mobile..

sudo pip install Mopidy-Mobile

To run mopidy on boot run, and restart you pi

sudo systemctl enable mopidy  
sudo reboot

Also, if you plan to load more mp3/.wav files into the Music folder in the future, you will have to run a scan command, so that songs show up in the Mopidy-Mobile client using

sudo mopidyctl local scan

And then use the mobile client open url in your browser on your mobile/computer - http://IpAddressOfPi:6680/ and play your favourite tunes and songs, in my case I have download some creative commons music from the youtube audio library for the video demo, which you see in the screenshot above..

Downloads

Adding the Electronics to Darth Vader 3D Printed Part

HotGlueElectronicComponents.jpg
VaderSpeakerTest.jpg
DarthVaderSpeaker.jpg

To add the components to the 3D printed parts, I used hot glue to attach the Raspberry Pi Zero and MAX98357 I2S Class-D amplifier and pass the USB cable from the back.

In addition I hot glued both the speaker components together, and this part should snap fit on Darth Vader's head.

Now, for the Mopidy music player to start every time the Pi is switched on, we can setup Mopidy to ran as a system service, using systemd you can enable the Mopidy service by running:

sudo systemctl enable mopidy

This will make Mopidy automatically start when the system starts. And Mopidy is started, stopped, and restarted just like any other systemd service, using

sudo systemctl start mopidy
sudo systemctl stop mopidy
sudo systemctl restart mopidy

In addition, if you have your song collection online on Spotify, SoundCloud or Google Play Music you an install an mopidy extension to play songs from your collection in addition to the songs on the Pi.