Microsoft MakeCode

Micro:bit Help DFRobot IoT?

I have this new IoT board by DF Robot: Micro:IoT and I have this code from the Github repo. Does anyone know how or what entries should be made in the blocks to make it work ? Thanks:

Hi Frank,

I’ve done things like this before (with AdaFruit IO), but not this particular device/service, so I can’t provide much more insight than the following:

It looks like the extension goes through your home Wi-Fi (so it needs your Wi-Fi access point name in the “yourSSID” and the corresponding password for “yourPassword” in the setup Wi-Fi block).

The mqtt blocks use DF Robot’s MQTT server, so you’ll need to create an account at: MQTT is a pretty popular way of sending message back-and-forth between IoT devices…It can be used to have a web service, like a webpage “dashboard”, interact with devices (micro:bits) or have devices talk to one another via the MQTT broker. Here’s a video with a quick introduction to MQTT: An Introduction to MQTT for Beginners.

After creating the account on you can “add a device” and create an IoT_id(user) and IoT_pwd(password) to use with devices. I think these are what you’d add to the MQTT:IoT setup mqtt block’s user/password fields. This will then allow the MQTT Send Message ... blocks to post messages to that topic. If successful, the message should be visible somewhere on the “dashboard” of your account. And you should be able to use the dashboard to send messages back to the device.

It looks like the extension could also work with other internet services (rather than DFRobot’s MQTT server): ThingSpeak and BeeBotte. With either you’d create an account on their service and they’d provide a “key” (password) used to interact with their service, which you’d use in the “key” field of the corresponding block. You then post messages which are relayed to your on-line dashboard on the service. I’ve used ThingSpeak a bit and it may be easier to use than MQTT.

If you want to try MQTT, I’d suggest:

  1. Have the Micro:IoT setup Wi-Fi in setup (like in your example, but add in your Wi-Fi access point name and password)
  2. Create an account at DF Robot and add a device and then generate the user name / password (these are different from the user name and password you use to create the account!)
  3. Have the Micro:IoT setup mqtt block after the Wi-Fi setup and add in the user/password created in the previous step.
  4. Have an on button A block that posts a message to a topic via the MQTT Send Message block.
  5. Have an MQTT on ... received block that will display the message (the message variable from the Variable menu) on the screen via a show string block.
  6. Program the device.
  7. Try pressing the A button to send an MQTT message to DFRobot. Look around your dashboard on your DFRobot account to see if you receive the message. Maybe try to send one back (to that it scrolls across the microbit screen).

Good luck!

thanks, Bill,
by the way, I now have your Mbit app working with Microbit V2 and TWO (2) motor-drivers by different companies On the same Microbit with the same MakeCode program and with iOS and Android . I’ll make a video. DF Robot Micro Maqueen and Kittenbot Robotbit, 1 Microbit V2, drives both bots , same MakeCode code and same Mbit app. on both smart phones.
I’ll try your above suggestions and report back.