Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] analogRead doesn't work properly
15-03-2014, 12:31 AM, (This post was last modified: 18-03-2014, 10:37 PM by matiaslang.)
#1
[SOLVED] analogRead doesn't work properly
Hi, I have two potentiometers connected to the analog pins of my pinguino 4550 with bootloader 2.12. I'm following this scheme:
When i run the program and play with one potentiometer the two values (x,y) are modified when only one value should. Also when I put a potentiometer to max it gives me the value 960 when it shoud be greater than 32000 (the previous value).
Is the problem with software or should I buy new potentiometers of other value (not 50kohm)?

EDIT: PIN2 and PIN3 from the potenciometer are reversed in the schematic but OK in the circuit. Here is the right draw:
[Image: attachment.php?aid=493]
Reply
15-03-2014, 07:35 AM, (This post was last modified: 15-03-2014, 07:36 AM by moreno.)
#2
RE: analogRead doesn't work properly
Hi

this scheme is crazy., is only good for make short circuit.

Where are the label PIN13 and PIN 15 connect to GND, remove old GND wiring and put these signals to PIN13 and PIN15.


Bye Bye, Moreno
Reply
15-03-2014, 10:44 AM, (This post was last modified: 15-03-2014, 03:06 PM by pinguPlus.)
#3
RE: analogRead doesn't work properly
(15-03-2014, 12:31 AM)matiaslang Wrote: Is the problem with software or should I buy new potentiometers of other value (not 50kohm)?

No, it's a hardware problem because you are measuring at the wrong point.
The potentiometer act as an voltage divider and you have to connect the middle tap, which gives you the ajustable resistance.

moreno Wrote:this scheme is crazy., is only good for make short circuit.

And as moreno said, if you turn the potentiometer to max you are creating a short circuit. What you are measuring in this situation is the inner resistance of your current source Wink

I've corrected your schematic. See below:
   

Oliver
Reply
15-03-2014, 11:54 AM, (This post was last modified: 15-03-2014, 11:54 AM by pingotg.)
#4
RE: analogRead doesn't work properly
It's the weirdest way to connect those pots I can recall seeing. Why???

As posted, put GND where PIN13 & 15 are and then connect each pot centre to the PINx.

Report the bad drawing to the site you got it from!

John
Reply
15-03-2014, 02:10 PM,
#5
RE: analogRead doesn't work properly
John,

(15-03-2014, 11:54 AM)pingotg Wrote: Report the bad drawing to the site you got it from!

I think he has drawn the schematic by himself with fritzing.

Oliver
Reply
15-03-2014, 02:32 PM, (This post was last modified: 15-03-2014, 03:06 PM by pingotg.)
#6
RE: analogRead doesn't work properly
Oh Sad

Advice: to design anything if you're not used to doing designs, look at a few examples of what others have done. Olimex site is good because they publish their designs. For a pot, find boards with a pot on them.

John
Reply
15-03-2014, 04:26 PM,
#7
RE: analogRead doesn't work properly
(15-03-2014, 10:44 AM)pinguPlus Wrote:
(15-03-2014, 12:31 AM)matiaslang Wrote: Is the problem with software or should I buy new potentiometers of other value (not 50kohm)?

No, it's a hardware problem because you are measuring at the wrong point.
The potentiometer act as an voltage divider and you have to connect the middle tap, which gives you the ajustable resistance.

moreno Wrote:this scheme is crazy., is only good for make short circuit.

And as moreno said, if you turn the potentiometer to max you are creating a short circuit. What you are measuring in this situation is the inner resistance of your current source Wink

I've corrected your schematic. See below:


Oliver

Sorry about the ignorance, I have made this circuit from the beginning. I thought PIN2 of the pontentiometer was the center pin but it seems to be PIN3. The problem is with this last circuit
Reply
15-03-2014, 05:04 PM,
#8
RE: analogRead doesn't work properly
(15-03-2014, 04:26 PM)matiaslang Wrote: I thought PIN2 of the pontentiometer was the center pin but it seems to be PIN3. The problem is with this last circuit

In the most cases the outer pins are the connectors to the resistive element inside the pot, the pin in the middle is the connector to the slider.
You could test this with a multimeter. Just connect it to the outer pins and turn the slider. The multimeter should show you the nominal value of the pot, in this case 50 kOhm, and nothing else.
Then connect your measuring instrument to an outer pin and to the middle pin. If you now turn the shaft the value on the display of the multimeter should change.

As John said, look for examples at the web, search for "arduino potentiometer" and you get a lot of pictures and schematics for beginners. Like this:

[Image: arduino-potentiometer.jpg]

Greetings
Oliver
Reply
18-03-2014, 10:37 PM, (This post was last modified: 19-04-2014, 06:45 PM by matiaslang.)
#9
RE: analogRead doesn't work properly
Solved, it worked when i changed the potenciometers the problem was in me x86_64 Arch Linux Netbook. Running in a 32-bit gives the correct values
Reply
19-03-2014, 02:25 AM,
#10
RE: [SOLVED] analogRead doesn't work properly
Excellent!

John
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)