Potentiometers not giving full range: 4 - 1008 only

Thundercat

Well-known member
Hi, I know this has been asked and answered elsewhere here, and I've read those posts, but I'm getting something rather peculiar.

I've got a PCB I made using faders (10k sliding potentiometers). I get the full range of values when I drag the faders. The values are 0 thru 127. I'm using a code snippet like this:

Code:
Data[y] = analog[y].getValue()>>3;

However, in the next iteration of the PCB, wherein I only changed a couple things on the PCB, I now only get 0 thru 126.

I checked the voltage values on the newer PCB via the serial console by using the same code above without >>3:

Code:
Data[y] = analog[y].getValue();

The values range from 4 to 1008. Not the expected 0 - 1023.

I did not change the connections to the faders at all, and I've ohm'ed it out and the lines for power and ground are 0.2R (this is what I get when I connect my Fluke leads together as well, so this is effectively 0R).

So the connections are good.

I also checked the voltage to the faders on the newer PCB, and I'm getting 3.294V positive - totally fine.

Are there any hints or ideas of a general nature that might account for this discrepancy? I should mention, I'm using an external voltage regulator on the PCB board that provides a steady 3.3V. Only because I've got a lot of LED buttons that are using a lot of current, and the engineering company who makes the buttons recommended an external regulator from the Teensy.

Anyway, this is really chapping my noodle, because again, minimal changes between two iterations of the boards (as in, I moved a connector a few mm, and a couple other small changes).

Oh, also I'm using a different voltage regulator on the two boards, only because the same part was not available at the PCB company, but specs are very similar.

Last point- I know I can use the map() function to fix this, but that's not the point. I'd like to figure out what's actually wrong or why there is a lower range between the two PCBs. I feel like I must be missing something or doing something wrong.

Also, the faders are the same faders on each (unplugged them from one to the other), and the Teensy 4.1 is the same (have it mounted on sockets). All other hardware is exact same (not copies - the same hardware!).

Thanks for any hints. I can post the schematics, if that would be helpful. But at the same time might be overwhelming because involved. But I can.
 
Two possibilities: mechanical construction - some dead track at each end before the metal contacts?
Or there are IR drops on the power and ground wires so that the faders don't see the full supply range. Star grounding is the usual cure for this.
 
They are the same faders in each instance - so no chance they are having different resistances between the two PCBs.

The second, is a puzzler, because as I said, they ohm out perfectly. And the voltages are spot on. And the layout of the PCBs is identical. And they are supplied voltage in parallel, and there's excellent ground on the PCB. It was laid out by an engineering company.

Hence this post.

Thx
 
As a first troubleshooting step, I would start with a voltmeter. Important to connect the negative lead directly to Teensy, ideally to a GND pin not used (perhaps the one next to the pushbutton) and the positive lead directly to the Teensy pin receiving the analog signal. Don't measure at the pot or elsewhere on the PCB, because you want your voltmeter to see what's actually arriving at Teensy's pins.

Also measure the 3.3V pin on Teensy, because that is what Teensy considers to be the voltage for 1023.
 
Will Do.

Thanks again Paul, and I'll follow up with your suggestion.

Thanks for all your massive ongoing support. I love your products and I'm grateful to you.

Mike
 
Last edited:
As a first troubleshooting step, I would start with a voltmeter. Important to connect the negative lead directly to Teensy, ideally to a GND pin not used (perhaps the one next to the pushbutton) and the positive lead directly to the Teensy pin receiving the analog signal. Don't measure at the pot or elsewhere on the PCB, because you want your voltmeter to see what's actually arriving at Teensy's pins.

Also measure the 3.3V pin on Teensy, because that is what Teensy considers to be the voltage for 1023.
Hi Paul,

I did the measurements at the pins of the voltage, but all the PCB grounds were already being used.

However from every ground point to the pins, with the faders at full, they read 3.288V at max, and .0001V at min.

Reading just the Teensy 3.3V pin, I get 3.313V

So a discrepancy.

Going by the schematic above, would you suggest to use the Teensy 3.3V pin for the voltage to the faders, instead of the voltage from the regulator?

The engineering company was adamant that all the power to the unit should derive from the regulator, "for safety" they said, but I was skeptical.

Also, the previous iteration of this PCB did not suffer all of these anomalies, and the only real change was moving a pin a few mm, and also tying the regulator Enable pin to pin 21 of the Teensy so I could turn the regulator on/off to achieve a true "off" of the Teensy using the On/Off pin (which works great). The previous version had the Enable pin tied to the VIN of the regulator so it turned on instantly.

I did change some fixed resistors for the LEDs with trim pots, and I was wrong before - the regulator IC chip is the same on both boards too.

In all other respects the two boards are identical.

Thanks for any additional insights.

Mike
 
Last edited:
I'm about ready to redo the PCB, this time using the Teensy 4.1 as the source for the fader voltages, instead of relying on the external voltage regulator.

But I don't know if this is a good idea, or if this will fix what's going on. Or if it will cause other problems.

Any thoughts on this?

Thanks,

Mike
 
I'm about ready to redo the PCB, this time using the Teensy 4.1 as the source for the fader voltages, instead of relying on the external voltage regulator.

But I don't know if this is a good idea, or if this will fix what's going on. Or if it will cause other problems.

Any thoughts on this?

Yes, that is the most common way. You also should connect the negative side of the pots directly to the AGND pin on Teensy. Do not connect those pots to GND on the rest of the PCB. Connect them only to 3.3V on Teensy, AGND on Teensy, and each pot to the Teensy analog input pin.
 
Yes, that is the most common way. You also should connect the negative side of the pots directly to the AGND pin on Teensy. Do not connect those pots to GND on the rest of the PCB. Connect them only to 3.3V on Teensy, AGND on Teensy, and each pot to the Teensy analog input pin.
That is extremely helpful Paul. I will follow up with this, and I'll also report back here when the new PCBs are made and tested.

Many thanks for the, as usual, stellar support!!!
 
Yes, that is the most common way. You also should connect the negative side of the pots directly to the AGND pin on Teensy. Do not connect those pots to GND on the rest of the PCB. Connect them only to 3.3V on Teensy, AGND on Teensy, and each pot to the Teensy analog input pin.
Hi Paul, couple more small q's - I'm using 100nF caps on the Teensy analog input pins (which has done wonders for reducing jitter), and I'm wondering, do I connect the ground side of those caps also to AGND as well, or to any other ground pin on the Teensy 4.1?

And is it necessary to include a resistor to make a LPF on the analog inputs? I'm concerned this will lower the pot range with reduced voltages at the analog input pin.

Thank you again. Your reply/support could not have been more precise or helpful!
 
do I connect the ground side of those caps also to AGND as well

Yes, capacitors between the analog pin and AGND. Think of the pots as their own isolated little system which connects only to Teensy analog input pins, 3.3V and AGND. You should have absolutely no connection from those pots to anything else on the PCB, especially not the GND used for high power stuff.

Best to locate capacitors physically close to Teensy. But don't stress and overthink the distance, 1mm vs 10mm away from Teensy makes no real difference.


Yes, they are connected together on Teensy 4.1. But using AGND only for the analog parts and the other GND pins for other stuff still has the benefit of eliminating any non-analog current flow through the ground and power wires connecting to the pots. Even on the older Teensy models where the grounds were separated by a ferrite bead, in most practical applications a lot of the real benefit comes from eliminating unwanted ground currents through the analog ground paths.
 
Yes, capacitors between the analog pin and AGND. Think of the pots as their own isolated little system which connects only to Teensy analog input pins, 3.3V and AGND. You should have absolutely no connection from those pots to anything else on the PCB, especially not the GND used for high power stuff.

Best to locate capacitors physically close to Teensy. But don't stress and overthink the distance, 1mm vs 10mm away from Teensy makes no real difference.



Yes, they are connected together on Teensy 4.1. But using AGND only for the analog parts and the other GND pins for other stuff still has the benefit of eliminating any non-analog current flow through the ground and power wires connecting to the pots. Even on the older Teensy models where the grounds were separated by a ferrite bead, in most practical applications a lot of the real benefit comes from eliminating unwanted ground currents through the analog ground paths.
Gold.

Thank you ever so much.

Mike
 
I have an additional issue on the same board, and was wondering anyone's thoughts.

I've got a phototransistor I'm using to control the backlight of the LCD, which honestly works great. I'm using software averaging, and no issues with performance.

I'm using a 300K resistor to ground - rather high - but with this value I get a good balance of light sensor range as well as sensitivity. The C15 cap is 100nf just to smooth out values:

Current Setup.jpg

However, it seems the presence of this phototransistor is adding noise to the rest of the circuit. Even on the faders I'm using, which were on the same ground/power supply.

I am taking Paul's previous advice here on this thread and have put the faders on their own dedicated net, using the former AGND and a dedicated 3.3V output just for the faders, but I don't know if this will isolate the issue well enough (well, I will know, once I get new PCBs made, but I'd like to figure things out prior to making the new PCB).

So I'm wondering if I should also add a resistor to the light sensor input, to create a LPF?

I don't know if that would help, but if so, I don't want a high value resistor as there's only 3.3V going into the phototransistor as it is, and I don't want to reduce the voltage too much.

That would look like this I think:

With LPF.jpg

So there are a few questions.

1) Is the current 300K resistor going to cause any problems with the Teensy 4.1 ADC? As in, is it too high? I've read this kind of cap should be around 10K, so this has me wondering.
2) Would adding an additional resistor (marked with the ?) to create a LPF provide any value in slowing the input so that potential noise is reduced?
3) If adding the additional resistor is a good idea, then what kind of value would work, and should C15 be changed as well?

I know about RC calculators, but when I do the math it looks like small value resistors lower than 100R doesn't do much, unless a very large capacitor at C15 is used. I'm averse to using a 100uF cap here!! And a smaller value like 4.7uF doesn't seem to do much.

Anyway, thanks for any insights anyone may have.

Again, for clarity, the first schematic snippet above is already fully functional and working fine, but there seems to be additional noise from the phototransistor that is somehow getting into the circuit that is affecting the faders and I'm trying to filter it out. And all of this may already be solved just using Paul's advice to put the faders on their own ground/power pins, but since I will be making new PCBs anyway, I thought I'd ask the experts.

Thanks you for any thoughts.

Mike
 
Last edited:
Perhaps sensor changing Backlight current/PWM alters the noise profile on V+. Some series L between V+ and Pots+ may help. Are we using Star grounds?
 
Another thought:-
Depending on the ambient light source, actual light levels are gonna be modulated by the means of production.

Jurassic incandescent will carry some mains frequency component. CFLs often run at some higher frequency. LED lighting, usually pulsed at who knows what frequency.

Perhaps some seemingly silly amount of oversampling of the light sensor levels then think of how often Backlight level is updated?
 
Thank you MatrixRat.

The issue isn't so much that the light sensor is having a problem - it's fine. It's the noise from the actual hardware. I can smooth the results in software, but the jitter/noise introduced on the PCB from the Light Sensor is the issue, if that makes sense.

Thanks for your help.

Mike
 
Hi, question - from other posts it seems AGND is identical on the Teensy 4.1 now.

It would be easier for me to route the analog grounds to a different ground pin.

Just to confirm, the AGND is the same as any of the other GND pins now on Teenys 4.1?

I will still use the isolation technique @Paul suggested.

Thanks,

Mike
 
Just an update, I've redesigned the PCB to conform to Paul's suggestions, with a slight twist. I've put the pots on their own dedicated GND pin on the Teensy, as well as their own dedicated 3.3V pin. But instead of using traces, I've put a small ground plane, and power plane, under these sections of the board, to facilitate low impedance transfer and hopefully mitigate the noise issue. They are physically distant from the regulator, which is on its own dedicated ground pin on the Teensy. Also, I'm using a power and ground plane for the rest of the board.

I will order the boards this week, and when I get them back and test, I will update again.

Thank you again for all the incredible support here. What a great community.
 
Back
Top