Tips on using A/D inputs

I have an existing project in which I would like to add some A/D capability, and am just looking for some pointers and “gotchas”. basically all I want to do is sense an input from a LINEAR taper potentiometer, with the Wixel 3.3V supply and 0 volts on the outer legs, and the wiper fed to an A/D input. I actually only need a 0-64 count for what I’m doing, so the Wixel A/D resolution is more than sufficient. Some questions come to mind which are not so clear from the example.

  1. I only want to to read A/D inputs on P0-2 and P0-3. The other P0 inputs are already being used by the existing app as digital inputs, and those require the pull up resistors configured. So I think I have some conflicts already. Is it possible to just configure 1 or 2 of the available P0 inputs for A/D use, or must I configure all of the P0 bits this way? Perhaps its not a big deal to continually switch configurations under program control? I’ve done this to multiplex between driving LEDs and sensing buttons, but haven’t tried this with an A/D situation. Surely there would be some settling time issues?

  2. Assuming the pins configured to be floating (pull ups and pull downs disabled), how high is the impedance of the pins configured to be A/D inputs? I’d like to isolate the Wixel input from the pot I’m measuring with a resistor to add a little safety, and maybe even add a capacitive low pass filter, so i need to understand what kind of “load” I’m driving.

  3. Lets say in the above case that the Pot is external, and may be unconnected sometimes. Would it be advisable in that case to use something like a closed circuit TRS jack, in which the input is grounded to 0V when the pot is disconnected?

Hello.

You can disable the pull-up resistors on individual pins using the setDigitalInput function from the Wixel SDK. I would recommend disabling the pull-up resistor on each pin that reads a potentiometer, but if you leave it enabled then the only problem would be that the pull-up resistor would somewhat distort the reading from the potentiometer.

The electrical characteristics of the CC2511F32 ADC can be found in section 6.10 of the datasheet. It says the input resistance is typically 197 kilohms. A 1k or 10k resistor protecting the analog input should probably be OK, with higher the resistances having a larger effect on ADC readings, but I have not tried it.

I am not familiar with closed circuit TRS jacks, but if that kind of jack connects the signal to 0V when the cable is removed then that sounds good. If you do not have a pull-up or pull-down resistor and you do not use a jack like that, then the input would be floating when the potentiometer is disconnected and give unpredictable readings. This might be bad or confusing depending on what you are doing with the readings.

–David

Thanks David… Looking at my own code, I see where I was already setting all the inputs with setDigitalInput( pin, PULLED). I don’t know why I somehow though it was global to all pins on a port. I guess i was thinking of the direction (pulled up or down) that had to be common. So this worked out well!

By the way, sorry for the Acronym. TRS just means a “TIP-RING-SLEEVE” jack or plug, 1/4", 1/8", or a “sub-mini” (abouth 1/16" diam.), and its usually referring to round “phone” style connectors. “Phone jack” dates back to the days when telephone operators made manual connections, though these days its mostly used for musical instruments or headphones. Its just a simple way of telling how many condutors are available. In fact, now there are “TRRS” jacks and plugs, squeezing 4 connectors total onto the jack/plug.