Further Arduino tests for Space Rock

Built a player and audio amplifier that plays a .wav file from an SD Card, based on this circuit / tutorial:

Build a Great Sounding Audio Amplifier (with Bass Boost) from the LM386

Sadly, despite what it says above, it doesn’t sound great.

So, need to investigate some better options for sound output for this, clearly.

In the meantime, am going to investigate the tilt switch aspect of this build – http://www.amazingtips247.co.uk/2017/01/tilt-switch-arduino-with-sound.html

As well as how to then make this work randomly:

And using other (proximity) sensors:



Coding the Space Rock player with Arduino

Have had lots of fun and games trying to get the Arduino element of the player to work, so far.

Firstly, getting the newly-purchased SD card to read was relatively straightforward. Once I worked out that I could transfer the files through my camera (as I don’t have an SD card reader other than the one I had just bought to attach to the Arduino), testing to see if it was connected and reading the files on there worked okay. Once I had reformatted the card for FAT32, at least. There is still an issue with some of the files having names too long for the DOS 8.3 naming convention, but I will rename these later.

Testing the SD card reader
SD card reader working

Next, I bought the additional components (amplifier chip and capacitors) for, and built, this circuit:

Simple Audio player schematic
Simple Audio player schematic
Simple Audio player amplifier circuit

Unfortunately, not realising there was a difference between the Arduino DUE board, which this circuit was designed for, and the Arduino (Elegoo) UNO I have, took me off on the wrong track somewhat and cost me a fair bit of time. Essentially, the DUE uses the Audio.h library, which needs the DAC port. A port my UNO sadly doesn’t have.

So, next, lots of Googling, trying to find a simpler circuit and code that uses the TMRpcm library instead. For a while, every bit of code I verified was giving me errors similar to this one (I tried a few!):

So then I decided to try the other computer, and the same lines of code all worked fine.

Next, to build the circuit. I tried to build this:

Simple Audio player with two buttons.

But the wiring around the capacitors and amp chip lost me completely.

Then I started working with this code – https://maxoffsky.com/maxoffsky-blog/how-to-play-wav-audio-files-with-arduino-uno-and-microsd-card/ – and finally managed to play various of the .wav files on the card
(although the audio was so distorted it was sometimes hard to tell!).

But how to make the circuit, so that it wasn’t just plugged straight into the Arduino board? After a couple of false starts, I found and built this:

This meant I now had very distorted, but louder audio from the speaker.

Simple audio amp circuit for testing
Simple audio amp circuit for testing

So…next steps..?

  1. Build the more complex amplifier circuit above that works on the UNO, ideally with a potentiometer for volume control
  2. Find and write the code to play the .wavs whenever a tilt switch is activated, and turn off again when tilted back into place
  3. Find and write the code to make this happen randomly (ie play one of the eight .wav files at random) when the player is tilted forward (rather than the current keyboard entry in serial monitor)
  4. Last, but definitely not least, think about how the circuitry and power can fit inside the player shell

Watch this space.

Inspiration for the ‘Space Rock’ audio player

I want to make one of these. Imagining them as a limited edition for a band or artist, loaded with samples of their work, so the user can create their own soundscapes. Could be a version using the Voyager Sounds collection?

And also a nod to the interactive tilt radio by Luka Or, whose shape initially inspired the ‘Space Rock’.