The Shed – September-October 2019

(singke) #1

Above: An internal view of the fully assembled musical box. On the right side is the Arduino
MP3 player, while the large blue cone is the speaker glued to the box side


Below top: A view of the bare recycled
cardboard box used to make the container for
the musical-box components. It has already
been spray painted to create a rugged metal
effect
Below centre: Rendering of the speaker
cone. The micro-speaker will be hot glued to
the base. The cone shape should be created
according to the size of your speaker. It can be
done easily with both Tinkercad and Fusion 360
by Autodesk
Below bottom: External view of the conical
speaker. The rectangular black component is
the micro-speaker hot glued to the base of the
3D-printed cone

The MP3 player
The player includes all the features you
would expect from a commercial MP3
player: a six-level equalizer preset, track
VHOHFWLRQYROXPHFRQWURODPSOLÀHG
speaker output, earphone output, etc. It
also includes a microSD card reader to
store up to 32GB of music in a maximum
of 100 folders, with a maximum of 255
tracks per folder. As we only need a series
of tracks played in a circular sequence
one by one, all the tracks can be stored in
the root folder of the microSD card.
The DFPlayer Mini can be controlled
in several ways, including buttons
only. You can make your stand-
alone MP3 player without any extra
microcontroller and just some buttons
and a battery. What we are interested
in is the RS232 control feature, which
is perfect for managing the device using
the Arduino. It works at 5Vcc and its low
power consumption makes it possible
for it to power the player directly with
the Arduino 5Vcc pin.


The tunes
Every track of the playlist should be
named following a numerical order,
in the format 0001.MP3, 0002.MP3,
03HWF7KHÀUVWLVVXHLVZKHUH


WR ÀQG RULJLQDO PXVLFDOER[ WUDFNV
7KH EHVW VLWH RQ ZKLFK WR ÀQG IUHH
sampled music tracks based on a user-
contribution basis is freesound.org.
I downloaded recorded music-box
tracks from the site and created a
compilation for the player. However,
most of the tracks distributed by
freesound.org are sourced in WAV
ÀOH IRUPDW DQG WKH SOD\HU RQO\
VXSSRUWV WKH 03 IRUPDW 7KH ÀOH
FRQYHUVLRQ LV QRW GLIÀFXOW , VXJJHVW
you use the open-source application
VLC Media Player (videolan.org).
This player supports almost all the
DXGLRDQGYLGHRÀOHIRUPDWVLQFOXGLQJ
a network streaming option. One of
the streaming features is the option to
FRQYHUW PHGLD ÀOHV IURP RQH IRUPDW
WRDQRWKHUVDYLQJWKHPWRÀOH9/&LV
available on all desktop and mobile
platforms, is fast and reliable, and is
great for media playing, testing, and

ÀOHIRUPDWFRQYHUVLRQ
What is important for this project is
controlling the player with the Arduino
ERDUG7KHÀUVWWKLQJWRFRQVLGHULVKRZ
to manage the connection and how to
send the control bytes to the device for
the tasks we need. Luckily, DFRobot also
provides the dedicated Arduino library
on GitHub (github.com/DFRobot/DF
RobotDFPlayerMini) that makes things
easier for the software.

Resources


The 3D-printable files and the
programme sources are available
on GitHub: github.com/alicemirror/
musicalbox.
Free download pdf