Go Down

### Topic: ... (Read 1 time)previous topic - next topic

...

#### jrdoner

#1
##### Sep 22, 2016, 02:47 am
If 2/3 of linear slider gives you 5 volts, then the whole range should give you 7.5 volts.  Put the output of the potentiometer into the top of a voltage divider (two resistors in series), using 5K and 10K resistors.  Attach the bottom of the resistor pair to ground, and tap the point between the resistors as analog input.

#### Wawa

#2
##### Sep 22, 2016, 03:09 am
However, when testing the analog output voltage of the potentiometers, the range from 0 volts to 5 volts equals 0 to 2 thirds of the fader length. Fader is 100mm. 5 volts being two thirds of the way up the linear potentiometer.
How did you test this. With a DMM?
I don't see A/D values test prints in your code.
See if you also have that problem with this sketch.
Leo..
Code: [Select]
`void setup() {  Serial.begin(9600);}void loop() {  float voltage = analogRead(A0) * 5.0 / 1024;  Serial.println(voltage);  delay(100);}`

#3
...

#### cackland

#4
##### Sep 22, 2016, 03:17 am
If 2/3 of linear slider gives you 5 volts, then the whole range should give you 7.5 volts.  Put the output of the potentiometer into the top of a voltage divider (two resistors in series), using 5K and 10K resistors.  Attach the bottom of the resistor pair to ground, and tap the point between the resistors as analog input.
You'll have to excuse my ignorance. I'm completely new to this kind of custom electronics.

These are my faders - http://www.alps.com/prod/info/E/HTML/Potentiometer/SlidePotentiometers/RSNS/RSA0N11S9A0K.html

#### johnwasser

#5
##### Sep 22, 2016, 03:23 am
Get a multimeter.  Measure the voltage across the pot to be sure it's 5.0V.  Measure the voltage between Ground and the slider to see if it actually hits 5.0V at the 2/3rds mark.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

#### Wawa

#6
##### Sep 22, 2016, 03:25 am
Both sketches do the same.

If you're not getting a lineair result, then the problem is wiring or pots.
Are you sure you have the wiper (pin2) connected to A0.
And +5volt and ground to pin 1 and 3.

Post a picture of the pot/wiring.
Leo..

#7
...

#### Wawa

#8
##### Sep 22, 2016, 03:48 am
Pot wiring seems to be correct (asuming the datasheet is correct).

Might as well upload a picture of the Arduino side of the wiring.
Leo..

#9
...

#### Wawa

#10
##### Sep 22, 2016, 04:06 amLast Edit: Sep 22, 2016, 04:11 am by Wawa
I have the power daisy chained from each potentiometer going into the Vin on the teensy 3.2 (top left - red wire)
Same with the ground, daisy chained from each potentiometer going into the GND (bottom left - black wire)

Wrong, and potentially dangerous for the analogue pins.
The Teensy 3.2 MCU runs AFAIK on 3.3volt.
Connect all "hot" potentiometer wires to the 3.3volt pin, not the V-in pin.

That board also seems to have 16-bit A/D converters.
Both above sketches assume 10-bit A/D converters (1024).
Leo..

#11
...

#### Wawa

#12
##### Sep 22, 2016, 04:22 amLast Edit: Sep 22, 2016, 04:22 am by Wawa
If the MCU runs on 3.3volt, and Aref (the ruler that measures it) is 3.3volt,
then 3.3volt on the analogue pin will give the maximum A/D value possible.

Don't know what this board defaults to. 10-bit or 16-bit.
If it defaults to 10-bit, then max A/D value is 1023 (0-1023 is 1024 values).
If it defaults to 16-bit, then max A/D value is 65535.
This sketch might show that.
Leo..
Code: [Select]
`void setup() {  Serial.begin(9600);}void loop() {  Serial.println(analogRead(A0));  delay(100);}`

#13
...

#### mrburnette

#14
##### Sep 22, 2016, 03:51 pmLast Edit: Sep 22, 2016, 03:51 pm by mrburnette
Don't i require 5 volts for maximise the full range of 1023?

If i re-solder the power to the 3.3V and not the Vln (3.6 - 6.0 volts) surely that would hinder its range?

Does having 16bit converters cause a problem?

Can i still use my 100mm fader with the 16bit converters or do i need a smaller fader and 10 bit?
You should never apply more than Vcc to the Analog Input ... so, if the uC is running at 3.3V then max ever on the Ax line is 3.3V and that would represent 100% of the range if the analog reference is also 3.3V
What this means is that if you have internal reference voltages available, you can lower the internal analog reference voltage and get 100% full range when Ax is at the same potential as the internal reference.

What I always suggest is that you acquaint yourself with one of the many free circuit simulators available.  I like:
which will not only run on a desktop PC but also most Android tablets, it runs on my many years old Nexus 10.

For example, the nodelist below will create the circuit shown in the attachment:
Code: [Select]
`\$ 1 0.000005 10.200277308269968 50 5 50r 352 96 352 160 0 10000g 352 224 352 272 0R 352 96 352 64 0 0 40 3.3 0 0 0.5w 352 160 432 160 0x 454 165 579 168 0 24 to Ax on uC174 352 160 352 224 0 10000 0.5 Resistancew 368 192 432 192 0w 432 192 432 160 0w 432 160 448 160 0x 193 201 329 204 0 24 10K rheostato 3 64 0 551 2.5 0.000390625 0 -1`

Yes, you could do this with your 4-function or fancy HP calculator, but we live in a time when the free tools to visually analyze such concepts help one to understand a deeper relationship... use 'em.

Ray

Go Up