SparkFan AD8232 over 1024 value

I use SparFan AD8232 and Arduino nano BLE 3.3 for getting ECG data
I get data from sample code

// send the value of analog input 0:
  Serial.println(analogRead(A0));

However, there is some waveform data that seems to exceed 1023, in which case the data value falls within 10 bits. Is there a simple way to reduce the sensitivity, or is it possible to make an appropriate calibration so that max falls within 1024?

The Nano 33 BLE has a 12-bit ADC (0-4092). :wink:

The easiest solution is probably to map() it to 0-1023 but you'd be throwing-away 2-bits of resolution. (Probably not a big deal in this application where you have noise & variability anyway.)

Thanks ! watching & replys

The following code is fine for mapping analog values to 6 bits, for example.

void loop() {
  int myValue = analogRead(0);
  myValue = map(myValue, 0, 1023, 0, 64);
}

In the above code, the analogRead() function is used to read data from analog pin 0, and the analogRead() function returns a value that assumes a range of 0 to 1023.
However, in this case, I assume that when there is an analog value input at the power level, the upper bits of the portion exceeded by the error are discarded by the comparator processing on sparkfan's board due to the ref level issue.
Therefore, I think there is a way to lower the analog input value by voltage divider or to increase the ref voltage of the comparator.

"The Nano 33 BLE has a 12-bit ADC (0-4092)." Thanks good news!
Shouldn't there be some setting or another function other than the analogRead() function?
Is there a problem with sparkfan's board processing that the upper bits are discarded?

I assume that there is not a problem with the Nano BLE ADC-resolution
But please tell me what Number-port has a 12-bit ADC (0-4092) and how to use 12bit-resolution.
And how to set ADC ref-level setting.

map() is sort of the hard way to shift a number two bits to the right.

int myValue = analogRead(0) >> 4; // 12-bit to 8-bit resolution
No map() needed.

Google "Arduino bitshift"
Leo..

To clarify for 10 bits that would be:

int myValue = analogRead(0) >> 2; // 12 bit to 10 bit conversion

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.