Slide #1.

Using Arduino terial taken from Todbot blog Bionic Arduino Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #2.

What is the Arduino Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #3.

Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #4.

Arduino Duemilanove • 13 digital input/output pins – Including 6 with PWM for analog output • 6 analog input pins • USB connection – For serial I/O and uploading board • ATmega168 or ATmega328 processor – 16k or 32k for program, 1k or 2k for data • Arduino bootloader • ~ $30 • More Info Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #5.

Other Arduino Boards • Arduino Mega – Lots of I/O pins and lots (128k) of program space – ~ $65 • LilyPad – For wearable applications – ~ $20 • Boarduino – Fits within a breadboard – ~ $20, but must be soldered! Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #6.

Activity 1 • Start the Arduino IDE from the terminal window with the command: arduino • Make sure to connect the PC to the Arduino using the USB cable. • Designate the connection port and processor type. • Try out the “blink” example – Select: File > Examples > Digital > Blink Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #7.

Connect the USB Cable Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #8.

Select Connection and Type atmega328 Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #9.

Arduino IDE Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #10.

Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #11.

Status Messages Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #12.

Activity 1 Modified--Add an External LED to pin 13 • File > Examples > Digital > Blink • LED’s have polarity – Negative indicated by flat side of the housing and a short leg www.instructables.com Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #13.

Terminology Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #14.

Arduino Control • Very much like Processing/Java – if, then, while, switch – Functions, expressions • setup() – Runs once at beginning (or reset) • loop() – Runs continuously • Like draw() Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #15.

Arduino Digital I/O • pinMode(pin, mode) – Sets pin to either INPUT or OUTPUT • digitalRead(pin) – Reads HIGH or LOW from a pin • digitalWrite(pin, value) – Writes HIGH or LOW to a pin • Electronic stuff you can ignore – Output pins can provide 40 mA of current – Writing HIGH to an input pin installs a 20KΩ pullup Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #16.

Arduino Timing • delay(ms) – Pauses for a few milliseconds • delayMicroseconds(us) – Pauses for a few microseconds Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #17.

Circuits Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #18.

Breadboard Fundamentals Connect this column to GND (0 volts) Connect this column to 5V All holes in each of the four long columns are connected internally. Use these to route power and ground. Connect this column to GND (0 volts) Connect this column to 5V Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 There are ten holes that form the rows. These are divided into two sets of five holes. All holes in each set of five are connected
More slides like this


Slide #19.

Activity 2 • File > Examples > Digital > Melody • Speakers have polarity. Positive indicated by small + or dot on piezoelectric speaker. Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #20.

Activity 2 • Get a breadboard and a piezoelectric speaker • Assemble as shown Image credit: Tod Kurt • Try out the built-in “melody” example – Select: File > Examples > Digital > toneMelody • Try this version of Melody.pde Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #21.

Digital? Analog? • Digital has two values: on and off • Analog has many (infinite) values • Computers don’t really do analog, they quantize • Remember the 6 analog input pins---here’s how they work Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Image credit: Tod Kurt
More slides like this


Slide #22.

Analog to Digital • Number of states or “bins” is the resolution • Arduino resolution is 10-bits (1024 values) • 5/1024 = 4.8 mV smallest voltage change you can measure Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Image credit: Eoin Brazil
More slides like this


Slide #23.

Analog Output • Computers can’t output analog voltages – Only digital voltages (0 volts or 5 volts) • Simulating an analog signal with Pulse Width Modulation (PWM) – Can’t directly supply 2.5V, but can pulse the output on and off really fast to produce the same effect---the same effective voltage. Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #24.

Analog Output Vary the effective voltage by modulatin g the width of the high pulse Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Image credit: Tod Kurt
More slides like this


Slide #25.

Activity 3 • Hardware Needed: – – – – Resistor (in 220-500 Ohm range) Breadboard LED Wire • Assemble as shown (MOVE the piezo speaker to pin 7) Image credit: Tod Kurt –Select: File > Examples > Analog > Fading Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #26.

PWM is Everywhere • Lamp dimmers, motor, speed control, power supplies, noise making, etc. • Now on to analog input using sensors---DON’T DISASSEMBLE your breadboards Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #27.

Sensing the Dark: Photoresistors • a.k.a. a photocell or light-dependent resistor • It is a variable resistor – Brighter light => lower resistance • Create a voltage divider to use the photoresistor Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Image credit: Tod Kurt
More slides like this


Slide #28.

Activity 4 • Hardware Needed: – – – – Resistor (approx. 10k Ohm) Breadboard Photoresistor Wire • Assemble as shown Image credit: Tod Kurt Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #29.

A Theremin • Create a theremin using the photoresistor – A spooky sound machine • Works by measuring your body’s electric field – We’ll use light to control the tone produced • We’ll also control the brightness of the LED using the photoresistor. • Verify your breadboard configuration! Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #30.

Theremin Breadboard Configuration Hardware Needed: Resistors, Breadboard, Wire, Photoresistor, Piezo speaker, LED Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #31.

The Theremin Program Load and run the TherminAndLED program Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #32.

Sensors • There are many analog sensors that could be used in place of the photoresistor • Check out our “theremin” demos created using other sensors Image credit: Tod Kurt Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #33.

Communication Between the Arduino and Your Computer Arduino Program Arduino Board Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Serial (TTL) Communication Processing Program Your Computer
More slides like this


Slide #34.

Processing • Includes libraries supporting serial communication, video capture, audio processing… • VERY IMPORTANT: enter the following command in the terminal window to update the serial library: ~brock/bin/serialfix • Start Processing from the terminal window Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #35.

Activity 5 • Hardware Needed: – – – – Resistor (10k Ohm) Breadboard Photoresistor Wire • Don’t reassemble this is the same schematic as Activity 4. Image credit: Tod Kurt Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #36.

Activity 5 • Open SimpleWrite.pde into the Arduino IDE. • Open SimpleRead.pde into Processing. Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #37.

Serial Communication in Arduino Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #38.

Serial Communication in Processing Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #39.

Clarifications • SimpleWrite spends the first second sampling the photocell readings and setting limits. • The Arduino program restarts when the Processing program starts. • If the Processing program begins behaving badly, try pressing the restart button on the Arduino. Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this


Slide #40.

Project 2 • Project 2 Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009
More slides like this