Pages: [1]   Go Down
Author Topic: What pins do I use to measure the voltage across a potentiometer?  (Read 199 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am new to electronics and have managed to use an Arduino and an lcd shield to monitor the speed of a wood lathe I restored. I would also like to display the % of the motor speed based upon the pot voltage, which will vary from 0 to 12 volts. I believe I can figure out the code, but am not sure where to attach leads off the pot to the Arduino to monitor the voltage of the pot. I am worried that I could fry the Arduino when trying to measure the pot voltage. Any suggestions would be greatly appreciated.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12549
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are some examples with the IDE demonstrating how to read a potentiometer position via an analog output. A typical potentiometer has a pair of terminals connected to the ends of the track, and a third terminal connected to a wiper. You would connect the end terminals to 5V and GND, and the wiper to an analog input. Make sure you identify the terminals correctly since connecting it wrongly could end up shorting the Arduino's power supply. It's pretty universal for the three terminals to be arranged in a line with the wiper in the middle, and you could easily confirm that from the data sheet or using a resistance meter.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

BCC AZ USA
Offline Offline
Edison Member
*
Karma: 34
Posts: 1150
It gets hot so it must be working
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is the pot part of the motor controller?  What is the voltage at the wiper of the pot (0-5V, 0-12V)?  If it is 0-5V then connect to an analog input and use map(0,1023,0,100) to convert to percent.  If it is 0-12V you might be able to feed it to a voltage divider to get down to 0-5V.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33371
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If your pot gives 0 to 12V, then connect the low end of the pot to the arduino ground.
Connect the middle connection of the pot ( the wiper ) to a 10K resistor with the other end to analogue input 0. Connect a 6K8 resistor from analogue input to ground.
Do not wire it up with anything powered up.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 5
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know if it matters, but I have powered the Arduino off two of the wires for the pot, using a 2.1 mm barrel connector (using the red and the black wire), so it has 12 v powering the Arduino.The schematic of the pot is attached (see second page) and the pot is controlling the motor and goes from 0 to 12v.

Once the connections between the wiper, 10K resistor, analog 0,  6K8 resistor and ground are completed, then all that need be done is to read analog 0 using map as suggested. That all makes sense to me. Thanks for the responses you have made it clear what I have to do!


* Tread Mill Schematic.pdf (151.87 KB - downloaded 8 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33371
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I don't know if it matters, but I have powered the Arduino off two of the wires for the pot,
That makes life a whole lot easier and means you don't have to run a separate ground.
However I would disconnect the power to the tread mill before connecting your USN port to your computer for uploading code.
Logged

Pages: [1]   Go Up
Jump to: