Last update 8 July 2020 *** More on V4 **
Grandbaby's first computer. Raspberry Pi based musicbox, designed to evolve as she does WHILE refreshing grandpa's programming skills! Originally built using a PI 2 in a cottage-style lego block case. Lego case will hopefully help facilitate the project's 'evolution' - future hardware & features TBD!
Version 1 |
A little device that that plays streamed music so mom and dad can pipe lullabies into the nursery |
|
|
Version 2 |
Added a button and lights because she is figuring out how to fingers (python + solder!)
|
|
|
Version 3 |
Done - Rebuild using new speakers and DietPi to rectify annoying hiss.
|
|
|
Version 4 |
Who knows? - Touchscreen, Push4Papa Walkie-Talkie, ????? |
CutiePI V1
A simple streaming music player in a Lego case. Originally built using spare parts.
Hardware
Software
- Stock Raspbian installed using NOOBS
(weezy initially, worked fine, but some fiddling to get wifi and audio working)
- AirPlay services via Shairport-Sync
(Originally used Shairport, worked OK, but was a little squirrelly, if I recall)
Capabilities
Fond Memories
- Audio was a little trickier on Weezy
- Some WiFi struggles due to combination of RPI v2, Edimax adapter and Weezy (I think)
- Lego Case
- Roof Tiles via ebay were most expensive part of project!
- Chimney to accommodate excess speaker wire
CutiePI V2
Added a button & LEDs and a custom app that plays sounds & music when button is pressed.
Hardware
Software
Capabilities
- STILL allows mom/dad to stream music into nursery using iPhone/iPad
- V2 added a button, lights (LEDs) and custom app that blinks lights and plays preloaded sounds
- Simple Python script (my first!)
- 3 sound files and one song file (wav format)
- each button press blinks light bar and plays a sound
- GPIO: Button @ GPIO 2. LEDs: Red @ GPIO 17, Green @ 27, Yellow @ 22, Blue @ 4
- V3 also part of this
- added Simulation (sim argument) to facilitate testing w/o GPIO
- Absolute path names for soundfiles to facilitate running script as a service
- Added remote access/support - I periodically change sound files via ftp to surprise grandbaby ... e.g. xmas theme
Fond Memories
- Minor Struggles getting pygame.mixer and shairport-sync to play well together.
- Had to check/wait if mixer was busy playing a sound (someone streaming to shairport)
- Initialized mixer when it was not busy and released (pygame.mixer.quit) when sound was done
- Switched to a RPI V3 mostly for inbuilt WiFi adapter
- Crowded in the Lego case when I added LEDs, wiring and Pi-EzConnect HAT
- Tried to eliminate a low volume hiss when CutiePI just sat there - thought was WiFi adapter (fail)
Most likely the cheap speakers - but looking into "PSU Noise Reduction" option in DietPI for V3
- Some handy docs used along the way
- Used this to get CutiePI script to run when system is booted (runs as a service)
- Some Sound Resources
- The Wav Site for free wav files (animal sounds, holiday, etc)
- I use online mp3 to wav converters - there are many, can't remember favorite
CutiePI V3
Jan 2019 Rebuild *** Completed *** Yeeesh! USB Speakers* I bought didn't work - made shairport-sync coughup "Can't set the D/A converter to 44100" exception and fail! Tried a bunch of things to rectify, but no go. Regrouped and found the - original problem was occasional speaker hiss and loud snap/crackle/pop when CutiePi sits on shelf - ended up that the original speakers from my junk pile used for project failed.
Hardware
Dietpi only change here. It provides a lite version Raspbian Stretch and a library of optimized Pi software packages including shairport-sync. I use it for all server-like RPI Projects.
- Dietpi.com - Download latest RPI version
- Etcher.io - Much easier way to flash OS images to SD
- AirPlay services via Shairport-Sync option in DietPi Optimized Software
Config & Notes as I go (so I can rebuild in future) - (note: Attempted Buster Jan 2020 - FAIL! Stick to Stretch for now)
- Download latest DietPi and Etcher. Follow DietPi Quickstart Guide
// used DietPi_RPi-ARMv6-Stretch.7z (~90MB Download) //
- Easier to start DietPi install with Ethernet, keyboard & monitor then switch to ssh after first boot
- Automatically resizes partitions, forces password changes and updates itself (~5min)
- <Reboot #1>
- Config DietPi-config utility. Minimally, set the following:
- DietPi-Config/Audio Options->
- Soundcard=usb-dac
// For shairport-sync w/ usb sound //
- DietPi-Config/Language&Regional->
- Local=en.US.UTF-8 + Timezone + Keyboard[us]
// Season to taste, keyboard and country! //
- DietPi-Config/Network Adapters->WiFi
// setup WiFi @ this point - Remember to Apply/Restart Net //
- DietPi-Config/Security->
- <Reboot #2>
- Install Software via SSH and DietPi-Software utility
- Software Optimized - Check the following
- Media Systems->Shairport Sync
// for AirPlay //
- Remote Access->Remot3.it
// Requires account, installer is now connectd-installer //
- Hardware Projects->RPi.GPIO
- Software Additional - Check the following
- System->ALSA: Linux sound system
- // installed w/ shairport //
- Shared Libraries-> Python Pip: python pip package installer
- Networking Tools-> Avahi-Daemon: hostname broadcast (mac, pc bonjour)
- // installed w/ shairport //
- Remember to: Install: Go >> Start installation for selected software
- <Forced Reboot #3>
- Touch-ups
- edit /usr/local/etc/shairport-sync.conf - set name to "CutiePi's Room"
- Make sure wifi does not go into powersave mode: iwconfig wlan0 power off
- CutiePI_V3 Install (yeeesh! this is more complicated than it should be)
- Install a couple of loose-ends from standard repo
- apt-get update
- apt-get install joe // my editor of choice //
- apt-get install ftp // ftp client for changing out sounds/soungs //
- Install Pygame & gpiozero libraries
- apt-get update
- apt-get install python-pygame python-gpiozero libav-tools
// libav-tools gone on buster? Seemed to get tools on ffmpeg, but flaky issies //
- Now install my CutiePi Python script
- Create directories for amazing CutiePi GPIO LED/Pushbutton action
- Both under /home/dietpi - cutiepi and cutiepi/cutiesounds
- Install python source CutiePI_Vx.py to cutiepi directory
- Edit CutiePI_Vx.py: absolute directory/filenames for service ... /home/dietpi/cutiepi/cutiesounds
- Add initial sounds: sound1.wav, sound2.wav, sound3.wav and song.wav
- Test via "python CutiepI_Vx.py sim". // 'sim' parameter to simulate button press if no GPIO //
- Turn Python Script into a service so it starts when pi is rebooted.
From https://www.raspberrypi-spy.co.uk/2015/10/how-to-autorun-a-python-script-on-boot-using-systemd/
- Create a symbolic link to the current version of CutiePI python script
cd /home/diepi/cutiepi
ln -s CutiePI_V3.py cutiepi.py
- Create unit file ... Include block of code below
joe /lib/systemd/system/cutiepi.service
[Unit]
Description=CutiePi Service
After=multi-user.target
[Service]
Type=idle
ExecStart=/usr/bin/python /home/dietpi/cutiepi/cutiepi.py > /home/dietpi/cutiepi/cutiepi.log
[Install]
WantedBy=multi-user.target
Fond Memories
- Occasional Snap/Crackle/Pop (Which RARELY happens when the real CutiePi is sitting in my shop with me! I plug it in near others
- Audio option "PSU Noise Reduction" in dietpi seems like a good idea ... BUT ... I have to remember that HDMI is OFF when option is set. I had to turn if off to install V3 in real CutiePi so I could see what I was doing - once Wifi is up, all is well via SSH.
CutiePI V4
June 2020 update. V4 will likely turn into a separate project - See SmartiePi. Grandkid #1 has been pushing the button
is now 4 and probably needs more than a button or two. Grandkid #2 is having fun with CutiePi V3 the way it is!
Jan 2020 Work in process! Current plan: One button/song, volume control and possibly Walkie-Talkie feature - Push4Papa.
- Sticking with Dietpi Stretch for now ... number of general stumbles attempting latest/buster
- Dietpi pings 1.1.1.1 to test network ... our ISP (TDS seems to block 1.1.1.1 ... yeesh!)
Changed to quad9 (9.9.9.9 in dietpie.txt, but end up with reboot issues)
- Pygame sounds were flaky - occasional hiss/static instead of wav sound
- Noticed that libav-tools was gone (not installable), installed ffmpeg instead. Not sure if this was the issue
- Enough was enough - Sticking with Stretch for now
TalkiePi
Odds N Ends
Project CutiePIProject CutiePI
Components used*
---------------
* T. Pedersen Ventures is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com.
|
|
|