Example Code for MakeCode-Alcohol concentration detector(Based on BeeBotte)

In this tutorial, we will simulate a smart alcohol monitoring system. An alcohol concentration sensor installed in a vehicle uploads real-time data to the Beebotte platform. By monitoring the uploaded values, users can identify vehicles with alcohol levels exceeding a predefined threshold (for example, 800 as an assumed drunk-driving limit). This demonstrates how IoT technology can be used to remotely monitor data and improve efficiency in real-world applications.

Hardware Preparation

  • MBT0039 micro:bit board x 1
  • MBT0008 IO Extender for micro:bit x1
  • SEN0128 Analog Alcohol sensor x1
  • WiFi IoT module x1
  • Wires

Software Preparation

This section mainly introduces how to use the WiFi IoT module and how to program it using MakeCode.

MakeCode Programming Platform:
https://makecode.microbit.org/

I2C Library:
MakeCode I2C Library – DFRobot WiFi IoT

Wiring Diagram

How to use BeeBotte

Open BeeBotte website: https://beebotte.com/login. Register an account and log in.

8-1

Enter the following interface when logged in. Click "Create New" to create a new channel.

8-2

Write in the corresponding Channel name and resource according to the tip.

8-3

Click "Create channel" to build up your own BeeBotte Channel.

8-4

Check the channel token in the created channel of BeeBotte.

8-5

Sample Code

Program Link

https://makecode.microbit.org/_8PbTJAFPL2CH

Program Blocks

8-7

Result

Check the alcohol concentration on the corredsponding channel in BeeBotte.

8-8

Turn the received data into line chart, table, etc

8-9

Was this article helpful?

TOP