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?)

enter image description here Figure1

enter image description here Figure2


 * 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 */

    ADS1256_Send8Bit(CMD_RDATAC); // Start read data continuous.
    bsp_DelayUS(del);   // min delay: t6 = 50 * 1/7.68 MHz = 6.5 microseconds

    for (int i = 0; i < numOfMeasure; ++i)
        /*Read the sample results 24bit*/
        buf[0] = ADS1256_Recive8Bit();
        buf[1] = ADS1256_Recive8Bit();
        buf[2] = ADS1256_Recive8Bit();

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

        /* Extend a signed number*/
        if (read & 0x800000)
            read |= 0xFF000000;
        values[i] = read;

    ADS1256_Send8Bit(CMD_SDATAC); // Stop read data continuous.


High-Precision AD/DA Board Schematic : https://www.waveshare.com/w/upload/2/29/High-Precision-AD-DA-board.pdf

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

Sample Code (ADS1256 Continuous) : https://github.com/jurebartol/Rpi2_ads1256

ADS1256 DataSheet : http://www.ti.com/lit/ds/symlink/ads1255.pdf


Spikes of converted data(Figure3)

enter image description here


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

enter image description here


Raw integer Value(Figure5)

enter image description here


  • 2
    \$\begingroup\$ 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. \$\endgroup\$ – pericynthion May 2 at 5:01
  • \$\begingroup\$ 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. \$\endgroup\$ – DKNguyen May 2 at 5:55
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – Anton Ingemarson May 2 at 7:09
  • \$\begingroup\$ @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. \$\endgroup\$ – Jihun Kim May 2 at 7:38
  • \$\begingroup\$ @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). \$\endgroup\$ – Jihun Kim May 2 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.