We decided to use the accelerometer in two RP2040 and pair it to our servo motors on an axis to have the arms respond to the motion of the boards.
<aside> 💡 Now we have our idea, what do we need?
</aside>
Components to get started
<aside> 💻 Approach to coding
</aside>
Challenge is figuring out how to make the servo motor move, then access the accelerometer. Next combine the two.
import time
from motorController import *
from lsm6dsox import LSM6DSOX
from machine import Pin, I2C
lsm = LSM6DSOX(I2C(0, scl=Pin(13), sda=Pin(12)))
board = NanoMotorBoard()
print("reboot")
board.reboot()
time.sleep_ms(500)
servos = []
for i in range(4):
servos.append(Servo(i))
#if (!PMIC.enableBoostMode()):
# print("Error enabling Boost Mode");
while True:
accel = lsm.read_accel()
angle = accel[2]*180
for servo in servos:
reply = servo.setAngle(angle)
print("Servos position %d" % i)
time.sleep_ms(200)
# Keep active the communication between MKR board & MKR Motor Carrier
# Ping the SAMD11
board.ping()
time.sleep_ms(50)
To Nolop we went and cut out some scrap material we found in an attempt to make a humanoid robot
After some successful tests the design was coming together and we laser cut some small robotic arms