The Swan

My final assignment for PComp was something that came to mind after hearing about Carnival of the Animals by French composer Camille Saint-SaĆ«ns. I don’t recall what podcast or perhaps NPR station the program was on, but the show host talked of the imagery of the swan moving its neck up ad down according to the melody. I wanted to build a swan that would move its wings, tail, feet and neck to the rhythm and melody of the song.

But that was not to be yet, for this semester. It would take more fabrication, programming, and solving more bugs than I had time and tolerance for.

What I built was a box with buttons. The box contains an Arduino Uno, breadboard, the Emic 2 text to speech shield, and an MP3 shield.

When the software is loaded to the Arduino, The Swan plays, and text is read by a computer voice from the text to speech chip.

When fully loaded, the Arduino has software that is a combination of three different programs: The arduino IDE example on button state detection, Tom Igoe,s MP3 Shield Intro from his GitHub repo, and his Emic2_demo from the same repo.

After building the box, I made sure each new part of the program was working. I had the TTS and button working, and got errors after bringing in the MP3 shield code. I had most of the setup working after I got a little help from a fellow first year student with the MP3 code. 

I kept changing the code since it was too large for the Uno, and I had to experiment with which pin to put my button into on the Arduino. Many of the pins were being used by the MP3 shield, leaving little to work with besides it, and the TTS chip.

I put the project to rest, and went to do the same on Tuesday evening. When I eft it, the button wasn’t working very well. My text wasn’t reading in order. 

The next morning, I recalled that the button code called for a resistor on the breadboard. Putting the resistor in made a world of difference. Now my text read correctly more often.

I played the text and music through a mixer and small amplifier, allowing me to control how loudly each pard played.

The project works well most of the time. My next steps are to include debounce to the button, and to change things around to allow me to put more text through without running out of space on the Arduino.

Leave a Reply

Your email address will not be published. Required fields are marked *