Sound Machine Night-lite

Some work still needed

TL;DR I used Raspberry Pi zerow, some ws1211 leds, led lights from IKEA, an ssr module, and AIY voice v1 kit to make a sound machine that can be controlled from a flask application.  Ongoing mod it to have Google assistant be able to control it for voice commands.       



For those still with me to the right is 3 of the SSR's triggered lighting up lights i got from IKEA.  If you have interest I will compile a BOM with links for this project.  I am learning Python and figured why not upgrade my daughters white noise machine along the way.  


Lets make it stereo

I added a MAX98357A 3w mono amplifier to the AIY board to give the second channel 

SSRs 

I added a Solid State Relay module so the lights can be turned on and off individually 

WS2812 Leds I used about 13 meters of leds to go around the room

Here we have the SSR module and the LEDs connected to the "Servos" portion of the AIY board.  These correspond to GPIO pins 26, 6, 13, 5, and 12.  The last one is the most important because of the Neo pixel library, and SPI.  I will get to that a little later for now lets finish the hardware.   

The microphone and Button are added to the cover.  Not sure why i am going to need the button but i figured why not.  The microphone is needed for voice control.  

Wires everywhere cover open while testing, so far so good.  

Installation has started and leds are being tested. Wires need to be cleaned up and diffused covers need to be added to some of the tracks.   

Configuration

I started with buster lite.  

I have a GitHub project started, I will link here once I have a better interface and I am not embarrassed about the quality of my python.  

Lets get the PiZero ready 

 I have reloaded a couple times...... ok more than a couple, but I digress.   

#Add Google AIY repo to be able to install from 

echo "deb https://packages.cloud.google.com/apt aiyprojects-stable main" | sudo tee /etc/apt/sources.list.d/aiyprojects.list

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

#Lets update the packages

sudo apt-get update

sudo apt-get upgrade

#Install the sound card from the AIY hat it is I2C in case you were wondering 

sudo apt-get install -y aiy-voicebonnet-soundcard-dkms

#Turn off the onboard audio

sudo sed -i -e "s/^dtparam=audio=on/#\0/" /boot/config.txt

#not really needed but I like vim more than nano

sudo apt install vim -y

#Turn on the AIY hat audio

echo "dtoverlay=googlevoicehat-soundcard" |sudo tee >>/boot/config.txt

#Pi's have limited memory, lets limit the video mem this is headless after all 

echo "gpu_mem=16" |sudo tee >>/boot/config.txt 

#while we are at it we do not need bluetooth so lets disable it.

echo "dtoverlay=pi3-disable-bt" |sudo tee >>boot/config.txt

#Lets get something to control the audio

sudo apt-get install -y pulseaudio

sudo mkdir -p /etc/pulse/daemon.conf.d/

echo "default-sample-rate = 48000" | sudo tee /etc/pulse/daemon.conf.d/aiy.conf

#We will need pip

sudo apt install python3-pip

#This if for the neo pixels, and a requirement in the requirements file

sudo pip3 install rpi_ws281x

#Not 100 percent sure why I added this but it was needed for something 

sudo apt install -y libjpeg8-dev

#We need something to play Mp3's

sudo apt install mpg123