Analog Input Analog Signals Continuous signal Any range

  • Slides: 12
Download presentation
Analog Input

Analog Input

Analog Signals • Continuous signal • Any range of values between high and low

Analog Signals • Continuous signal • Any range of values between high and low

Analog Sensors • Analog sensors allow us to measure changes in information. • Tell

Analog Sensors • Analog sensors allow us to measure changes in information. • Tell us how much of a change there is (continuous) not just if it is there or not like digital (on-off). • The Arduino handles the input of analog info with a ADC (Analog to Digital Converter).

ADC (Analog to Digital Converter) • Converts a analog signal to a digital number.

ADC (Analog to Digital Converter) • Converts a analog signal to a digital number. • Reads the value from the specified analog pin. The Arduino board contains a 6 channel 10 -bit analog to digital converter. This means that it will map input voltages between 0 and 5 volts into integer values between 0 and 1023. This yields a resolution between readings of: 5 volts / 1024 units or, . 0049 volts (4. 9 m. V) per unit. • It takes about 100 us (0. 0001 s) to read an analog input, so the maximum reading rate is about 10, 000 times a second.

analog. Read() • analog. Read(pin), pin: the number of the analog input pin to

analog. Read() • analog. Read(pin), pin: the number of the analog input pin to read from (0 to 5 on most boards)

Analog devices photocell FSR potentiometer Strain gauge Ultrasonic sensor

Analog devices photocell FSR potentiometer Strain gauge Ultrasonic sensor

Force Sensitive Resistor

Force Sensitive Resistor

potentiometer • A potentiometer is a simple knob that provides a variable resistance, which

potentiometer • A potentiometer is a simple knob that provides a variable resistance, which we can read into the Arduino board as an analog value • http: //tangentsoft. net/elec/movies/tt 15. html • By turning the shaft of the potentiometer, we change the amount of resistance on either side of the wiper which is connected to the center pin of the potentiometer. This changes the relative "closeness" of that pin to 5 volts and ground, giving us a different analog input. When the shaft is turned all the way in one direction, there are 0 volts going to the pin, and we read 0. When the shaft is turned all the way in the other direction, there are 5 volts going to the pin and we read 1023. In between, analog. Read() returns a number between 0 and 1023 that is proportional to the amount of voltage being applied to the pin.

How to connect a potentiometer • We connect three wires to the Arduino board.

How to connect a potentiometer • We connect three wires to the Arduino board. The first goes to ground from one of the outer pins of the potentiometer. The second goes from 5 volts to the other outer pin of the potentiometer. The third goes from analog input 2 to the middle pin of the potentiometer.

Mini review: Functions to know • pin. Mode(pin, mode) • digital. Write(pin, value) •

Mini review: Functions to know • pin. Mode(pin, mode) • digital. Write(pin, value) • digital. Read(pin) • analog. Read(pin)

Home Work • Find 3 examples of sample code online and send me the

Home Work • Find 3 examples of sample code online and send me the link.