Cockpitbuilders.com

Main => General Discussion Board. => Topic started by: kurt-olsson on July 11, 2016, 07:20:14 AM

Title: AnalogRead bourns 3590S-6-103L 10K
Post by: kurt-olsson on July 11, 2016, 07:20:14 AM
Hi

Just a small question. I bought a bourns 3590S-6-103L 10K pot. These are high precision. I use a teensy 3.1 and when i do analog read i get some spike values.

9/10 reads are the same and the tenth are like double valued. I can smoothen this out with code but i would like to know how you solve this or if you have the same problem. Little anoing because i will be using alot of these for yokes and throttles etc.

Basically, how do you deal with pot analog reads?
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: 727737Nut on July 11, 2016, 07:31:40 AM
How do you have it wired?  What is your code?  The Teensy is very very fast, you can slow down the sample rates and that will help.
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: kurt-olsson on July 11, 2016, 07:58:40 AM
I have the ground wired to the "bottom" pin and the input pin in the middle.

Should i connect 5v to the top pin?

Some people use capacitors and also resistor as a filter. But i would like to know if anyone else has this problem on the teensy.

Do you use any of these pots Rob?
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: Wendy on July 11, 2016, 08:30:32 AM
I think you only used 2 pins of the potentiometer.

You should connect one of the outer pins to GND and the other to 3.3 or 5 volt. Connect the slider (middle pin) to the port on the MicroProcessor.
This should give better results.


Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: KyleH on July 11, 2016, 10:56:08 AM
Yes, you need to connect all 3 wires, +5V, gnd, and then the wiper to the analog input.
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: kurt-olsson on July 11, 2016, 12:47:45 PM
Great job of reading the schematics Peter...

I thought you only could solder the two top pins together according the diagram, but the i got a climbing descending value range.

Thanks for your help, i will try this and come back with the result.

Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: 727737Nut on July 11, 2016, 06:32:12 PM
Use these pins for your pots,
AREF, AGND, then middle wiper pot goes to any pin from 14 to 23. 

If the travel is wrong direction, swap the AGND and AREF connection on the pot. I run one wire from AREF and one from AGND on the Teensy to a couple of terminal strips then wire all my pots to the terminal strips.  The wiper (middle pin) from each pot then goes to the analog input pins on the Teensy which is 14-23


You can use analogReadResolution(12);
For higher resolution if needed.  By using the AREF and AGND, it gives the wiper output a much more stable reading.

See here,
http://www.pjrc.com/teensy/teensy31.html (http://www.pjrc.com/teensy/teensy31.html)

Rob
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: kurt-olsson on July 12, 2016, 04:06:47 AM
Many many many thanks Rob!
Really appreceate your time to answer my question.

On vacation now, will hook it up as your example when i come back.

Br Peter
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: kurt-olsson on July 16, 2016, 06:48:30 AM
Added the 5+ volt did the trick, now when there is stable current flowing the potensiometer is really stable!

Thanks again for the help!
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: 727737Nut on July 17, 2016, 03:59:37 PM
Did you add 5V to the Teensy VIN input? or the pots?
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: kurt-olsson on July 17, 2016, 09:49:46 PM
I added 5v to the pots. Then i got only +- 1 in fluxuation. I dont think its possible to get 100% stable values.

I tried the aref and agnd but no diffrence.

But i want to try to use my pc supply 5v instead of usb power, some say that it is the usb that causes some jitter.

But the analogresolution 12 bits really helped. I then use average values of 8 reads and add small delay so i am there by 98% stable.

Have you added 5v to your vins?

By the way, saw your new youtube video. Looks fantastic! Nothing beats the real stuff. Maybe i will get the real parts for the 737-200 but i think you need to have a very high understanding of electronics and analog gauges are complex. :)
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: 727737Nut on July 18, 2016, 06:54:48 AM
What I find interesting is the fact that according to the teensy documentation, the analog inputs are not 5V tolerant.  Says it will blow them up! But yours is still working.  Maybe because you are using 10k and its keeping the overall current low?  Not sure.  Glad it is working well. 

Rob
Title: Re: AnalogRead bourns 3590S-6-103L 10K
Post by: kurt-olsson on July 18, 2016, 07:10:35 AM
I have tried both the 5V and the 3.3V. (3.3V connected to now) and it works the same on both. I also thought it should blow up after reading the documentation. Must be resistance in the pot preventing it.