Wednesday, April 16, 2014

Circuit #2 Potentiometer Notes

Goal: Measure the position of a potentiometer and use it to control the blink rate of an LED. Turn the knob to make it blink faster or slower!

Serial.print("text") -- Control knob that changes resistance as it is turned. By using it as a "voltage divider," the Arduino can sense the position of the knob and use that to control whatever you want (ie. the blink rate of an LED). A potentiometer is a three terminal resistor with an adjustable voltage divider. A voltage divider, or potential divider, is a linear circuit that produces an output voltage (Vout) that is a fraction of its input voltage (Vin). If only two terminals of the potentiometer are used, one end and the wiper, it acts as a variable resistor or a rheostat. Potentiometers have three pins. When using as a voltage divider, connect the outside pins to ground and power. The middle pin will be the signal (a voltage which varies from 0 volts to 5 volts depending on the position of the knob).

Function - A named block of code that performs a specified function

Variable - A named number. Often used to store numbers that change. Variables must be declared before they are used. Variables are case sensitive, and if declared outside a function are global variables.

Int - Integer, can range from -32768 to 32767.

Serial.print("text") -(# pin) - The Arduino can read external voltages on the analog input pins using the built in function analogRead( ). this function takes one input value, the analog pin we are using and returns an integer number that ranges from 0 (0 volts) to 1023 (5 volts).

Circuit #2 retrieves a value from the potentiometer from 0 to 1023 (0 to 5 volts). This value is then used as the delay time for the LED blinking.

Sources:
Vilros Ultimate Starter Kit Tutorial Sketches 1-12
http://en.wikipedia.org/wiki/Voltage_divider
http://en.wikipedia.org/wiki/Potentiometer

No comments:

Post a Comment