Presented November 4, 2015, at the Women Hardware Hackers meetup. http://www.meetup.com/Women-Hardware-Hackers-ATX/
Incorporate sound into your next Arduino project. We'll walk through electronics and code, with an emphasis on what to tweak to customize online examples so they fit the goals of your own project. This session will be an interactive discussion.
At past meetups we've been playing with an Adafruit project, making Ursula's necklace from The Little Mermaid (https://learn.adafruit.com/ursulas-seashell-necklace/overview). In this session we'll dive into some key features of the code in that project, to understand how it translates the sound from a microphone into an LED light display. Most of our group is new to C++, so don't worry if that code doesn't make sense yet, and all questions are fair game. (Covered live at the whiteboard and not represented much in these slides.)
As a warm-up we'll start with simpler examples that you can fit into a project right away: a buzzer, tones from a speaker, and playing a sound file.
5. Warm-Up Projects
Play a tone
connect a speaker
tone() function
#define to give good names (or const for safety)
pitch
for loop
Interactive buzzer
map() function
Serial monitor
WAV file
library
pull-down resistor
Audacity
again: Serial monitor
6. Ursula's Seashell Necklace Project
Audio input
again: library, map() function
instantaneous function for sensitivity
peak clipping
noise cancelling
Code concepts
datatypes
ternary operator
bit shift operator
Wikipedia for C and C++ Operators
Visual display
SPI for NeoPixel (serial again, like the monitor)
CHSV for mapping to color
https://learn.adafruit.com/ursulas-seashell-necklace/
7. Play a Tone
• connect a speaker
• tone() function
• #define to give good
names (or const for
safety)
• pitch
• for loop
20. Today's Topics
• Simple speaker, built-in tone() function
• Use map() to transpose one range onto another
• Libraries and shields give extra capabilities
• Pull-down resistors make inputs more reliable
• Microphones read voltages, which must be amplified and offset to be read
• Look up unknown code punctuation in a list of C and C++ operators
21. Future Topics
• Schematic ➡ breadboard
• Breadboard ➡ schematic
• Bit-wise operations and binary numbers
• Keeping track of your work with source control
• Pull-down (and pull-up) resistors
• Pulse-width modulation (PWM)
• More sensors: infrared, light, piezoelectric...
• Wearables and paper circuits