PySense 2 Accelerometer sampling rate
-
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_textThanks for your help.
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