Unit of measurement for ECG data - movesense

I'm working on ECG data I'm getting from a Movesense 2.0.0 HR+ sensor by using /meas/ECG API.
I'd like to know what's the unit of measurement for them and if they can be converted to milliVolts.

The correct scaling factor is:
VOLTS_PER_LSB = 1.0f / 20.0f / (1 << 17);
i.e. one LSB corresponds to 0.38147 uV
Full disclosure: I work for the Movesense team

Related

Processing Raw data from kinect in matlab

I am using Microsoft kinect v1 in MATLAB and want to get depth data on every pixel in meters.
I am not sure how to get that data because I am getting uint16 and as far as I have read is that it provides depth only in 13 bits, So how do I get those 13 bits and do some conversion to get depth exactly in meters.
I have searched a lot about it but could not get to any conclusion.
Kinectinfo = imaqhwinfo('kinect');
colorinfo = Kinectinfo.DeviceInfo(1);
depthinfo = Kinectinfo.DeviceInfo(2);
colorvid = videoinput('kinect',1);
depthvid = videoinput('kinect',2);
srcDepth = getselectedsource(depthvid);
% Set the frames per trigger for both devices to 1.
colorvid.FramesPerTrigger = 1;
depthvid.FramesPerTrigger = 1;
% Set the trigger repeat for both devices to 200, in order to acquire 201 frames from both the color sensor and the depth sensor.
colorvid.TriggerRepeat = 200;
depthvid.TriggerRepeat = 200;
%Configure the camera for manual triggering for both sensors.
triggerconfig([colorvid depthvid],'manual');
% Start both video objects.
start([colorvid depthvid]);
%Trigger the devices, then get the acquired data.
% Trigger 200 times to get the frames.
for i = 1:200
% Trigger both objects.
trigger([colorvid depthvid])
% Get the acquired frames and metadata.
[imgColor, ts_color, metaData_Color] = getdata(colorvid);
[imgDepth, ts_depth, metaData_Depth] = getdata(depthvid);
end
[NYU Depth and RGB image][1]
[Histogram of swaped Raw Depth image][2]
[Histogram of Raw Depth Image][3]
I would like to have some code for conversion or any SDK that provides me with meters in matlab.
Thanks alot.
According to several articles, eg. such as here and here, the first three bits are code for the player that the device has identified, but this is only activated if skeleton tracking is enabled. If you don't enable skeleton tracking, the three bits are set to zero.
If you are using matlab, the depth images are 16bit double images, and contain data that is already extracted from the 13bits (most probably because skeleton tracking is already disabled, hence 3 MSB are zero.) Therefore you dont need to convert/extract the 13 bit data in matlab or libfreenect etc becuase the bits be already zero.
According to the Matlab help page, matlab ImAq toolbox requires the installation of Kinect for Windows Runtime; because it uses the Kinect SDK Kinect drivers to acquire data. And according to this SO answer, "using Microsoft SDK, so the values that are returned from kinect sensor are already real distances in mm."
Therefore, you dont really need to bitshift data in matlab. The only reason you would need to do it, would be if you are getting raw depth stream from the kinect drivers (?) in C++/C# and the 16bit data would include the 3 LSB bits.

How to measure/know precisely the ADC reference voltage on STM32L052K6T6?

I am currenctly working on STM32L052K6T6.
I would like to know if there is an appropriate way to measure precisely the voltage used by the adc.
I read through the documentation that this voltage was on adc_channel17 but i have no idea on how to get it.
I also read there was a calibration Variable called VREFINT_CAL but again i did'nt see the process to use it properly.
I know this voltage is for me around 1.8V. But i need to know it untill 1.80000 at least to calculate accurate values of my sensor.
To program my MUC i am using Atollic, i did the basic pins configuration using STM32CubeMX.
The internal reference voltage is not used by the ADC. It is only used to measure the actual Vref voltage. Vref voltage depending on the version of the chip can be Vref+ or Vdda.
How to measure the actual Vref?
You need to measure the Vrefint (which is about 1.2V) and then using the simple math calcultate the Vref
Vrefint = Vref * (RAW_ADC / 4096)
So Vref = Vrefint * 4096 / RAW_ADC
or if you want to use VREFINT_CAL : Vref = 3 V * VREFINT_CAL / RAD_ADC
You have to do a calibration before measuring good value of channel VREF_INT.
HAL_ADCEx_Calibration_Start(&hadc, ADC_SINGLE_ENDED);

STM32 Temperature sensor power off

I am using internal ADC temp sensor , in a low power device without the sensor in stop mode ,the uController consumes around 4 uA but when the temp sensor is on the consumption goes up to 8-9 uA
the problem is i can not turn the sensor OFF / i just measured the off current by setting it off from start by stmcube
i am searching for a code that can turn off the temp sensor
up until now i have tested these:
1-
HAL_ADC_Init(&hadc);
hadc.Lock=HAL_UNLOCKED;
__HAL_UNLOCK(&hadc);
HAL_ADCEx_DisableVREFINTTempSensor();
2-
ADC1->CR&=0X00000000;
ADC->CCR&=~(1<<23);
i prefer to work with HAL , it dose not seems to cut the Sensor power
Your ADC1->CR &= 0x00000000; line looks wrong to me, depending on the controller you're using.
There is usually a bit to disable the ADC which needs to be set, rather than writing all 0s. Try ADC1->CR = (0x01 << 1); instead. If you have the ST Micro written defines for your processor ADC1->CR = ADC_CR_ADDIS; should be the same but more readable. After disabling the ADC you will be able to turn off the TSEN bit of ADC->CCR.

How does the complementary filter work?

I'm trying to combine the data from an accelerometer and a gyroscope to accurately measure the pitch and yaw angles of an object. After researching the complementary filter and attempting to implement it, i have a few questions on how it works.
I've read that the filter "trusts" the gyroscope data if there is a lot of angular movement and that it "trusts" the accelerometer data if the object is stable.
http://www.pieter-jan.com/node/11
In this article the complementary filter is described in this way:
*angle = 0.98(angle + gyrData * dt) + 0.02*(accData)*
To me it, seems as if the gyroscope data is being favoured. In the following image, http://www.pieter-jan.com/images/resize/Complementary_Filter.png , found at the bottom of the page, the filtered data seems to "keep close" to the accelerometer data, even though the gyroscope data has drifted. I don't understand why this occurs when the calculation suggests the gyroscope data is being favoured. I have observed this in other photos as well. During my own testing i needed to "swap" the 0.98 and 0.02, suggesting the accelerometer data is being favoured, to obtain similar results. Am i missing completely misunderstanding how this filter works? Is it normal to "favour" the accelerometer data?
Furthermore when the angle of an object needs to be monitored for a long length of time, doesn't the gyroscope data become useless as the drift is so large, how does the filter compensate?
I Realise where i was going wrong.
I had essentially calculated the angle using only the gyroscope data and used that in the filter. i.e
GyroAngle += d°/s * time_between_cycles
FilteredAngle = 0.98*GyroAngle + 0.02*AccelerometerAngle
Instead i should've been doing this:
FilteredAngle = 0.98*(FilteredAngle + d°/s * time_between_cycles) + 0.02*AccelerometerAngle
Doing this has yielded much better results
I'm trying to do something similar to this. I'm implementing a complementary filter in my Arduino code using an LSM9DS0 sensor (It has a gyro/accelerometer built-in https://www.adafruit.com/product/2021
There's a filter value I have been playing around and a calibration method I'm trying to use but I can't seem to get rid of it 100%. There is always a small deviation from the angle and I can never get a 100% filtered angle with no error.

LM35 temp sesnor equation for arduino uno which connected to matlab GUI

Hi I'm new in matlab GUI
I am trying to create an axes plot the temperature which comes from LM35 through arduino uno to matlab
I used the following code to read the analog voltage, readVoltage(a,0)
I get a values about 0.28 - 0.30 but I don't know exactly what this values exactly means is it the the real temperature/100 or what? I know there is an ADC inside arduino converts the input voltage to another range (0-1023) when I use analogRead() on the arduino side. Does it also work here or not? I confused about this thing when I should assume it is 0-1023 or directly get the reading.
The arduino ADC reads a voltage and outputs a number according to
the reference voltage
the bit width of the ADC
in this case I suppose that you are using the 5V reference and 10 bit mode, so
Vmeasured = NumberFromADC * 5V / 1024
Now, according to the LM35 datasheet the output voltage is
Vout = 10mV/°C * T
inverting the equation:
T = Vout / (10mV/°C) = NumberFromADC * 5V / 1024 / (10mV/°C) = NumberFromADC * 500 / 1024
(of course expressed in °C)
BTW I suggest you to change the voltage reference to an internal one, since the 5V are not stable and precise enough to have a good measuring system. More info here.
And, of course, if you change the reference voltage you will need to change the equation since the reference itself will not be 5V anymore.