DF Robot micro:Maqueen Robot
For BBC Micro:Bit (programmed with the Arduino IDE)
Sep 10, 2018
- Arduino IDE 1.8.x (recommend 1.8.5) installed and setup for your machine. https://www.arduino.cc/en/Main/Software
- Install the Arduino-nRF5 board core. Follow the instructions here: https://github.com/sandeepmistry/arduino-nRF5
- Install the Adafruit Micro:Bit Library: https://github.com/adafruit/Adafruit_Microbit and learn more about it here: https://learn.adafruit.com/use-micro-bit-with-arduino
- Finally install the arduino-BLEPeripheral library (either from the library manager or by following instructions here: https://github.com/sandeepmistry/arduino-BLEPeripheral ) * Note be sure it’s the one from sandeepmistry if you are using the library manager *
- SparkFun Mag3110 Compass library. https://github.com/sparkfun/SparkFun_MAG3110_Breakout_Board_Arduino_Library
- NewPing Library (Which I believe is this library) https://github.com/eliteio/Arduino_New_Ping and is only needed if you are going to use an ultrasonic.
For this project you will need at least one Micro:Bit Controller:
And the Maqueen Robot chassis: https://www.dfrobot.com/product-1783.html
The Micro:Bit is setup to use Microsoft:MakeCode or Scratch and Python.
The Sandee P Mistry Board core lets us use this board with the Arduino (C style) language as well.
I used the general information that is found either in the Maqueen MakeCode library on the board itself, or from trial and error to come up with something that works (mostly) with the Arduino IDE.
https://www.dfrobot.com/wiki/index.php/Micro:Maqueen_Robot_Car(V2.0)_SKU:_ROB0148#Ultrasonic_Obstacle-avoiding and the library here:
Working (or mostly working):
- Motors (I2C interface, easier to port than I thought it would be)
- Line Sensors (P13, P14)
- Ultrasonic (using newping library) P1, P2 * Attempted to get this working without the library, but it failed (????) *
- 2 LEDs P8, P12
- Buzzer P0 - * tone is not yet implimented with the board, analogWrite works but doesn’t sound great, bit bang also works, but doesn’t sound great - this is in the mostly working columb)
What’s not working: (These things work if you use MakeCode, but so far I’m unable to get them to work with Arduino).
- NeoPixels (P15 4 pixels) - The Adafruit Neopixel library appears to be the only library that supports the Micro:bit, this isn’t surprising. But I’ve not been able to get it work on P15, it does work on P2 which is what the example provided is using. https://learn.adafruit.com/micro-bit-lesson-3-neopixels-with-micro-bit/software
- IR receiver (P16) - so far I am unable to get this to work at all - *I need something that doesn’t mess with interrupts or timings, but I think that is a big ask for this device*
- Communication between two Micro:bit controllers - It’s a bit upsetting to me that such a basic thing was neglected in the Arduino IDE (If this does work, and you have supporting code please share - I have not been able to get this to work, or find any code that claims it works) ** This is a basic thing in the MakeCode, I’ve not been able to find the library they use or information about how they make it work ** https://learn.adafruit.com/micro-bit-radio-controlled-puppet/code-the-two-micro-bits
- It should be noted here that I am able to connect a Micro:Bit to a Android tablet and send and receive information using that. But It has to use the Adafruit Bluefruit LE Connect app to do it - https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect
Basic Sketches: (To be duplicated)
- Drive and turn - (done) I2CMotortest, I2CMotortest2
- *RGB Breathing Ambient Light - unable to complete at this time.
- LED Light Flash - (DONE) - blinkdemo
- Read Ultrasonic Distance (*DONE*) - They output to the LED Matrix, I output to the Serial console of the Arduino IDE (Easy to change as needed) newping
- *Read Infrared Key Assignments - unable to complete at this time. *
- *IR Remote Control - unable to complete at this time*
- Line Tracking - Currently Working on it.
- Ultrasonic Obstacle Avoiding - (DONE) - avoid
- Light Operated Sprite (unsure about this one)
- Wireless Remote Control - * They are using a Micro:bit Gamepad (see below), I believe I can make this work with the Tablet and Adafruits Bluefruit LE Connect software * This is a work in progress.
The compass and accelerometer on the Micro:bit also work, as well as the LED Matrix and the two buttons on it. *The Compass is in the wrong orientation to be used as a true compass, but it maybe able to be used to do relative positions, I will have to test that more.*
I am in the process of making a library and attempting to duplicate the applications in the DF Robot wiki. It is not even close to being ready. I’ll post a link when it is ready.
DF Robot also provided a Micro:Bit Gamepad for use with this project, the gamepad has 8 buttons total (various P#s), a LED on P16, buzzer on P0, and a vibration motor on P12
DOWN - P13
LEFT - P14
UP - P8
RIGHT - P15
X - P1
Y - P2
A - P5
B - P11
This was very easy to port over to the Arduino IDE, the buttons are all HIGH until they are pushed then they go LOW.
I may not be able to use this as intended because I am having problems getting two Micro:bit to communicate directly with each other.
A game or something may be coming thou...we will see