Lily∞Bot With Micro:Bit and Motor:Bit Does Obstacle Avoidance
by carlottaberry in Circuits > Robots
261 Views, 3 Favorites, 0 Comments
Lily∞Bot With Micro:Bit and Motor:Bit Does Obstacle Avoidance
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
Primary components are the 3d printed parts available on GITHUB
Assemble the Lily∞Bot
There are three options to assemble the Lily∞Bot, select one of the choices below.
- Watch the YouTube video at this link to assemble the Lily∞Bot
- Read the document on GITHUB at this link to assemble the Lily∞Bot
- Complete the Instructable at this link to assemble the Lily∞Bot
MAKE SURE TO STOP BEFORE ADDING THE BREADBOARD AND ARDUINO UNO!
Attach the Motors to the Motor:Bit
- Use pocket screwdriver to open up screws on blue terminal block
- Attach right motor, BLACK to M2+ and RED to M2-
- Attach left motor RED to M1- BLACK to M1+
Attach the Battery Pack to the Motor:Bit
- Use pocket screwdriver to open up screws on blue terminal block
- Attach RED wire of battery pack to VIN on Motor:Bit
- Attach BLACK wire of battery pack to GND on Motor:Bit
Wire the Sonar to the Motor:bit
- Use female-female wire to attach VCC wire of sonar to 5V row on Motor:Bit (RED LINE)
- Use female-female wire to attach GND wire of sonar to GND row on Motor:Bit (BLACK LINE)
- Use female-female wire to attach TRIG on sonar to pin 13 on Motor:Bit (BLUE LINE)
- 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.
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.
- Go the MakeCode website at the following link https://makecode.microbit.org/
- Click New Project
- Click Extensions
- Type MotorBit
- Click Icon to add to project
- Click Extensions
- Type sonar
- Click icon to add to project
- Write or download the code at the following link
- Run code to see what it does in the simulator, maybe not much since you used extensions
- Plug in Micro:Bit using USB chord or connect for Bluetooth wireless programming
- Click settings gear, connect device
- Click download to run code on actual Micro:Bit
- Slider switch needs to be on 5V for 5V sonar
- Battery pack slider switch need to be ON
- Motor:Bit slider switch needs to be ON
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.