I am working on a project using an Arduino MEGA 2560 and temperature sensors and pressure transducers (also possibly a load cell or two). The concern in our group was the bit size of the analog pins from the board, being 10-bit, if that was satisfactory. (I know the due has higher bit analog inputs, however the MEGA was the board we selected.)
Doing my own research through the interwebs and these forums, I know it is possible to use an external ADC (analog to digital converter), such as the ADS1115, however I have found nothing about using multiple external ADCs. (I have only found a post about using one ADC with the SDA [pin 20] and SCL [pin 21])
I am curious if it is possible to use multiple ADCs to one pin (such as 20) and use some sort of switch or multiplexer to control which one is read in, or some other brilliant method?
10-bits counts 0-1023, which is 0.1 degree precision on a 0-100 degree C scale. You'll be lucky if the analog part of your temperature sensor is that accurate/precise.
I am curious if it is possible to use multiple ADCs to one pin (such as 20)
It generally takes more than one pin to communicate serially. But, the I2C bus can handle multiple devices.
I2C needs both lines connected - SCL is the clock from the master for all transfers, SDA is output from Arduino to send a command, and then its the output from the slave with the response.
Many parts have some address pins that you connect high or low so each identical part can have a unique address. See page 16, 17.
The device can be one of four addresses. If you need more devices, an I2C mux can be used to select 1 of 4 parts.
I am curious if it is possible to use multiple ADCs to one pin (such as 20) and use some sort of switch or multiplexer to control which one is read in, or some other brilliant method?
Yes you can use a chip called an analogue multiplexer to switch a virtually unlimited number of analogue sensors onto one pin.
Hi, depending on how quick you want to update your inputs, you can use one ADC and switch the input of the ADC between sensors. That is all that the mega does, it only has one ADC on board.
The ADS1115 is a very nice ADC/MUX that can be configured to switch between 4 single ended analog inputs (or 2 channels of differential inputs). Also the chip has a address pin that can be strapped high or low to gain a second I2C address, so two of these devices can share the two I2C pins (20,21) and handle reading up to 8 analog input signals. The Adafruit folks have a nice arduino library to make using this device pretty simple.
MCP3208 is an SPI interface 8-channel, 12-bit ADC.
You select the channel to be addressed as part of a 3-byte transfer.
1st byte out is the addresss & mode, next 2 bytes in are the data:
digitalWrite (ssPin, LOW); // I use direct port manipulation for this for speed
SPI.transfer(address);
byte1 = SPI.transfer(dummyByte);
byte2 = SPI.transfer (dummyByte);
digitalWrite (ssPin, HIGH);
// manipulate the 2 bytes into 12 bits in an int
retrolefty:
The ADS1115 is a very nice ADC/MUX that can be configured to switch between 4 single ended analog inputs (or 2 channels of differential inputs). Also the chip has a address pin that can be strapped high or low to gain a second I2C address, so two of these devices can share the two I2C pins (20,21) and handle reading up to 8 analog input signals. The Adafruit folks have a nice arduino library to make using this device pretty simple.
Thank You!
It looks like differential inputs would be better, but can you only connect two ADS to the arduino through the I2C bus, or can you connect up to 4 ADC's through one SDA bus line and call each specific address to switch between the two. (Looking at http://www.ti.com/lit/ds/symlink/ads1113.pdf page 25)
Your correct, there are four different strapping options for the single address selection pin, allowing up to four of these ADC/MUX modules to share a single I2C bus. So up to 16 single ended inputs or 8 differential inputs maximum.