Since electricity follows the path of least resistance, the point directly before R1 is Vin (5V on this setup), after R2 is 0V (connected to ground), and between R1 and R2 is Vout (the amount not being sunk to ground by R2). A voltage divider works by sinking a portion of the voltage in the circuit back to ground. If it still doesn’t work after that, I would conclude that you have a bad resistor or your analog pin 0 has somehow been damaged (the latter is really unlikely).
These are the readings I got with a 200 Ohm “unknown” resistor:įirst, check all your connections, and also verify that you have updated the sketch with the new resistance value for R1. After you’ve got the LCD set up, connect the Ohm meter as shown above, and upload this program to the Arduino: #include
#Arduino 1.8.5 won't start how to
That will show you how to connect everything. First you’ll want to read our tutorial on setting up an LCD display on the Arduino. One reader commented that they would like to display the resistance measurements on an LCD.
When you open up the serial monitor you’ll see the resistance values printed once per second. There will be two values, R2 and Vout. You can use any other analog pin though, just change the pin number in line 1, and wire the circuit accordingly. The program sets up analog pin A0 to read the voltage between the known resistor and the unknown resistor. Therefore, my line 5 should look like this: float R1 = 1000. In my case, I’m using a known resistor with a value of 1K Ohms (1000 Ohms).
Now, enter this code into the Arduino IDE and upload it to your board: int analogPin = 0 Įnter the value of your known resistor (in Ohms) on line 5 of the code above.