Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    PySense 2 Accelerometer sampling rate

    Scheduled Pinned Locked Moved Expansion Board
    1 Posts 1 Posters 19 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      Amaury Basth
      last edited by

      Hello,

      Recently purchased a Lopy4 with a Pysense 2 to try to make measurements at 100Hz from the accelerometer included in the Pysense 2.
      After several attempts I am stuck at about 26Hz. :(

      The Lopy4 is up to date with the latest firmware and I am using the latest version of LIS2HH12.py with "ODR_100_HZ" ON.
      On the other hand I can't update the Pysense 2 maybe it comes from there?

      Despite the many posts in the forum on the subject I can't find an "clear" answer to this question.

      Below is the draft code I use (largely inspired by another post):

      import time
      import pycom
      from pycoproc_1 import Pycoproc
      import machine
      import utime
      
      from machine import RTC
      from LIS2HH12 import LIS2HH12
      
      pycom.heartbeat(False)
      
      py = Pycoproc(Pycoproc.PYSENSE)
      li = LIS2HH12(py)
      
      # RTC sync
      rtc = RTC()
      rtc.init((2021, 7, 23, 16, 10, 0, 0, 0))
      utime.sleep_ms(250)
      print(rtc.now())
      
      ftime = rtc.now()
      datee = str(ftime[2]) + "/" + str(ftime[1]) + "/" + str(ftime[0])
      
      print("Start of recording")
      t_end = time.time() + 1
      TotalData=[]
      while time.time() < t_end:
          dataString = li.acceleration()
          ttime = rtc.now()
          timee = str(ttime[3]) + ":" + str(ttime[4]) + ":" + str(ttime[5]) 
          fullData2 = datee + "," + timee + "," + str(dataString)
          TotalData.append(fullData2)
          print(fullData2)
      
      print("Length of Total Data is : ")
      print(len(TotalData))
      pycom.rgbled(0x007f00) # green
      time.sleep(1)
      pycom.rgbled(False)
      print("Record is over")```
      code_text
      

      Thanks for your help.

      1 Reply Last reply Reply Quote 0

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • 1 / 1
      • First post
        Last post

      Pycom on Twitter

      Pycom