using sound with arduino | women hardware hackers atx, november 2015

29
Using Sound with Arduino Women Hardware Hackers | November 2015 Sharon Cichelli

Upload: sharon-cichelli

Post on 15-Apr-2017

188 views

Category:

Devices & Hardware


0 download

TRANSCRIPT

Page 1: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

Using Sound with ArduinoWomen Hardware Hackers | November 2015

Sharon Cichelli

Page 2: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

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

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
Page 5: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

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

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

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://github.com/scichelli/Arduino-Sketches/blob/master/SoundExamples/speaker/speaker.ino

Page 9: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 10: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

Interactive Buzzer

• map() function

• Serial monitor

Page 11: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

https://github.com/scichelli/Arduino-Sketches/blob/master/SoundExamples/buzzer/buzzer.ino

Page 12: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 13: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

WAV file• library

• pull-down resistor

• Audacity

• again: Serial monitor

Page 14: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

https://github.com/scichelli/Arduino-Sketches/blob/master/SoundExamples/rickroll/rickroll.ino

Page 15: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 16: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

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
Page 18: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

https://learn.adafruit.com/ursulas-seashell-necklace/the-code

Page 19: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

Summary

Page 20: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

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

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
Page 23: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015

Image Backup

Page 24: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 25: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 26: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 27: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 28: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015
Page 29: Using Sound with Arduino | Women Hardware Hackers ATX, November 2015