# ADC conversion value spike during ADC conversion

Description of the situation

I am trying to get an analog vibration sensor signal to a Raspberry Pi 3 B+.

To convert the analog signal to digital values, I'm using Waveshare High-Precision AD/DA Board (a raspberry pi 3 shield) that includes an ADS1256 ADC chip from Texas Instruments (30 kSPS, Gain 1, 24Bit).

I'm currently using a differential connection to connect sensor output to the ADC. Since the sample code provided by Waveshare did not include continuous mode conversion, I've tweaked code found on Github (link below) and implemented in my application.

This allowed me to convert data, with conversion speed measured to be around 29k per second.

In order to test the conversion integrity, I've disconnected the analog sensor from the ADC board and instead connected a function generator (sinwave of 1.5V, 60Hz).

The problem

When I plotted and checked the converted data, there were unusual spikes of converted data (Figure 1) even though the sine wave produced from the function generator did not (checked with oscilloscope). These spikes were not periodic and seemed random (Figure 2).

I've looked at the ADS1256 datasheet and Waveshare board manual but could not find any solution to this problem.

The question

1. What is the cause of these value spikes?
2. Is there any solution to overcome these value spikes (in terms of hardware or software?)

Figure1

Figure2

# Code

/***************************************************************************************************
* Name : ADS1256_Collect_Continuous
* Parameter :
* Return : void
***************************************************************************************************/
void ADS1256_Collect_Continuous(uint8_t channel, int32_t numOfMeasure, int32_t *values)
{

uint32_t read = 0;
uint8_t buf[3];
uint8_t del = 8;

ADS1256_SetDiffChannal(channel); /* change DiffChannal */
bsp_DelayUS(del);

CS_0();
waitDRDY();
bsp_DelayUS(del);   // min delay: t6 = 50 * 1/7.68 MHz = 6.5 microseconds

for (int i = 0; i < numOfMeasure; ++i)
{
waitDRDY();
/*Read the sample results 24bit*/

read = ((uint32_t)buf[0] << 16) & 0x00FF0000;
read |= ((uint32_t)buf[1] << 8); /* Pay attention to It is wrong   read |= (buf[1] << 8) */

/* Extend a signed number*/
if (read & 0x800000)
{
}
bsp_DelayUS(del);
}

waitDRDY();
CS_1();
}


# Resources

High-Precision AD/DA Board Sample Code(30,August,2018) : https://www.waveshare.com/wiki/File:High-Precision-AD-DA-Board-Code.7z

# Edited

Spikes of converted data(Figure3)

Figure3

ADC board connected on top of the Raspberry pi with GPIO(Figure4)

Figure4

Raw integer Value(Figure5)

Figure5

• Looks like an issue with the digital interface. Confirm your wait-for-drdy is working correctly, and check you're using the correct SPI mode (i.e. sampling on the falling edge). Also, post the exact numeric values read out of the ADC during one of the glitches and for a few samples before and after - that way we can see if it looks like a bit shifted left or right. – pericynthion May 2 at 5:01
• Are these happening in different places each time? Just once per waveform or multiple times? Only ever larger (or only ever smaller) than it should be? If you're multiplexing ADC inputs then maybe you're not allowing the ADC to settle enough before taking a reading. – DKNguyen May 2 at 5:55
• Have you tried feed the ADC with a fixed DC-value? if not it may be interesting to see if the phenomenon still is present. – Anton Ingemarson May 2 at 7:09
• @pericynthion Yes, wait-for-drdy is working correctly and sampling take place on the falling edge. I've edited the post to add the exact numeric values during the clitch. – Jihun Kim May 2 at 7:38
• @Toor Yes, these are happening randomly. Sometimes, no spikes are seen for 3~5 seconds (about 90,000 ~ 150,000 converted samples) but in some cases, there are many spikes (around 10 occations over 5 seconds). It seems like there is no pattern on when and how many spikes occur. Also, I'm allowing enough settling time (according to ADS1256 datasheet). – Jihun Kim May 2 at 7:38