View on GitHub

microbee

A MakeCode project

microbee

A Bluetooth-controlled robot built for the micro:bit platform with obstacle avoidance, custom motor control, environmental sensing, and intuitive remote operation.

micro:bit MakeCode License

🤖 Features

🔧 Hardware Requirements

micro:bit Pin Configuration

Component Pin Function
Motor Control    
Left Motor Forward P12 PWM Output
Left Motor Backward P13 PWM Output
Right Motor Forward P14 PWM Output
Right Motor Backward P15 PWM Output
Sonar Sensors    
Front Sonar Trigger P16 Digital Output
Front Sonar Echo P8 Digital Input
Back Sonar Trigger P1 Digital Output
Back Sonar Echo P2 Digital Input
Sensors    
UV Sensor P0 Analog Input
BME680 SDA P20 I2C Data
BME680 SCL P19 I2C Clock

Required Components

🚀 Quick Start

Installation

  1. Open MakeCode
  2. Import Project
    • Click Import then click Import URL
    • Paste: https://github.com/swiftwirt/microbee
    • Click Go to import the project

Basic Usage

  1. Power on your robot
  2. Pair via Bluetooth on your device
  3. Send commands using the control interface

📡 Control Commands

Simple Numeric Commands

Command Action Description
1 Forward Move forward (with obstacle detection)
2 Backward Move backward (with obstacle detection)
3 Spin Left Rotate left in place
4 Spin Right Rotate right in place
5 Turn Left Turn left while moving forward
6 Turn Right Turn right while moving forward
7 Turn Left Backward Turn left while moving backward
8 Turn Right Backward Turn right while moving backward
0 or any other Stop Stop all motors

Advanced JSON Control

For precise motor control, send JSON commands:

{"l": 512, "r": 768}

🛡️ Safety Features

📊 Status Indicators

The micro:bit LED matrix displays:

Icon Meaning
❤️ Bluetooth connected
💀 Bluetooth disconnected
⬇️ Moving forward
⬆️ Moving backward
⬅️ Spinning left
➡️ Spinning right
Obstacle detected
😊 Stopped and ready

🔧 Development

Project Structure

microbee/
├── main.ts          # Main orchestrator
├── config.ts        # Hardware configuration and constants
├── bme680.ts        # BME680 Sensor Driver
├── telemetry.ts     # Sensor data aggregation
├── datatransfer.ts  # Comms logic (chunking/checksums)
├── ble.ts           # Bluetooth event handling
├── motion.ts        # Motor control logic
├── sonar.ts         # Ultrasonic sensor logic
├── display.ts       # UI/Display logic
├── dispatcher.ts    # Command routing
├── state.ts         # Shared system state
└── test.ts          # Test functions

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📞 Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed information
  3. Include your hardware setup and error messages

Happy Making! 🚀🤖

Open this page at https://swiftwirt.github.io/microbee/

Use as Extension

This repository can be added as an extension in MakeCode.

Edit this project

To edit this repository in MakeCode.