SPDT Switch to Select ADC Trim Pot - Pullup Resistor Needed?

I want to use a SPDT switch to choose between an on-board trim pot or an external one for ADC.

Both the onboard trim pot and the external one (if used) are 10kohm. The PIC is 16F1825. My questions is whether it would be a good circuit design to add some kind of pull-up or pull-down resistor on the line that connects the switch to the PIC in the case where a user selects the external trim pot but one isn’t connected. I ask because on my breadboard I’m testing with a switch that has a middle detent (‘off’) and I notice that when moving through it the ADC isn’t stable (I’m using ADC to control a DC motor speed via PWM) - the motor goes up and down in speed, seemingly at random. While the SMD switch I’m using on the board doesn’t have a middle detent (i.e. no ‘off’) there could be a case where a use selects the external trim pot but there isn’t one connected, and I don’t want the motor to go nuts.

Have you tested it on the breadboard? If you do put a pull up down resistor in, it will throw off your readings. You are will need to compensate in the code.

You can always go another route. though. I don’t know your hardware layout or program, but you could do an average of the readings. This would calm the motor down while nothing is connected.

Well, it’s up to you to decide what behavior you want if the user selects the pot and it’s not there. You haven’t said that.

lyndon:
Well, it’s up to you to decide what behavior you want if the user selects the pot and it’s not there. You haven’t said that.

Good point. I’d like it to read 0v on the ADC pin if nothing is connected.

RossWaddell:

lyndon:
Well, it’s up to you to decide what behavior you want if the user selects the pot and it’s not there. You haven’t said that.

Good point. I’d like it to read 0v on the ADC pin if nothing is connected.

Then you would want a large (100*10k) resistor pulling down to ground on the ADC pin. Perhaps with a capacitor parallel to smooth out switch/connecting bounce. The large resistor value will not load down the built-in or external variable resistor (very much), but will pull the ADC pin to ground when unconnected or the switch is in transition.

Valen:

RossWaddell:

lyndon:
Well, it’s up to you to decide what behavior you want if the user selects the pot and it’s not there. You haven’t said that.

Good point. I’d like it to read 0v on the ADC pin if nothing is connected.

Then you would want a large (100*10k) resistor pulling down to ground on the ADC pin. Perhaps with a capacitor parallel to smooth out switch/connecting bounce. The large resistor value will not load down the built-in or external variable resistor (very much), but will pull the ADC pin to ground when unconnected or the switch is in transition.

Thanks very much, Valen. By "(100*10k)" do you meant 1,000 kohms?

1 Mega ohm I meant. So yeah, if that comma is a 1000-marker then it’s 1,000 kohms.

Valen:
1 Mega ohm I meant. So yeah, if that comma is a 1000-marker then it’s 1,000 kohms.

Thanks!