This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Thingy91 low power accelerometer use

Hi, I am trying to add a motion sensor event into my code that utilizes the low power accelerometer on board the thingy91. I wont be in sleep mode but will be in PSM or edrx mode and I need the low power accelerometer to trigger an event that will cause some communication with the network. I have been pointed to the adxl362 code in the zephyr sample folder but I haven't been able to get that to run. Does anyone have or know of some sample code that shows how to use the low power accelerometer that is on the thingy91? I see that the chip is on pin PO.09 and the interrupt line is on PO.10 but not fully sure how to get it working. Any help would be appreciated.

Parents
  • Hi.

     

    I haven't been able to get that to run

     What have you tried, and what did not work?

    In order to be able to build an application for the Thingy:91 you need to include ncs/nrf/cmake/boilerplate.cmake in the CMakeLists.txt

    After adding the following line at line 6 in ncs/zephyr/samples/sensor/adxl362/CMakeLists.txt it worked fine for me.

    include($ENV{ZEPHYR_BASE}/../nrf/cmake/boilerplate.cmake NO_POLICY_SCOPE)

    Merry Christmas!

    Didrik

Reply
  • Hi.

     

    I haven't been able to get that to run

     What have you tried, and what did not work?

    In order to be able to build an application for the Thingy:91 you need to include ncs/nrf/cmake/boilerplate.cmake in the CMakeLists.txt

    After adding the following line at line 6 in ncs/zephyr/samples/sensor/adxl362/CMakeLists.txt it worked fine for me.

    include($ENV{ZEPHYR_BASE}/../nrf/cmake/boilerplate.cmake NO_POLICY_SCOPE)

    Merry Christmas!

    Didrik

Children
  • perfect that got it to work thanks. Do you understand how the motion trigger works? I find that when I run it the motion trigger fires immediately and never after the first trigger. It prints out the motion variables x: -0.3, y: 0.4, z: -9.3 (m/s^2)v I assume the z value of -9.3 is a result of reading gravity. I'm not sure if that is what tripping the motion trigger but that would be my guess. Do you know how I would compensate for that or change the trigger thresholds so that -9 is the baseline there? Also how do you  reset the motion trigger so I can trigger every time there is motion not just the 1 time there is motion?

Related