Introduction: Lily∞Bot With Micro:Bit and Motor:Bit Does Obstacle Avoidance

About: I am a professor of electrical engineering and robotics, Open Source Hardware Trailblazer, and co-founder of Black In Engineering and Black in Robotics. @drcaberry and @noiresteminist on most socials . It will…

This project will explain how to get obstacle avoidance working on the open-source modular 3d printed robot, Lily∞Bot, using the Micro:Bit, MotorBit, sonar and 2 DC motors. It will describe, building the robot, wiring the hardware and electronics and programmming the robot. Since this is graphical programming, the project is appropriate for elementary age kiddos, 1st - 4th grade. This same robot can grow with the user by changing the controller and programming language to Circuit Playground Express, Arduino Uno, Raspberry Pi Pico W, and more to come! Learn more about Lily∞Bot at NoireSTEMinist.com/robots and on Youtube at https://youtube.com/carlottaberry



Supplies

The parts list for the Lily∞Bot With Micro:Bit can be found on GITHUB and on Amazon at the following links:

https://www.amazon.com/hz/wishlist/ls/16Q4OHY4E8AF3?ref_=wl_share

https://bit.ly/3Xuwe7Z

Primary components are the 3d printed parts available on GITHUB

  1. Micro:Bit
  2. Motor:Bit
  3. Sonar
  4. Motors
  5. Wheels

Step 1: Assemble the Lily∞Bot

There are three options to assemble the Lily∞Bot, select one of the choices below.

  1. Watch the YouTube video at this link to assemble the Lily∞Bot
  2. Read the document on GITHUB at this linkto assemble the Lily∞Bot
  3. Complete the Instructable at this link to assemble the Lily∞Bot

MAKE SURE TO STOP BEFORE ADDING THE BREADBOARD AND ARDUINO UNO!

Step 2: Attach the Motors to the Motor:Bit

  1. Use pocket screwdriver to open up screws on blue terminal block
  2. Attach right motor, BLACK to M2+ and RED to M2-
  3. Attach left motor RED to M1-BLACK to M1+


Step 3: Attach the Battery Pack to the Motor:Bit

  1. Use pocket screwdriver to open up screws on blue terminal block
  2. Attach RED wire of battery pack to VIN on Motor:Bit 
  3. Attach BLACK wire of battery pack to GND on Motor:Bit



Step 4: Wire the Sonar to the Motor:bit

  1. Use female-female wire to attach VCC wire of sonar to 5V row on Motor:Bit (RED LINE)
  2. Use female-female wire to attach GND wire of sonar to GND row on Motor:Bit (BLACK LINE)
  3. Use female-female wire to attach TRIG on sonar to pin 13 on Motor:Bit (BLUE LINE)
  4. Use female-female wire to attach ECHO on sonar to pin 14 on Motor:Bit (BLUE LINE)

You can change the code to match the two pins you attach trigger and echo to.

Step 5: Write the Obstacle Avoidance MakeCode

The Micro:Bit can be programmed with Bluetooth on an iPad or via the USB cable attached to a computer. See the video for examples of how to do wireless programming.

  1. Go the MakeCode website at the following linkhttps://makecode.microbit.org/
  2. Click New Project
  3. Click Extensions
  4. Type MotorBit
  5. Click Icon to add to project
  6. Click Extensions
  7. Type sonar
  8. Click icon to add to project
  9. Write or download the code at the following link
  10. Run code to see what it does in the simulator, maybe not much since you used extensions
  11. Plug in Micro:Bit using USB chord or connect for Bluetooth wireless programming
  12. Click settings gear, connect device
  13. Click download to run code on actual Micro:Bit
  14. Slider switch needs to be on 5V for 5V sonar
  15. Battery pack slider switch need to be ON
  16. Motor:Bit slider switch needs to be ON



Step 6: Enhancements

You can enhance your code by changing the pause times and changing the motor speeds to random numbers, figure eight motion, square motion, circle motion, proportional obstacle avoidance, proportional movement, and more!. You can also try other adventures with your Lily∞Bot and Micro:Bit by using the temperature sensor, buzzer, light sensor, touch sensor, accelerometer, compass and more! There are many examples on the MakeCode website.