Making Arduino Speak

About a month ago I wrote a post about how my Interactive Exhibit Design course had me learning how to code an Arduino microcontroller to turn lights on at the push of a button. We have had some studio lessons since then. Just a few weeks ago we started playing with sound. Our kits come with a rudimentary speaker that, while attached to the Arduino breadboard, can be programmed to make noises.

We began with a basic configuration, with the speaker connected to a simple circuit on the breadboard. We then programmed the Arduino to tell the speaker to make a rather unsettling noise. We also included a photoresistor in the circuit. We programmed this to change the noise from the speaker depending on how much light the photoresistor received. This was a good way to get a basic understanding of how the speaker worked, but we were not yet at the point where we could get much application out of it. Perhaps the basic idea could be applied by an exhibit designer who wanted to trigger a sound based on a change in lighting. For example, say a passerby inadvertently covers a light source, and the sound of gunfire erupts as he or she enters the trench section of a First World War exhibit (sort of like a tripwire without the tripping part). Obviously, that would require some different coding and a speaker that could handle the audio file.   

Next, we built a keyboard instrument. We removed the photoresistor from the circuit and instead attached four buttons. We then coded each of these four buttons to prompt the speaker to emit a different tone when pressed. I had a little bit of trouble with my breadboard on this one. In a previous studio class, I’d learned that one of the lines on my breadboard (the one marked in pen) was broken. It seemed that a second line was also broken, meaning I had to move things around on the breadboard to ensure all four buttons were part of a complete circuit. This is a constraint I’ll have to be aware of as I move forward with Arduino projects.

As you can see in the attached videos, the buttons worked like keys on a keyboard, each with a different sound. If I had any musical talent, maybe I would be able to compose a short song using this new instrument. Instead, it’s given me some other ideas. You’ll recall that in my last post I wrote about using buttons to turn on lights to highlight parts of a small display, such as a map of Sicily. Adding buttons with sounds would allow me to add some sound effects to the display. Perhaps I could upload the sound of an aircraft taking off, of fighter pilots or bomber gunners firing machine guns, or the sounds of air raid sirens, flak, or crashing aircraft. Pushing a different button might highlight a different part of an aircrew’s operational sortie over Palermo, Messina, or one of the Axis aerodromes on the island.

I could also program the speaker to narrate parts of the Battle of Sicily depending upon which button is depressed. This would add another layer to the light display rather than relying on the user to read the button’s accompanying text. I believe this would require a superior speaker and different programming software. I also would need some help programming the lights and audio files to work in sync. It would be great for the light to turn on at the same time as the narration begins. The light would turn off when the narration ends, and both would end when the user pressed another button, starting that lighting and narration sequence.

Another interesting application for a setup like this could be an audio listening display. Museums use these sorts of displays all the time. I remember one at the Canadian War Museum in their Cold War gallery. The visitor can put on a set of headphones and listen to various Cold War-era tracks from recognizable artists. I keenly remember falling in love with Tears for Fears’ ‘Everybody Wants to Rule the World’ when I was there as a teenager. It was a memorable experience that I won’t soon forget – the very thing that the best museums nail.

Arduino – Learning and Applying the Basics

Interactive Exhibit Design is different from any other history course I have ever taken. The Public History Graduate Program at Western University takes us far beyond theory into practical applications for putting history to work in the world, but this new course is a cut above. Interactive Exhibit Design is a studio course where we are learning (slowly but surely) about how to use microcontrollers to manipulate objects in the physical world using some basic electronic components and a coding program called Arduino.

We completed our first studio projects a few weeks ago now. At first, we started by plugging an LED bulb into one of the pins on our Arduino boards and coding that pin to blink the light at a particular frequency. I tried to spell ALEX in Morse code (You might be able to make out ._ ._.. . _.._ in the video).

This could make for a fun interactive, activity. I could program the Arduino to spit out a secret message that students would have to decipher using a Morse code book. In doing so, the activity would teach students about wartime communication methods. To put some more fun into the project, maybe the light could be fitted to the photograph or drawing of a Royal Canadian Navy corvette at sea during the Battle of the Atlantic. The student could pretend that he or she is a sailor on a neighbouring ship trying to receive the message. One thing I noticed with the Morse code coding was the need to put long spaces between letters and words. Otherwise, it makes the message difficult to follow because it flashes by so quickly. Furthermore, when it’s programmed to repeat the message, it can be hard to identify where it begins.

Next, we set up and programmed the board to turn a light on when someone pushed a button. The button operates as a switch. The switch is open naturally, but when the button is pressed the switch closes, completing the circuit and turning the light on. This is a basic but handy setup. Museum exhibits use lights like these all the time. You press a button and part of a panel lights up corresponding to the button you have pressed. The button may illuminate the answer to a question posed next to the button or an element of a map that highlights one part of a battlefield.

This got me thinking. As research assistants at the Royal Canadian Regiment Museum this term, Martha Sellens and I are working on a refresh of the Second World War exhibit. One of the proposed elements of this exhibit is an interactive map of Europe. Perhaps Martha and I could pull together a prototype of such a map. It could follow the events that led to Canada’s declaration of war in 1939, or it could trace the path of the RCR as they fought through Europe during the ensuing conflict.

Thinking that this could be too ambitious for a first go, I had another thought. Maybe I could make something with an interactive map that could teach people about the Battle of Sicily, the subject of my book, Eagles over Husky. I could take one of the maps in the book and PLAK-IT. This would provide me with a solid material to drill holes into and secure my lights. I could then program the lights to light up with the push of various buttons. The illuminated segments of the map could feature various bombing raids or the beaches where Allied forces stormed ashore on the early morning of 10 July 1943. I could even number the lights and have the user follow a narrative of the campaign using the illuminated map sections as a guide. This would be a neat piece to take with me when I go to sell books at book fairs or militaria shows this spring.

These ideas do raise some challenges. What if I wanted the lights to stay on for a prescribed time without the user having to keep the button depressed to complete the circuit? So far, I can code a light to stay on for an amount of time or to blink at a particular frequency, but I’m not sure how to make this work alongside a button. We did program multiple lights to blink in a sequence once we pushed a button, but I do not think we have switches that allow for a timed illumination (i.e. I press a button, and the light stays on for five seconds).

Another challenge may be that all our components need to plug into the Arduino’s breadboard and link to the Arduino Uno microcontroller itself. I will need some guidance on how to integrate these objects and the components into the map itself. I will also need to learn a bit more about wiring and circuits to make this vision a reality. This should bode well for an exciting term!