Interfacing Rotary or Linear Potentiometers into Propeller 1 using i2c Advice
DavidM
Posts: 630
in Propeller 1
Hi,
I need to read at least or more rotary potentiometers (or linear sliders) to get values of 0 to 255, for input into the Propeller 1, for use with my DMX Project.
So, is a dedicated ADC ic, the simplest way to go?
Such as the MCP3021 ( which is single channel ).
or should i use a multichannel in case i have many potentiometers/sliders
I would like to use i2c protocol , as I am familiar with that.
Thanks
Comments
I would go with the MCP3208, Spi
Or the MCP3428 if you like i2c
If you have many channels, you may want to avoid single-channel i2c as the address options on those can limit total channels.
Better to choose a 8 or more channel ADC and there, selection might be made as much on package as anything else.
Or you could look at using a jellybean Analog MUX 4051 series, and try the P1 ADC setups, as you do need high scan rates, for sliders.
One irony is that these days you can buy a small MCU with 12b ADC's for less than a dedicated ADC chip costs, but you need to write code for those small MCUs.
OK, Thanks for the reply, lets just start with a single channel, but that series has other models with more channels, with the same specs, so no need to change any circuit or code
If you decide to try the MCP3208, it is easy to use (my friend John and JonyJib.com uses them frequently). It's SPI, so you can share pins. The attached code is setup for traditional SPI, but you can set the MOSI and MISO to the same pin. If you do that, though, you need to put a 4.7K resistor between DOUT and DIN, and then connect your combined MOSI/MISO IO pin to DIN of of the MCP3208 (this puts the resistor between DOUT and the Propeller.
Hi Jonny,
Thanks for this,
I need to order some of these IC's, its available in DIP so i can breadboard it.
Then I test your code soon.
Thanks very much!
I have a string of RP2040s (like RPi Pico?), hanging off my P2 for this sort of thing. I have them loaded-up with the MMBasic interpreter. Four 12b ADC's @125KHz.
MMBasic also supports I2C slave mode.
@DavidM
FYI: As per @JonnyMac sig: "It's Jon or JonnyMac."
Craig
Oh, I didn't know, i've been calling him Jonny!
If 8 bit resolution, 100 samples/second and +/-2% accuracy is enough for you you can also check out this circuit. It requires two pins per potentiometer and an additional capacitor but no ADCs at all. R4 and the 3rd pin is only required for 10 bit resolution and ~1% accuracy.
Thanks, I shall take a look