Olimex Support Forum

DUINO => ARDUINO => Topic started by: fiara on March 21, 2017, 10:43:38 AM

Title: ekg emg shield meaning of output value
Post by: fiara on March 21, 2017, 10:43:38 AM
Hello all !

I am reading & seding the output value from the ekg - emg shield to the computer such that I dinamically plot it in a custom based .net application (using ms control from Windows Forms).

I read from the shield with int sensorValue = analogRead(analogInPin);

I noticed i get values from [0,1024]. Is there a way to convert these integers to voltage values such that I can label my Y-axis in my application ?

Thanks,
Fiara.
Title: Re: ekg emg shield meaning of output value
Post by: LubOlimex on April 06, 2017, 11:59:08 AM
This is not very related to SHIELD-EKG-EMG. This depends on the main board that you use (what is the ADC of the board; what is the voltage of the board). It is a general analog read approach as described here: https://www.arduino.cc/en/Reference/analogRead

If you don't understand what is going on, please also let us know what is the specific board that you use with SHIELD-EKG-EMG.

Best regards,
Lub/OLIMEX
Title: Re: ekg emg shield meaning of output value
Post by: fiara on April 06, 2017, 01:36:46 PM
Hi !

Well, I am using the official Arduino Uno with the  ATmega328P microcontroller.

Fiara.
Title: Re: ekg emg shield meaning of output value
Post by: LubOlimex on April 07, 2017, 09:17:15 AM
Hey,

The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). The important part is that the ADC is 10 bits, which means 2^10, which is 1024 (0-1023).

The other important part is that Arduino UNO works at 5V.

So:

1. You need to make sure to set SHIELD-EKG-EMG to 5V mode of operation.
2. To calculate voltage per unit:

5 volts / 1024 units = 0.0049 volts (4.9 mV) per unit.

Other boards have other ADC resolution (for example, 12-bit or 16-bit). Other boards can work at 3.3V too. That is why I needed to know the board to be able to calculate it.

Best regards,
Lub/OLIMEX