Hopefully I was not just too blind and this topic has been covered before. However I could not find information.
I received an RT1062 last week and played with it. First I was a bit disappointed to only have an accelerometer and not full imu like nicla. Then I wanted to check it out and realized that I did not find a suitable example. Checked filter by board.
So do you provide a library for the accelerometer or would you read its data over i2c bus? (schemetic says internal i2c bus)
Is there example code?
Here’s what we got for right now. The accelerometer is really basic. I would have loved to include a full IMU, but we didn’t have the cost room. The one we are using is the least expensive one on the market (50 cents), full IMUs start at like 4-5 dollars and up which would have added $10 to the final system cost.
Anyway, it’s really just for tilt sensing, which we will use in the future to allow you to rotate the video as the camera rotates.
# Untitled - By: kwagy - Tue Aug 8 2023
import machine, time
bus = machine.I2C(2)
print(bus.scan())
while(True):
d = bus.readfrom_mem(0x15, 0x03, 7)
x = ((d[0] << 8) | d[1]) >> 4
if x & 0x800: x = x - 4096
y = ((d[2] << 8) | d[3]) >> 4
if y & 0x800: y = y - 4096
z = ((d[4] << 8) | d[5]) >> 4
if z & 0x800: z = z - 4096
t = d[6]
x = x / 1024.0
y = y / 1024.0
z = z / 1024.0
t = (t * 0.586) + 25.0
t = (t * 9.0/5.0) + 32
print("%+0.2fx %+0.2fy %+0.2fz %+0.2ft" % (x, y, z, t))
time.sleep_ms(100)
Besides being an inexpensive IMU, it is the simplest thing imaginable.
Thanks for the code!
I am looking forward to play with that device tonight. Having a timer interrupt and do the reading and possibly some (lowpass) filtering in python should be no problem for the processor.
Wow that is really a significant difference in price tag for a cam like that.
@kwagyeman Never mind the cost of a full IMU (6DOF would be enough, no need for the fiddly magnetometer part), 10$ more on top of the current 120$ isn’t much, it would have made the RT1062 a potential… VIO (Visual Inertial Odometry) on MCU!
Please do not hesitate to add a full IMU, and … a 8x8 ToF sensor on the next release.