LegoBot

Goal

Legobot is a project to use Microbit to drive a robot built from Lego Mindstorm blocks and components.
Lego Robot

PLAN

The project started with this concept:

  • Two motors drive two tracks, like a tank
  • Motors driven by SB Components Motor Driver
  • Compass sensor requires Mbit in horizontal plane
  • Code microbit using blocks in MakeCode, with source control in GitHub
  • Autonomous movement, go North, go East, go South, go West, turn to North

There were several PDCAs With several actions required:

  1. Microbit’s compass cannot provide heading when the motors are running, because the motors greatly alter the magnetic field.
  2. Time of running does not accurately measure the degrees turned
  3. Microbit’s accelerometer cannot readily calculate rotational velocity, a radius of motion is required. The distance between the midpoint between the wheels and the accelerometer might be good enough.
  4. Adding a gyroscope board, which measures angular velocity in 3 planes, and attempting to integrate angular velocity does not work reliably yet.

DO

For each PDCA, changes were made changes to hardware as necessary. Also changes in MicroPython in VSCode, main.py, and modules sbcmotorcontroller.py and mpu6050.py (gyro). Main.py can be uploaded to mbit within the micropython editor but the modules have to pasted in, creating an opportunity for fumbles. Download from mbit to a local hex file is available, which yields plain text python.

CHECK

Test the bot, download any logs, and write notes in the repo PDCA folder. Logs can be opened in Excel or other tools for visualization. After each PDCA, code committed and pushed in git.

ACT

  • Seek means of tracking heading changes and distance moved, like Sphero.