Presentation is loading. Please wait.

Presentation is loading. Please wait.

Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output.

Similar presentations


Presentation on theme: "Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output."— Presentation transcript:

1 Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output

2 Rebecca Bruce and Susan Reiser, May 2015 330 Ohm resistor Demo 1: Digital Output on a Breadboard Connect the blue wire to pin 13 Run File > Examples > Basic> Blink

3 Rebecca Bruce and Susan Reiser, May 2015 Digital Input/Output Digital IO is binary valued—it’s either on or off, 1 or 0 Internally, all microprocessors are digital, why? 1 0

4 Rebecca Bruce and Susan Reiser, May 2015 IO Pins Image from Theory and Practice of Tangible User Interfaces at UC Berkley

5 Rebecca Bruce and Susan Reiser, May 2015 Demo 2: Digital Input Add a push-button switch to the breadboard - Connect the green wire to pin 2 Run File > Examples > Digital > Button 330 Ohm resistor

6 Rebecca Bruce and Susan Reiser, May 2015 Digital? Analog? Digital has two values: on and off Analog has many (infinite) values Computers don’t really do analog input, they quantize Remember the 6 analog input pins---here’s how they work Image credit: Tod Kurt

7 Rebecca Bruce and Susan Reiser, May 2015 Variable Resistance: Potentiometers It is a variable resistor

8 Rebecca Bruce and Susan Reiser, May 2015 Analog Input Connect to analog pin A0 Run File > Examples > Basic> ReadAnalogVoltage Open the serial port monitor to see the output

9 Rebecca Bruce and Susan Reiser, May 2015 Number of states or “bins” is the resolution Arduino resolution is 10-bits (1024 values, including 0) 5/1023 = 4.9 mV smallest voltage change you can measure Analog to Digital Image credit: Eoin Brazil

10 Rebecca Bruce and Susan Reiser, May 2015 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.

11 Rebecca Bruce and Susan Reiser, May 2015 Analog Output Vary the effective voltage by modulating the width of the high pulse Image credit: Tod Kurt

12 Rebecca Bruce and Susan Reiser, May 2015 PWM is Everywhere Lamp dimmers, motor, speed control, power supplies, noise making, etc.


Download ppt "Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output."

Similar presentations


Ads by Google