PINE64
How can I take readings from the gyroscope and accelerometer? - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: PinePhone Software (https://forum.pine64.org/forumdisplay.php?fid=121)
+--- Thread: How can I take readings from the gyroscope and accelerometer? (/showthread.php?tid=13401)



How can I take readings from the gyroscope and accelerometer? - kk22 - 03-15-2021

I would like to use my Pinephone in a project where I need to take gyroscope and accelerometer readings. I can't find any information on how to access these sensors though. I tried lm-sensors but it only displays battery status and thermal sensors. There doesn't seem to be any info on the wiki either about accessing these. How can I log readings from these sensors?


RE: How can I take readings from the gyroscope and accelerometer? - moodroid - 03-16-2021

Hi,

https://wiki.postmarketos.org/wiki/PINE64_PinePhone_(pine64-pinephone)#Sensors

Have a search around in the directories specified and you'll find the various things you can get a reading from. I'm trying to write a compass, but it's not working very well so farSad

Thanks,


RE: How can I take readings from the gyroscope and accelerometer? - Trbl - 04-01-2021

(03-15-2021, 06:12 PM)kk22 Wrote: I would like to use my Pinephone in a project where I need to take gyroscope and accelerometer readings. I can't find any information on how to access these sensors though. I tried lm-sensors but it only displays battery status and thermal sensors. There doesn't seem to be any info on the wiki either about accessing these. How can I log readings from these sensors?

https://github.com/Alumniminium/PinePhoneCore/blob/master/Devices/Accelerometer.cs

This might help. If you take a look at the Path variable, you'll see the 'Gyroscope` is at
"/sys/bus/i2c/devices/2-0068/iio:device2"
which contains files like "in_anglvel_x_raw"

you can 'cat' files to read and 'echo | sudo tee' to write


RE: How can I take readings from the gyroscope and accelerometer? - wibble - 04-05-2021

You could also have a look at https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/ which abstracts a subset of the sensors out to dbus. Gyros don't seem to be part of that subset, but it should give another example of accel access.