using sound with arduino | women hardware hackers atx, november 2015
TRANSCRIPT
![Page 1: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/1.jpg)
Using Sound with ArduinoWomen Hardware Hackers | November 2015
Sharon Cichelli
![Page 2: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/2.jpg)
Adafruit Project: Ursula's Seashell Necklace
https://learn.adafruit.com/ursulas-seashell-necklace/
![Page 3: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/3.jpg)
Keep in Touch
Sharon Cichelli
womenhh.slack.com
girlwritescode.com
lostechies.com/sharoncichelli
slideshare.net/girlwritescode
@scichelli
![Page 4: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/4.jpg)
![Page 5: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/5.jpg)
Warm-Up Projects
Play a toneconnect a speaker
tone() function
#define to give good names (or const for safety)
pitch
for loop
Interactive buzzermap() function
Serial monitor
WAV filelibrary
pull-down resistor
Audacity
again: Serial monitor
![Page 6: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/6.jpg)
Ursula's Seashell Necklace Project
Audio inputagain: library, map() function
instantaneous function for sensitivity
peak clipping
noise cancelling
Code conceptsdatatypes
ternary operator
bit shift operator
Wikipedia for C and C++ Operators
Visual displaySPI for NeoPixel (serial again, like the monitor)
CHSV for mapping to color
https://learn.adafruit.com/ursulas-seashell-necklace/
![Page 7: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/7.jpg)
Play a Tone
• connect a speaker
• tone() function
• #define to give good names (or const for safety)
• pitch
• for loop
![Page 8: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/8.jpg)
https://github.com/scichelli/Arduino-Sketches/blob/master/SoundExamples/speaker/speaker.ino
![Page 9: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/9.jpg)
![Page 10: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/10.jpg)
Interactive Buzzer
• map() function
• Serial monitor
![Page 11: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/11.jpg)
https://github.com/scichelli/Arduino-Sketches/blob/master/SoundExamples/buzzer/buzzer.ino
![Page 12: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/12.jpg)
![Page 13: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/13.jpg)
WAV file• library
• pull-down resistor
• Audacity
• again: Serial monitor
![Page 14: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/14.jpg)
https://github.com/scichelli/Arduino-Sketches/blob/master/SoundExamples/rickroll/rickroll.ino
![Page 15: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/15.jpg)
![Page 16: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/16.jpg)
Ursula's Seashell Necklace
Adafruithttps://learn.adafruit.com/ursulas-seashell-necklace/
• Audio input• again: library, map() function• instantaneous function• peak clipping• noise cancelling
• Code concepts• datatypes• ternary operator• bit shift operator• C and C++ Operators
• Visual display• SPI for NeoPixel• CHSV
![Page 17: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/17.jpg)
![Page 18: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/18.jpg)
https://learn.adafruit.com/ursulas-seashell-necklace/the-code
![Page 19: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/19.jpg)
Summary
![Page 20: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/20.jpg)
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
![Page 21: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/21.jpg)
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
![Page 22: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/22.jpg)
![Page 23: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/23.jpg)
Image Backup
![Page 24: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/24.jpg)
![Page 25: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/25.jpg)
![Page 26: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/26.jpg)
![Page 27: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/27.jpg)
![Page 28: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/28.jpg)
![Page 29: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015](https://reader036.vdocuments.us/reader036/viewer/2022062904/587934b21a28ab7c448b74c1/html5/thumbnails/29.jpg)