The voltage measured (Vout) follows this formula: This circuit uses a variable resistor, a fixed resistor and the measurement point is in the middle of the resistors. To get a voltage proportional to the photoresistor value, a resistor divider is necessary. These inputs do not draw almost any current, therefore by Ohm's law the voltage measured on the other end of a resistor connected to 5V is always 5V, regardless the resistor's value. The circuit based on a photoresistor uses a resistor divider to allow the high impedence Analog input to measure the voltage. #Arduino analog series#To use an additional LED, attach its longer leg (the positive leg, or anode), to digital pin 13 in series with the 220 ohm resistor, and it's shorter leg (the negative leg, or cathode) to the ground (GND) pin next to pin 13. The third goes from analog input 0 to the middle pin of the potentiometer.įor this example, it is possible to use the board's built in LED attached to pin 13. The second goes from 5 volts to the other outer pin of the potentiometer. The first goes to ground from one of the outer pins of the potentiometer. Hardware Requiredġ0K ohm photoresistor and 10K ohm resistorĬonnect three wires to the Arduino board. The resistor's analog value is read as a voltage because this is how the analog inputs work. In this example we use a variable resistor (a potentiometer or a photoresistor), we read its value using one analog input of an Arduino board and we change the blink rate of the built-in LED accordingly.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |