element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Merry Boxes & LEDs
  • Challenges & Projects
  • Project14
  • Merry Boxes & LEDs
  • More
  • Cancel
Merry Boxes & LEDs
Blog Mini Singing Holiday Tree
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Merry Boxes & LEDs to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: carmelito
  • Date Created: 21 Dec 2018 3:36 AM Date Created
  • Views 1395 views
  • Likes 12 likes
  • Comments 4 comments
  • merryboxesledsch
  • apa-102
  • max98357
  • max98357 i2s
  • holidayspecial19ch
  • mopidy
  • maxim_rt
  • i2s
  • project14
  • merryboxesledch
  • rasbperry pi
Related
Recommended

Mini Singing Holiday Tree

carmelito
carmelito
21 Dec 2018
image

Merry Boxes & LEDs

Enter Your Project for a chance to win a Maker Tool Kit, an Oscilloscope Grand Prize for the project that brings the Most Joy to the Heart, and Gift to Gives!

Back to The Project14 homepage image

Project14 Home
Monthly Themes
Monthly Theme Poll

 

This is a great weekend project to undertake, to get you in the holiday spirit ! In all, it should be a few hours of 3D printing, and then an hour or so in soldering the circuit together, and uploading the python code to the Pi. As part of the build I am using a Raspberry Pi Zero W as the heart of the project, and a RGB led strip (APA102) to diffuse the LEDs through the 3D printed tree . In addition I am also using an I2S class D mono Amp breakout board by Adafruit based on MAX98357 chip and a small 8 ohms speaker, to play some Holiday songs.

 

image

 

Update #1  - 3D printing
Here is a picture of the 3D printed parts, the base and the electronic holder are printed in Red Hatchbox 1.75 mm PLA, and the tree is printed in Transparent PLA with 15% infill to help with the LED diffusion.


  
And, here are the electronic components that I plan on using as part of the buildimage

  • Raspberry Pi Zero W
  • APA102 RGB led strip
  • I2S class D mono Amp breakout board by Adafruit based on MAX98357 chip
  • 8 ohms speaker

image

 

Update 2 - Circuit

As part of the circuit here are connection for the APA102 LED strip to the Raspberry Pi zero.

  • Power to pin 2 on the Pi (5V Power)
  • GND to pin 6 on the Pi GND
  • Data to pin 16
  • Clock to pin 18

 

Connect Adafruit MAX98357 I2S Class-D Mono Amplifier to the following pins on the Pi

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

 

image

 

Update #3 Software setup

 

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, install the blinkt package written by the awesome folks at Pimoroni. And then get rainbow.py example from blinkt github repo using wget.

sudo apt-get install python-blinkt
sudo wget https://raw.githubusercontent.com/pimoroni/blinkt/master/examples/rainbow.py

And then run the python program with the command below, and you should see your LED strip cycle through colors as shown in the third picture above.

sudo python rainbow.py

 

image

 

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 -sS 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

 

Update #4 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. In my case for the holiday season the idea is to play my favorite Holiday songs/Christmas carols , and once the holiday season is over I plan to install youtube-dl to download podcast from youtube in a mp3 format and then listen to it when I find time.

 

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

 

Here is a copy of my mopidy.conf file

# For further information about options in this file see:
#   http://docs.mopidy.com/
#
# The initial commented out values reflect the defaults as of:
#   Mopidy 2.2.1
#   Mopidy-File 2.2.1
#   Mopidy-HTTP 2.2.1
#   Mopidy-Local 2.2.1
#   Mopidy-M3U 2.2.1
#   Mopidy-MPD 2.2.1
#   Mopidy-SoftwareMixer 2.2.1
#   Mopidy-Stream 2.2.1
#
# Available options and defaults might have changed since then,
# run `mopidy config` to see the current effective config and
# `mopidy --version` to check the current version.


[core]
cache_dir = $XDG_CACHE_DIR/mopidy
config_dir = $XDG_CONFIG_DIR/mopidy
data_dir = $XDG_DATA_DIR/mopidy
max_tracklist_length = 10000
restore_state = false


[logging]
#color = true
#console_format = %(levelname)-8s %(message)s
#debug_format = %(levelname)-8s %(asctime)s [%(process)d:%(threadName)s] %(name)s\n  %(message)s
#debug_file = mopidy.log
#config_file =


[audio]
#mixer = software
#mixer_volume = 
#output = autoaudiosink
#buffer_time = 


[proxy]
#scheme = 
#hostname = 
#port = 
#username = 
#password = 


[mpd]
enabled = true
hostname = 0.0.0.0
port = 6600
password = 
max_connections = 20
connection_timeout = 60
zeroconf = Mopidy MPD server on $hostname
command_blacklist = 
  listall
  listallinfo
default_playlist_scheme = m3u


[http]
enabled = true
hostname = 0.0.0.0
port = 6680
static_dir =
zeroconf = Mopidy HTTP server on $hostname
allowed_origins = 
csrf_protection = true


[stream]
#enabled = true
#protocols = 
#  http
#  https
#  mms
#  rtmp
#  rtmps
#  rtsp
#metadata_blacklist = 
#timeout = 5000


[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir =


[softwaremixer]
#enabled = true


[file]
enabled = true
media_dirs =/home/pi/Music 
#  $XDG_MUSIC_DIR|Music
#  ~/|Home
excluded_file_extensions = 
  .jpg
  .jpeg
show_dotfiles = false
follow_symlinks = false
metadata_timeout = 1000


[local]
enabled = true
library = json
media_dir = /home/pi/Music
scan_timeout = 1000
scan_flush_threshold = 100
scan_follow_symlinks = false
excluded_file_extensions = 
  .directory
  .html
  .jpeg
  .jpg
  .log
  .nfo
  .png
  .txt

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 favorite 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 below..

image

 

Update #5 3D print a Post Card/ Photograph holder

 

Soo the Holiday season is over !! this means you can replace the top 3D printed tree with a post card holder, as you see in the picture below..

image

 

And here is a video demo ..

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

  • Sign in to reply

Top Comments

  • shabaz
    shabaz over 6 years ago +4
    Nice project : ) It could be used all-year-round, to play internet audio streams, perhaps to wake up to : )
  • dubbie
    dubbie over 6 years ago +3
    I like the 3D printed parts. A diffused white tree is a good idea. I might even try that myself at some point. Dubbie
  • DAB
    DAB over 6 years ago +3
    Good project. DAB
  • shabaz
    shabaz over 6 years ago

    Nice project : )

    It could be used all-year-round, to play internet audio streams, perhaps to wake up to : )

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 6 years ago

    Good project.

     

    DAB

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • dubbie
    dubbie over 6 years ago

    I like the 3D printed parts. A diffused white tree is a good idea. I might even try that myself at some point.

     

    Dubbie

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • genebren
    genebren over 6 years ago

    Great start on your holiday project (Merry boxes & LEDs).  I look forward to seeing where this is going.

    Good Luck!

     

    Gene

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube