I’m current using two MCP3424 in a design and thought it was worth a post as its quite a neat ADC. I’m going to split the post into five sections which I think surmises the chip nicely.
Bus type
The MCP3424 using I2C as its bus protocol and has two configurable address pins. This means you can have up to eight on one I2C bus; remembering possible pin states include high, low, float / z-impedance. I really like this as it gives us up to 32 inputs we can read without having to use an external multiplexer.
I’ve taken a snippet from the datasheet to demonstrate how to set the different addresses:
Resolution
The ADC can be configured into four different resolution modes. Depending on the resolution set will determine the sampling rate of the ADC. This is effectively how many times the devices can read / sample the input.
Resolution | Sampling Rate |
12 bit | 240 SPS |
14 bit | 60 SPS |
16 bit | 15 SPS |
18 bit | 3.75 SPS |
As you can see above the ADC is deferentially not a high speed ADC so using oversampling trickery to increase accuracy is probably not the best idea. However for most situations the sampling rates are fine.
Single ended and differential
Another really nice feature is that the IC can be used in differential and single ended mode. To configure the IC into single ended mode just tie the negative input to common and take your input signal to the positive input. Be aware however that you will loss a bit of accuracy in this configuration.
Conversion Modes
Another neat mode of the ADC is that it can read your inputs in two different modes, single shot and continuous mode.
Single shot mode: Will only read the input voltage when you request it to. This means the IC will consume very little power when not in use but will create a delay when reading / converting the input voltage.
Continuous mode: This mode will setup the IC to constant read the ONE input signal and keep updating its value in the register. Hence when you want to read this input you don’t have to wait for a conversion you just read the register. The limitation of this is you can only set it up on one input at a time not all four. This mode will also make the ADC consume more power.
Built in Gain
The ADC also has built in programmable amplification, which as you can see below is situated before the converter. To maximize your resolution you want your input single to use the full +-2.048V input voltage range of the ADC. This is where the built in programmable gain can help. For example, if your maximum input signal is 1V then you’re not getting the full accuracy possible. By setting the PGA to two your input voltage will be multiplied by two, now you’ll get the maximum resolution for your small signal.
Example Code
Of course this post would not be complete without example code. I have written a class to handle all of the functionality for this IC on Linux and it is integrated ready to use in Qutipi. However just copy and paste the class and header into your project and it will work fine as well.