Errata‎ > ‎RaspberryPi‎ > ‎

CutiePI - Raspberry Pi Musicbox

Last update 17 May 2019

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 use her 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



CutiePI V2

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


CutiePI V3

Jan 2019 Rebuild *** In Process *** 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.  Regrouping - original problem was occasional speaker hiss and loud snap/crackle/pop when CutiePi sits on shelf - ended up cheap speakers originally used for project failed.  

Hardware


Software

Dietpi only change here.  It provides a lite version Raspbian Stretch and a library of optimized Pi software packages including shairport-sync.    
  • 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) 
  • 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->
      • Change Hostname
    • <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 // Didn't find it/work - install by hand //
      • 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 //
      • apt-get install weavedconnectd // by hand:  not found when attempted via dietpi software //
        • run weavedinstaller // you need account at remot3.it //
      • Install Pygame & gpiozero libraries
        • apt-get update
        • gpiozero: apt-get install python-pygame python-gpiozero libav-tools
    • Now install my CutiePi Python script

        • Create a symbolic link to the current version of CutiePI python script
          cd /home/diepi/cutiepi
          ln -s CutiePI_V3 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 

      • Set permissions
        sudo chmod 644 /lib/systemd/system/cutiepi.service
      • Get service started ...
        systemctl daemon-reload
        systemctl enable cutiepi.service
        systemctl start cutiepi.service

      • <That's that ... it works, but I'm still dicking around & testing>

    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

    May 2019 Work in process!  Now looking into Walkie-Talkie feature - Push4Papa

    TalkiePi 





    Odds N Ends

    Project CutiePI



    Components used*

     

    USB-Powered Speakers:  

    I had some laying around the shop, 

    Lots of options, pretty cheap on Amazon

     

    ---------------

    * 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.