Welcome to Cockpitbuilders.com. Please login or sign up.

May 04, 2024, 05:43:36 AM

Login with username, password and session length

PROUDLY ENDORSING


Fly Elise-ng
559 Guests, 1 User
Members
Stats
  • Total Posts: 59,641
  • Total Topics: 7,853
  • Online today: 583
  • Online ever: 831
  • (May 03, 2024, 12:39:25 PM)
Users Online
Users: 1
Guests: 559
Total: 560

COUNTDOWN TO WF2022


WORLDFLIGHT TEAM USA

Will Depart in...

Recent

Welcome

AnalogRead bourns 3590S-6-103L 10K

Started by kurt-olsson, July 11, 2016, 07:20:14 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kurt-olsson

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?

727737Nut

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.
737 Junkie

kurt-olsson

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?

Wendy

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.



KyleH

Yes, you need to connect all 3 wires, +5V, gnd, and then the wiper to the analog input.
Kyle

Chief Pilot
Worldflight Team USA
http://www.worldflightusa.com

kurt-olsson

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.


727737Nut

#6
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

Rob
737 Junkie

kurt-olsson

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

kurt-olsson

Added the 5+ volt did the trick, now when there is stable current flowing the potensiometer is really stable!

Thanks again for the help!

727737Nut

Did you add 5V to the Teensy VIN input? or the pots?
737 Junkie

kurt-olsson

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. :)

727737Nut

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
737 Junkie

kurt-olsson

#12
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.

Like the Website ?
Support Cockpitbuilders.com and Click Below to Donate