ADC1 has a floating value when no pot connected to it

I am using a poteniometer and the output is connected to the ADC pin. I have a switch connected in between the output of the poteniometer and the ADC pin on the vesc. I am using the switch in such a way that when someone stands on the ADC value is fed into the vesc and the motor can run at the desired value and when the user gets off the device turns on. But I am seeing an issue where the ADC value is floating(approx 1.30-1.4 when the switch is off). Is there a way the ADC can get 0V when nothing is connected to it?

Make sure you’re using 3.3V and not 5V. Use a 100kΩ pulldown resistor to settle the value with no pot connected.

You could also use two 47kΩ resistors between 3.3V and ground, and connect the ADC to the middle of them if you wanted a default middle value instead.

@b264: Can i make that changes in the code? if yes, can you point me where in the code is it possible?

It doesn’t look like a software change, but more a hardware issue if I understand correctly.

1 Like