Example Code for micro:bit-MakeCode-Record the data of the Soil Moisture (Beebotte)

Create a channel-humidity and time table. When connected with Internet, the moisture will be updated to Beebotte platform, and we will check the change of the moisture through the curve graph in Dashboards.

Hardware Preparation

  • micro:bit board: Quantity 1
  • Micro: IoT expansion board: Quantity 1
  • Soil moisture sensor (P1): Quantity 1
  • Beebotte platform access: Quantity 1

Software Preparation

Wiring Diagram

  1. Connect the soil moisture sensor to P1 of the Micro: IoT expansion board.
  2. Plug the micro:bit board into the Micro: IoT expansion board.

Other Preparation Work

    1. Enter Beebotte website, register an account: https://beebotte.com
    1. Back to Homepage and click Get Started For Free.
    1. Enter Create New Interface to create your Channel Name (e.g., humidity), Channel Description, Resource name, Resource Description.
    1. Click Account Settings->Access Management to check the API Key and Secret Key.
    1. Create Dashboards to check the history of the update value (create time table).

Sample Code

Makecode Programs: Record the data of the Soil Moisture

Result

enter Dashboards, click humidity check the data.

Additional Information

Note: IoT_id should be API Key; IoT_pwd should be Secret Key; TOPIC is the name of Channel/Resource, there is a / between them. Chose Beebotte as the server in the Program.

Was this article helpful?

TOP