Data acquisition is pretty essential! However, it proved surprisingly difficult to find a plug-on analog-to-digital (ADC) board for the Pi Pico. It was time to create a custom board!
This project is a work in progress. Some of the functionality has been implemented, but things may still need to be tweaked.
The board described here supports high-res 16-bit measurements for inputs in the range +/- 4V (the range can be modified), and it has two channels (you could stack boards for more channels).
Even if you're not interested in analog data acquisition, perhaps bits of this project are helpful if you're interested in working with ambient temperature sensors and non-volatile memory (EEPROM).
The core circuit for the ADC board is shown below. The two inputs labeled AIN_1 and AIN_2 are amplified by two op-amps from a 4-in-one op-amp chip. Another op-amp from that chip is used to create a mid-rail supply, which is needed to bias the op-amp input since everything runs from single-ended supplies. The last op-amp in the chip is unused.
Note that AIN_2 has a corresponding AIN_2’ pin, which, optionally, can be useful for connecting directly to the 0V end of a low-side current sense resistor if desired. The gain of the op-amp would most likely need to be changed if it is used for current measurement.
The ADC chip ADS1115 can have up to 4 channels, but since we use it in a differential input mode, only two channels are available per board. More boards could be used if more than two channels are needed for a project.
The input range for the components on the board are +-4V (although the input does extend to +5V). The reason for this is that originally the components were sized for a larger range, which only works if the ADC chip could operate from 5V, but that's not possible because it interfaces to a Pi Pico with 3.3V levels (the ADC I2C input thresholds are not compatible with such operation). So, consider the input range to be +-4V, and if you desire a different range then you could scale that with either a potential divider or an amplifier on the input, or by changing resistors on the board.
The connections to the Pi Pico are shown in the circuit diagram below. The only GPIO pins that are used are SDA and SCL, and with wire links those pins can be GPIO4+5, or GPIO6+7, to reduce the chance of clashes with other existing hardware that may also be connected to the Pico.
A MOSFET is used so that the supply for the Pico and ADC board can come from either the Pico’s USB socket, or from an external 5V source connected to +VIN.
Finally, a temperature sensor and an EEPROM are also present on the board if required. It would be nice to use an EEPROM with address pins so that more than one board could be attached in the future (today, if more than one board is used, then the EEPROM should only be soldered on one board). Also, it could make sense to power the temperature sensor from a GPIO pin in the future, but for now, it is permanently powered by 3.3V from the Pico.
The diagrams below can be used to aid in assembly.
Everything is feasible to hand-solder with a soldering iron or with a hot air tool. The integrated circuit (IC) footprints were specifically designed to make it easy to solder with basic tools.
The temperature sensor on the underside of the board is tiny but still hand-solderable. The info is here: Soldering Tiny Temperature Sensors
Note that there is a bodge fix on the Rev 1 board. R7 is wrongly connected to the 5V rail when it should be connected to 3.3V. The fix is to mount R7 on just one pad and then connect the other end of the resistor to 3.3V using a short wire. I achieved it by passing the wire through a spare hole.
There is a test program on GitHub (feel free to contribute to the code if you can [even if it is just suggestions]. Thanks Jan Cumps for some work already done to it). When run, it should repeatedly display the voltage measurements for the two channels plus the board temperature. It seems reasonably accurate, but not many measurements have been done so far. This is still a new project!
The test program is a playground for trying out functionality related to the board. It also provides access to the EEPROM for configuration. To gain access, pull GPIO21 or GPIO27 (either is fine) low on power-up. When that is done, a configuration menu will appear on the serial console.
1. Resistor R7 is wrongly connected to 5V. It needs to be wired to 3.3V instead.
2. The input range is not precisely +/-5V. It is approximately -4.2V to 5.3V, i.e. it’s not possible to measure down to –5V currently. Hopefully, this can be improved with resistor value modifications.
3. The temperature sensor isn’t currently practical for ambient readings. The measured temperature is several degrees higher. The next board revision will try to improve that. The board will look something like what is shown in the render below (this is not completed yet).
4. If more than one board is attached, then the temperature sensor and EEPROM chips need to be only on one board.
A new revision board will be created at some point to address the issues. If you spot any problems or have suggestions for the hardware or the software, please let me know! Probably, the next revision board cannot accommodate too many changes since it is almost complete, but I won’t order a second board for now while this first board is still fresh.
If you wish to build the revision 1 board, the Gerber files are attached. I’ll upload the KiCad files to a GitHub repo at some point (they are currently being worked on for the next revision). The source code is on Github, but as mentioned, it is just test code for now, not very pretty.
If you have any ideas for the project, or example applications, it would be great to hear about them.
Thanks for reading!