Is it possible to reading data from accelerometer with very high sample rate? I need about an 1-2 KHZ. My sensor is can read data with sample rate 25 KHZ, but on android it reading data with 200-400 HZ sample rate. What to do?
The sample rate depends in the sensor hardware.
Most Android phones are not equipped with high frequency accelerometers.
You can check what your phone sensor supports using [getHighestDirectReportRateLevel][1] method of the sensor object.
You can also use the Sensor object you get from SensorManager to check the exact model of the accelerometer in your phone and look up its speck sheet.
Related
Is it possible to record the raw light data from the heart rate sensor in Android Wear? I know it's possible to record the calculated heart rate in bpm, but I would like to record the raw light data.
The device I am using is the Polar M600.
This question has been asked before, but I am asking it again in case any new devices or APIs have made access to this data possible since then:
Read underlying color/light data from Android Wear heart rate sensor?
How to access Android Heart Rate Sensor RAW DATA? (reflected light, not the heart beat)
I've no idea what data is shown but on the moto360 sport you can see other information from the heartrate sensor. Using wearSensors you scroll though each sensor on the watch. See if has anything none standard, in the sport case a motorola.sensor.ppg sensor.
I'm reading out the accelerometer sensor on a Sony Smartwatch 3. Since the Android Wear 1.5 update the sampling rate won't drop below about 60hz, regardless weather I use SENSOR_DELAY_NORMAL, SENSOR_DELAY_UI or SENSOR_DELAY_GAME. Before the update SENSOR_DELAY_NORMAL resulted in a sampling rate of about 18 samples/seconds.
accelerometer.getMaxDelay()still returns 62500, which would be 16 samples/sec. I also tried setting the desired delay directly, when registering the sensor with sensorManager.registerSensor(this, accelerometer, 62500) but this doesn't work either.
Has anybody any idea of how I can reduce the sampling rate? It's very important for my app to be energy efficient, thats why the low sampling rate is important.
Docs say next about samplingPeriodUs:
This is only a hint to the system. Events may be received faster or
slower than the specified rate. Usually events are received faster.
So, IMHO you should just ignore some amount of sensor events, as was proposed by Alex. Dry run for sensor event (i.e. without actual processing shouldn't be very power consuming).
How could it have been different: Not the Android update changed the behavior, it was my misunderstanding.
For everyone who might have problems with sensor batching or sampling rates:
The sampling rate might be different, when the display is on or off. In my case it was 60hz when on and 18hz when off.
Sensor batching might not be working, when the device is connected to a power source. For me I head to unplug the USB-cable. Bluetooth debugging might be helpful in that case.
I want to create an android app for vibrations analysis using embedded accelerometer, would you suggest an easy solution/library to get a frequency spectrum out of the x,y,z accelerations?
I'd like to read the heart rate sensor data on an Android Wear smartwatch. The documentation makes it seem like the heart rate sensor only reports two things:
Heart rate (in beats per minute)
Either an accuracy measure or an error code
Is it possible to get the Android Wear heart rate sensor's underlying data, i.e., the amount of red light (or green or blue light) at any point in time, which it uses to determine when the heart beats?
The Instant Heart Rate app gets color data from the camera (which I know is different from the Android Wear heart rate monitor), which it uses to display a graph of the heart rate:
I'd like to do a similar thing, but with the Android Wear's optical heart rate sensor instead of with the camera. In order to make the graph, I'd need to know the level of red light at any point in time, not just the beats-per-minute measure. Does anyone know if that's possible?
This will be dependent on the manufacturer exposing the data. I agree it could be very cool. For instance, reflectance could be used to analyze spectral data, and beat to beat variability is an indicator of health... Maybe submit a request to Android site to create an API for the raw sensor data?
I have responded to a similar question here: Android Wear: How to get raw PPG data?
Essentially, I was able to record the raw PPG signal from Huawei and Fossil watches. This will let you compute things like Spo2 and HRV.
I write a simple app to read accelerometer data and I found that sampling rate is too low(even one sample 5 seconds) when I put phone on the table and keep quiet. I set sampling rate as FASTEST it's sampling rate always is high.
I want to know why and how does Android do this? I guess jni or hardware always read data but it discard data when it find there is no change between two sample.
As you can see from the documentation of the sensor listener the procedure onSensorChanged is called when the sensor changed. This means that if you hold the device still the sensor values won't change.
I have to admit that most phones add noise to sensor values and these values are always changing; you should be 'proud' of your phone - it doesn't add a lot of noise.