ECG/EMG shield data clips at 1024

Started by patmorli, June 17, 2020, 09:07:59 pm

Previous topic - Next topic


Hi all,

I am using the Olimex ECG/EMG shield on a SparkFun Redboard Qwiic. To collect EMG or ECG data, I use this code:

#include <compat/deprecated.h>
#include <FlexiTimer2.h>
#define SAMPFREQ 256                      // ADC sampling rate 256
#define TIMER2VAL (1024/(SAMPFREQ))       // Set 256Hz sampling frequency                   
volatile unsigned char CurrentCh=0;         //Current channel being sampled.
volatile unsigned int ADC_Value = 0;    //ADC current value

void setup() {

noInterrupts();  // Disable all interrupts before initialization

FlexiTimer2::set(TIMER2VAL, Timer2_Overflow_ISR);

// Serial Port

interrupts();  // Enable all interrupts after initialization has been completed

void Timer2_Overflow_ISR()
        ADC_Value = analogRead(CurrentCh);
        //Serial.print("D!");    //this is packet header for my application
        Serial.print(", ");

void loop() {
__asm__ __volatile__ ("sleep");

The problem is that for EMG and ECG data it saturates at 1024 bits. I guess that is because of the shield sending out 0-5V data whereas the RedBoard reads 0-3.3V. I am not sure with that guess. One of the jumpers on the olimex shield has to connect either 5V with the middle pin or 3.3V with the middle pin. I tried out both configurations, but that also did not change anything. Maybe I did it wrong.

Does anyone have an idea how to save that problem?



June 18, 2020, 09:14:59 am #1 Last Edit: June 18, 2020, 01:48:38 pm by LubOlimex Reason: rate -> rotate, thanks John
Maybe the amplification is simply too great for your uses? Did you try to adjust the trimmer - use a sharp object to rate rotate the pin of the blue trimmer to lower the amplification.
Technical support and documentation manager at Olimex