Silicon ChipThe low-cost VS1053 Arduino audio playback shield - July 2017 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Incat’s world-class ferries / LEDs now ubiquitous for domestic lighting
  4. Feature: We visit Incat - another Aussie success story by Ross Tester
  5. Feature: LED lights/downlights and dimmers by Leo Simpson
  6. Project: RapidBrake - giving the guy behind extra stopping time by John Clarke
  7. Project: Deluxe Touchscreen eFuse, Part 1 by Nicholas Vinen
  8. Review: Tecsun’s new S-8800 "AM listener’s receiver" by Ross Tester
  9. Feature: "Over-the-Top" rail-to-rail op amps by Nicholas Vinen
  10. Serviceman's Log: Perished belts stop a cassette deck by Dave Thompson
  11. Feature: The low-cost VS1053 Arduino audio playback shield by Nicholas Vinen
  12. Project: We put the VS1053 Arduino shield to work by Bao Smith
  13. Project: Completing our new Graphic Equaliser by John Clarke
  14. Vintage Radio: The DKE38 Deutscher Kleinempfanger by Ian Batty
  15. PartShop
  16. Market Centre
  17. Notes & Errata: Improved Tweeter Horn for the Majestic Loudspeaker / Spring Reverberation Unit / 6GHz+ RF Prescaler
  18. Advertising Index
  19. Outer Back Cover: Hare & Forbes Machineryhouse

This is only a preview of the July 2017 issue of Silicon Chip.

You can view 44 of the 104 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "RapidBrake - giving the guy behind extra stopping time":
  • RapidBrake PCB [05105171] (AUD $10.00)
  • PIC16F88-I/P programmed for RapidBrake [0510517A.HEX] (Programmed Microcontroller, AUD $15.00)
  • Rapidbrake alignment jig pieces (PCB, AUD $5.00)
  • Firmware (ASM and HEX) files for RapidBrake [0510517A.HEX] (Software, Free)
  • RapidBrake PCB pattern (PDF download) [05105171] (Free)
  • RapidBrake lid panel artwork (PDF download) (Free)
Articles in this series:
  • RapidBrake - giving the guy behind extra stopping time (July 2017)
  • RapidBrake - giving the guy behind extra stopping time (July 2017)
  • Building and calibrating the RapidBrake (August 2017)
  • Building and calibrating the RapidBrake (August 2017)
Items relevant to "Deluxe Touchscreen eFuse, Part 1":
  • Deluxe Touchscreen eFuse PCB [18106171] (AUD $12.50)
  • PIC32MX170F256B-50I/SP programmed for the Deluxe Touchscreen eFuse [1810617A.HEX] (Programmed Microcontroller, AUD $15.00)
  • 2.8-inch TFT Touchscreen LCD module with SD card socket (Component, AUD $25.00)
  • IPP80P03P4L-07 high-current P-channel Mosfet (Component, AUD $2.50)
  • LT1490ACN8 dual "Over-the-Top" rail-to-rail op amp (Component, AUD $10.00)
  • IPP80N06S4L-07 high-current N-channel Mosfet (TO-220) (Component, AUD $2.00)
  • Matte Black UB1 Lid for the Deluxe Touchscreen eFuse (PCB, AUD $7.50)
  • Software for the Deluxe Touchscreen eFuse (Free)
  • Deluxe Touchscreen eFuse PCB pattern (PDF download) [18106171] (Free)
Articles in this series:
  • Deluxe Touchscreen eFuse, Part 1 (July 2017)
  • Deluxe Touchscreen eFuse, Part 1 (July 2017)
  • Deluxe Touchscreen eFuse, Part 2 (August 2017)
  • Deluxe Touchscreen eFuse, Part 2 (August 2017)
  • Deluxe eFuse, Part 3: using it! (October 2017)
  • Deluxe eFuse, Part 3: using it! (October 2017)
Items relevant to ""Over-the-Top" rail-to-rail op amps":
  • LT1490ACN8 dual "Over-the-Top" rail-to-rail op amp (Component, AUD $10.00)
  • LT1638CN8 dual "Over-the-Top" rail-to-rail op amp (Component, AUD $7.50)
Items relevant to "The low-cost VS1053 Arduino audio playback shield":
  • Geeetech VS1053B MP3/audio shield for Arduino (Component, AUD $10.00)
Items relevant to "We put the VS1053 Arduino shield to work":
  • 20x4 Alphanumeric serial (I²C) LCD module with blue backlight (Component, AUD $15.00)
  • Geeetech VS1053B MP3/audio shield for Arduino (Component, AUD $10.00)
  • Firmware (Arduino sketch) for the VS1053 Music Player (Mega Box) (Software, Free)
  • Firmware (Arduino sketch) file for the Arduino Music Player (Software, Free)
Items relevant to "Completing our new Graphic Equaliser":
  • 10-Octave Stereo Graphic Equaliser PCB [01105171] (AUD $12.50)
  • Front panel for the 10-Octave Stereo Graphic Equaliser [01105172] RevB (PCB, AUD $15.00)
  • 10-Octave Stereo Graphic Equaliser acrylic case pieces (PCB, AUD $15.00)
  • 10-Octave Stereo Graphic Equaliser PCB pattern (PDF download) [01105171] (Free)
  • 10-Octave Stereo Graphic Equaliser front panel artwork (PDF download) (Free)
Articles in this series:
  • All-new 10-Octave Stereo Graphic Equaliser, Part 1 (June 2017)
  • All-new 10-Octave Stereo Graphic Equaliser, Part 1 (June 2017)
  • Completing our new Graphic Equaliser (July 2017)
  • Completing our new Graphic Equaliser (July 2017)

Purchase a printed copy of this issue for $10.00.

An Arduino stereo audio playback and recording shield The VS1053 MP3 shield is a low-cost Arduino shield with a microSD card slot which can decode and play back many different audio formats. It includes a headphone output, a tiny on-board electret microphone and a microphone input, with the possibility of recording audio to the Ogg Vorbis compressed file format. It's very flexible and quite easy to get up and running. by Nicholas Vinen T his month, we're publishing a project; found on page 77, which combines a standard Arduino board with a VS1053b-based audio playback and recording board plus an LCD and keypad, to make a programmable music and audio playing and recording device. At its heart is the shield with the VS1053 IC, microSD card connector and a handful of other components. Most of the audio playback and recording work, including encoding and decoding, is done by the very flexible VS1053 IC from VLSI Solutions, a Finnish "fabless" IC manufacturer. VLSI stands for "Very Large Scale Integrated circuit" and refers to the fact that their products tend to be ICs which contain hundreds of thousands, if not millions, of transistors. As shown in the block diagram of the VS1053 IC (Fig.1), the chip includes many large and complex blocks including: a Digital Signal Processor (DSP; a microprocessor designed to excel at signal processing tasks); read-only and random-access memory (ROM/RAM); a stereo ADC and DAC (including volume control); a stereo headphone amplifier (down to 30W); a microphone 72  Silicon Chip amplifier; a phase-locked loop (PLL; labelled "clock multiplier") and digital interface circuitry, including two serial buses. All these functions are combined to provide a complete signal path from the microphone and line inputs to produce compressed digital data, and then take compressed digital data, decode it and drive headphones or a small pair of speakers with the resulting analog audio. One of the keys to the power of the VS1053 is the fact that it comes preprogrammed to decode multiple different popular audio formats such as MP3, AAC, WMA and MP4. It's based around a fully programmable signal processor and so, by uploading additional code, you can add numerous other useful functions such as the ability to encode and decode the free and open source "Ogg Vorbis" audio codec and even FLAC (Free Lossless Audio Coding). Happily, VLSI Solutions even supply pre-written code "plugins" and provide example code to upload them to the VS1053 for these additional tasks. The only disadvantage is the need for additional memory in your host microcontroller (ie, the device driv- ing the VS1053) to have these plugins ready to go as needed. In terms of performance, the VS1053 quotes a signal-to-noise ratio at full volume of 94dB and a total harmonic distortion plus noise figure of 0.07%. So it isn't quite a hifi device but then again, since it will normally be playing back digitally compressed files like MP3, you're unlikely to be able to get full CD quality out of it anyway. It's quite a power-efficient device, using just 140mW during playback, including driving a pair of 30W earbuds to a reasonable volume level, and just 36mW when idle with no load. The VS1053 comes in a 48-pin LQFP or Low-profile Quad Flat Pack. This is a surface-mount package but if you don't like soldering these, the good news is that the shield comes with all components already mounted and it barely costs any more than the IC itself. The "Geeetech" shield The original VS1053 Arduino shield was designed and sold by Sparkfun in the USA. If you're into Arduino you will have heard of them as they are one of the biggest sources of shields and accessories. You may have also noticed that siliconchip.com.au Fig.1: block diagram of the VS1053 IC. All decoding and encoding is handled internally by the VSDSP and then streamed to either the stereo DAC (decoding), or the SO register SCI_HDAT0 (encoding). The chip also contains a TTL RS-232 (UART) serial debugging interface which is not wired up by the shield. anything they produce which becomes popular tends to lead to much cheaper, Chinese-sourced "knock-offs" which are either very similar to, or in some cases, direct copies of the originals. While the Sparkfun VS1053 shield is better designed, it doesn’t come with any microphone inputs. So the knockoff version provides the easiest way to get this features. Sparkfun have produced shields based on newer ICs which can do more, but given the low cost of this one and its ready availability, we thought we'd have a go and see if we could build something useful around it. If you've been paying attention to the burgeoning Chinese electronic module industry, as documented in our "El Cheapo Asian Electronic Modules" series of articles, you won't be surprised to hear that the company behind this shield, Geeetech, is based in Shenzhen, China, near Hong Kong. Nor will you be surprised to hear that their range of products includes parts for 3D printers, Arduino type development boards and shields, UAV components (ie, drones) and all sorts of breakout and sensor boards. Anyway, turning our attention back to this particular shield, we've traced siliconchip.com.au out its circuit (which as far as we can tell, is not available anywhere else) and it is shown in Fig.2. While, as we said, it's pretty much based on the sample circuit, there are a number of odd design decisions here, some of which violate best practices and deserve an explanation. Firstly, you will note that IC1 runs off 3.3V and 2.5V supply rails but a number of its I/O pins, including inputs, are connected directly to Arduino pins which will be driven to +5V or thereabouts when taken high. There's no mention of any 5V-tolerant inputs in the VS1053 data sheet and it gives an "absolute maximum" rating of 3.6V on all pins. Clearly, many of these shields are in use and apparently without major problems (including our prototype). Measurements on our prototype suggest that what actually happens when you're using the shield is that input protection clamp diodes conduct, pumping up the 3.3V supply rail to around 4.1-4.2V because of current flowing from the Arduino outputs. Apparently, the VS1053 chip is able to survive this, despite an absolute maximum supply rating of 3.6V. This is not a design practice we would recommend. At the very least, some series resistors to limit the current would be a good idea. In fact, on the Sparkfun VS1053 shield board, a 74HC4050 CMOS hex level shifter IC is used to reduce the swing on the MOSI, CS, DCS, SCK and reset lines from the Arduino to VS1053 in order to protect the latter. So the designers of that board must have had the same misgivings that we do. Similarly, the microSD connector is wired up to Arduino pins D9, D11, D12 and D13 directly. Each pin has a 4.7kW pull-up to 3.3V and thus would allow the use of open-collector outputs on the micro. But the ATmega8 chip used in most Arduino boards doesn't have direct support for open collector outputs and the 4.7kW resistors would severely limit the signalling speed on these lines anyway. So again, it seems that the designers are relying on the microSD card to be 5V tolerant, or its internal clamp diodes to avoid damage. It seems to work, but we wouldn't have designed it this way. As mentioned above, the MOSI and SCK lines which are shared between the SD card and VS1053 IC are level-shifted by the 74HC4050 IC in the Sparkfun shield. The remaining spare channel on that IC is also used to reduce the swing on the CS line for the microSD card down to 3.3V. One possible solution to the lack of level-shifting would be to use an Arduino host board which runs off 3.3V, although these are not very common. Turning back to the shield, the next odd thing you will notice if you peruse the VS1053 data sheet is that it specifies another "absolute maximum" rating, this time for the processor core supply voltage (CVDD) of 1.85V. And yet the Geeetech shield uses a 2.5V linear regulator to provide this rail! We don't know if it's because Geeetech found a skip bin full of 2.5V regulators, or if they found that the chip performed better with a 40% higher core supply voltage than recommended. It's even possible (though unlikely) that the VS1053 chip on the shield is itself a knock-off which needs a higher supply voltage. Regardless, the shield works fine but it certainly is a bit weird. One nice feature of this shield is that it incorporates an on-board electret July 2017  73 microphone (with interface circuitry exactly as suggested in the VS1053 data sheet) along with a 3.5mm linein jack socket, fed to two separate inputs on the main IC. Note though that only the tip connector of the jack socket (labelled "MIC") is wired up, so you can only record in mono. At the playback end, the outputs are fed directly to another 3.5mm jack socket, this time in stereo. But the sleeve of this connector is not wired to ground, rather, it goes to the "GBUF" output of IC1 which provides a buffered reference voltage, at the same level as the quiescent voltages for the LEFT and RIGHT output pins. This is fine for driving headphones or earphones directly, or even small passive speakers (although they will have to share the negative connection). However, you may run into trouble if you are connecting the output to an amplifier, if that amplifier's ground is Earthed and so is your Arduino board (through any connection between a ground and Earth). This will effectively short the GBUF voltage out. In that case, you will need to connect DC-blocking capacitors in series with the left and right signals. Such capacitors are a feature of the Sparkfun shield, but not this one. The good news though is that provided the input impedance of your amplifier is high, they don't need to have an especially high value. 1µF plastic film (MKT/MKP) capacitors should do just fine. The VS1053 derives timing, both for its CPU and sampling clocks, from a 12.288MHz crystal. This is stepped up internally by a PLL to provide the CPU clock of around 54MHz. There are two LEDs on the shield. One is red and is connected across the output of the 3.3V regulator, indicat- ing the presence of power, while one is green and is connected between the CS line and ground, indicating activity. Both have a 1kW series currentlimiting resistor. The DREQ output of IC1 is connected to Arduino pin D2. This is used to signal the Arduino to feed more audio data or to indicate when the VS1053 is ready for commands. The Arduino is normally configured to generate an interrupt when this goes high. You may have noticed that the VS1053 IC has several GPI/O pins which can be set up by the user for various purposes. Most of them are not connected to anything on this shield, or simply have 100kW pull-down resistors connected. GPIO0 doubles as the "SPIBOOT" line and needs a 100kW pull-down so that it will boot off its internal memory rather than trying to load its boot data over an SPI bus. Fig.2: circuit diagram for the Geeetech VS1053 shield. Many of the voltage levels in this circuit run at questionable levels, such as the +2.5V line delivered to CVDD (40% higher than the maximum 1.85V). 74  Silicon Chip siliconchip.com.au Similarly, GPIO1 needs a pull-down as it will activate "real-time MIDI mode" if held high when the chip emerges from reset. We're not sure why GPIO4 has a pull-down resistor as it doesn't seem necessary. Finally, the shield provides a reset button which parallels the Arduino's, in case the one on the main board is inaccessible with the shield plugged in. Driving it from an Arduino The Arduino can read or write data on the microSD card using the MISO/ MOSI/SCK 3-wire SPI bus on pins D11-D13 while it's driving the SD_CS line on pin 9 low. The X_CS and X_DCS lines on pins D6 and D7 are left high during this time, so only the microSD card is being addressed. The VS1053 itself has two SPI serial buses, one for control (SCI) and one siliconchip.com.au for audio data (SDI); the SCI control interface is selected by bringing pin D6 low, while the SDI data interface is selected by bringing pin D7 low. The VS1053 also has a TTL RS-232 (UART) serial debugging interface, however, that is not connected to anything on this shield. The X_RESET line on pin D8 has a 100kW pull-down resistor and this holds the VS1053 in reset until the Arduino is ready to control it. D8 must be brought high before sending any commands or data to the VS1053 chip. The only additional line required to control the VS1053 from an Arduino is the DREQ line on pin D2, mentioned earlier. We're using the freely available SFEMP3 library to drive the VS1053 from an Arduino Uno-compatible module, along with the venerable SdFat library to read audio files off the microSD card. The SFEMP3 library code (which also comes with SDFat) can be downloaded from: www.billporter.info/2012/01/ 28/sparkfun-mp3-shield-arduinolibrary/ Note that while the SD card and VS1053 IC share the same SPI bus, unfortunately, it hasn't been arranged so that data can be streamed directly from the SD card to the VS1053. That's because data from the SD card appears on the MISO (masterin, slave-out) line as the SD card is the slave in this case, but data fed to the VS1053 must go on the MOSI (master-out, slave-in) line for the same reason. This means that the Arduino must actively read data off the SD card and then write it back over the same bus to the VS1053. That doubles the effective bandwidth required. Still, while playing back a 128kbit audio file (fairly typical), that only occupies about 10% of the Arduino's time, leaving plenty of time for other tasks. Unfortunately, while the VS1053 and the Geeetech shield both support recording, the SFEMP3 library does not. However, all the code and information required to enable recording are available from the VLSI website at: www.vlsi.fi/en/support/software/ vs10xxplugins.html Thankfully, while their website is a bit difficult to navigate, their documentation is comprehensive. If you want to get started with this shield, we suggest you read the project article in this issue which takes you through building a fully functional audio player based on this shield. Your other option is to download the SFEMP3 library and its example sketch and load that into your Arduino module. Some of the functions available in the SFEMP3 library include: • setVolume(vol) – sets the playback volume, either for both channels, or for each individually; a value of 40 is used for 100% • setBassFrequency(Hz)/setBassAmplitude(dB) – allows you to apply bass boost or cut • setTrebleFrequency(Hz)/setTrebleAmplitude(dB) – allows you to apply treble boost or cut • playMP3(filename, time) – play the MP3 (or other file) with the given name starting from the given time July 2017  75 • • • • • • • • stopTrack() – stops playback isPlaying() – returns true if a file is currently being played or is paused skip() – go forwards or back by up to 32.5s each time skipto() – jump to a point in the file, limited to the first 65.5s currentPosition() – returns a value indicating how many milliseconds of audio have been played from the current file pauseMusic()/resumeMusic() – self-explanatory setVUMeter(on) – enables or disables VU metering getVULevel() – indicates the current VU level, in dB, for both channels Plugins enable other features In addition to the plugin enabling Vorbis encoding, there are a number of others available, which fix bugs and add extra capabilities. One plugin which is highly recommended is the "VS1053b patch w/FLAC decoder", available from: www.vlsi.fi/en/support/software/vs10xxpatches.html This fixes a number of bugs, along with adding the ability to decode losslessly compressed FLAC files. Other plugins can add functionality which include: • a multi-band equaliser • a sine/DTMF waveform generator • a PCM audio mixer which allows the microcontroller to feed audio A top view look at the shield (larger than life size) gives us a better overview of all the components used in it. You can see the on-board electret microphone, the microphone input and speaker output populate the righthand side of the board (from top to bottom). • • to the chip which is digitally mixed with audio from the file being decoded a mic/line input mixer which allows input monitoring during playback, including mono downmix capability a pitch shifter plugin which allows changing the pitch of the audio without changing temporarily • a plugin which makes rewinding/ fast-forwarding WMA files easier • a package of "loudness" enhancing filters These are in addition to built-in features of the VS1053b which we haven't mentioned yet, including zerocrossing detection for smooth volume changes, quiet power-on and power-off and a 64-voice MIDI synthesiser. SC Radio, Television & Hobbies: the COMPLETE archive on DVD YES! A MORE THAN URY NT CE R TE AR QU ONICS OF ELECTR HISTORY! This remarkable collection of PDFs covers every issue of R & H, as it was known from the beginning (April 1939 – price sixpence!) right through to the final edition of R, TV & H in March 1965, before it disappeared forever with the change of name to EA. For the first time ever, complete and in one handy DVD, every article and every issue is covered. If you’re an old timer (or even young timer!) into vintage radio, it doesn’t get much more vintage than this. If you’re a student of history, this archive gives an extraordinary insight into the amazing breakthroughs made in radio and electronics technology following the war years. And speaking of the war years, R & H had some of the best propaganda imaginable! Even if you’re just an electronics dabbler, there’s something here to interest you. Please note: this archive is in PDF format on DVD for PC. Your computer will need a DVD-ROM or DVD-recorder (not a CD!) and Acrobat Reader 6 or above (free download) to enable you to view this archive. This DVD is NOT playable through a standard A/V-type DVD player. Exclusive to: SILICON CHIP 76  Silicon Chip ONLY 62 $ 00 +$10.00 P&P Order now from www.siliconchip.com.au/Shop/3 or call (02) 9939 3295 and quote your credit card number. siliconchip.com.au