How can I take readings from the gyroscope and accelerometer?
#1
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?
  Reply
#2
Hi,

https://wiki.postmarketos.org/wiki/PINE6...e)#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,
  Reply
#3
(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/PinePhon...rometer.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
  Reply
#4
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.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Article: Inside a Smartphone Accelerometer: PinePhone with NuttX RTOS lupyuen 22 11,492 05-28-2023, 06:09 AM
Last Post: lupyuen

Forum Jump:


Users browsing this thread: 2 Guest(s)