Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Resistance measurement and stacking breakout literature?

The ADC Pi is an Analogue to Digital converter for the Raspberry Pi

19/05/2016

Posted by:
monitoringuser

monitoringuser Avatar

Hi everyone. My compliments on having the first ADC I've been able to find for the Pi 2 and 3 series. It seems a much more flexible platform for open source A-D than other products.I'm looking at the ADC Pi plus to measure about 30 resistances at a time from between about .2 ohm to 100Kohm. I'm having trouble pulling the trigger here, I just want to be sure this ADC can do the job. the largest sampling bit rate seems fine up to about 800k ohm so I should be ok there as far as I can determine. I know these are stackable but how does the breakout work for that? the first 8 addresses go to say(hypothetically) GPIO 1-8 then the second stack gets 9-16 etc... or do I misunderstand how these come in to the pi? (given that I/O doesn't return anything but on or off) Is there an application example of at least 2 stacked ADCs I could look at?Secondly, measuring resistance means I must be suppling the voltage from somewhere. from what I read its as simple as distributing the 3.3v from the pi GPIO pins across the various ADC addresses or am I missing something there as well? I know what the resistances ought to be so I'll simply be comparing the resultant current against a lookup table. Anything I'm missing here hardware wise or (potentially) do I need my breakout boards to be able to terminate 30+ connections?

19/05/2016

Posted by:
andrew

andrew Avatar

Hi

Based on the problem you have described an ADC Differential Pi may be a better option for measuring resistance. The ADC Differential Pi is basically the same circuit as the ADC Pi Plus but with the voltage dividers removed so it has a voltage range of -2.048V to +2.048V instead of the 0-5V on the ADC Pi Plus. For measuring resistance this would give you a better resolution at lower voltages and also has a higher input impedance which will improve accuracy.

The ADC Differential Pi and ADC Pi Plus use the I2C bus to communicate with the Raspberry Pi. The I2C bus uses two wires for communicating and each ADC chip needs to be set with its own I2C address. If you look on the ADC Differential Pi page about halfway down on the left column it explains how to set the I2C addresses using the jumpers provided on the board. Each ADC chip can be set to one of eight I2C addresses between 0x68 and 0x6F. There are two ADC chips on each board so you can stack up to 4 ADC Differential Pi boards on a single Raspberry Pi giving you a maximum of 32 inputs. As all of the boards communicate over the same two pins that leave the rest of the GPIO pins available for other uses.

To communicate with the ADC Differential Pi we have software libraries available in Python and C. In python to set up communication with an ADC Differential Pi, you create an instance of the board and set the two I2C addresses that have been preset using the jumpers using the line plus the bit rate you want to board to sample with.

adc = ADCDifferentialPi(bus, 0x68, 0x69, 18)

If you want to communicate with more than one board you just need to create separate instances of the adc object for each board.

adc1 = ADCDifferentialPi(bus, 0x68, 0x69, 18)
adc2 = ADCDifferentialPi(bus, 0x6A, 0x6B, 18)
adc3 = ADCDifferentialPi(bus, 0x6C, 0x6D, 18)
adc4 = ADCDifferentialPi(bus, 0x6E, 0x6F, 18)

The read voltage demo in the python library folder shows how to set up the ADC Differential Pi and read a voltage.

To measure resistance you will need to convert that resistance into a voltage for the ADC input. The easiest way to do that will be to use a constant current source to supply a fixed current to the resistor and then measure the voltage across the resistor. You can use ohms law to calculate the resistance based on the current source and the voltage. As you have a wide range of resistances from 0.2R to 100K that complicates the circuit a bit. To get an accurate reading across the full resistance range you will need several different current source values and possibly use OpAmps to change the voltage gain before feeding it into the ADC inputs. There is quite a bit of information on google if you search for "measuring resistance using adc" so it may be worth looking around and seeing if someone else has already built a circuit you can copy.

20/05/2016

Posted by:
monitoringuser

monitoringuser Avatar

Yep, that clears up quite a bit. Thanks a bunch. If it works well I'll try to get a project up for anyone else interested.

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout