PIC18F4550 + ADS8326 Data Acquisition System

Introduction

[Update 08/23/2021: The PCB layout has been improved and made much more compact. Also, the number of analog inputs has been decreased from 32 to 16.]

There's often the need to measure a bunch of analog signals, and in order to make accurate measurements, we may resort to adding an external ADC to our existing microcontroller system to provide more resolution.

This project features the PIC18F4550 and the ADS8326.

Getting Started

The first step is to come up with a suitable architecture that's going to meet our needs. For this design, it is desired to have access to 16 analog channels and "really good" resolution. I felt that, an ADC with a 16-bit resolution met the threshold of being good enough.

For the main controller, I wanted to go with one that had enough community support and was relatively easy to use. Obviously, there are many options out there that could have been chosen, ultimately, I went with the PIC18F4550 because it seemed like a good fit. Also, I have never used PIC microcontrollers for any of my designs—so why not try something new?

Notice that I have not mentioned an specific application for this data acquisition system. The reason being that it could be used to measure any analog signal (within our specs) coming from devices such as thermistors, pressure sensors, and actually, any analog input we'd like to process in the microcontroller. You will notice, though, that the design focuses on measuring temperature through thermistors since that was the original intended application.

System Architecture

Here is a high level view of the data acquisition system:


The ADC is the ADS8326. This is a 16-bit, single channel SAR ADC, with an SPI bus to stream its output data. It offers high throughput (spec'd at 250,000 samples/sec max) and comes in a small package size.

You will also notice the use of a 16x1 mux. Given the fact that the ADS only has one channel, we need a way to connect all the 16 analog inputs to the ADC's single input—so the 16-channel mux allow for that at the expense of requiring extra pins for the select lines S0 through S3, and the enable pin. Keep in mind, that this is an analog mux that ideally propagates the analog signals exactly as they appear at its inputs. Of course, there are side effects such a noise that we need to deal with and hopefully calibrate them out of the system.

Schematic Part


This is a complete schematic of the system. I have added other components such as LEDs and headers, to allow for debugging. I've brought out some of the unused pins of the PIC18F4550, so that they can be tapped into if needed.

To add more options and/or debug capabilities, I've also exposed the PIC18F4550 on-chip USB interface; this provides with more ways to output relevant data through a serial terminal program, for example.

There is a 32-position header intended for connecting the external analog inputs. You will notice a bunch of 10k resistors, pulling one side of the headers up to 5V.  Initially, the circuit was designed to measure temperature values, by using thermistors. These thermistors have a nominal resistance of 30k at 25°C. When connected appropriately to the header, the thermistors will form a voltage divider with the fixed 10k ohm resistor and at 25°C, the voltage drop across the thermistors will be 3.75V.

PCB Layout

There are different ways to lay out the PCB. One thing to always keep in mind: Whenever there are analog signals to be measured, they need to be kept away from the digital signals. Digital signals are inherently noisy, and can have an adverse effect on the analog measurements. 

There's a wealth of online resources on mixed signal PCB techniques. Feel free to look into some of them as necessary.

Here is a picture of an actual board: