Introduction: Raining Alarm Module

About: Email: louise@elecfreaks.com

Micro:bit is an educational product put forward by British Broadcasting Corporation (BBC), which aims to help young people to learn basic programming knowledge.

BBC micro:bit has rich board carrier resources such as button, 5*5 LED dot matrix, gyro, Bluetooth module, etc.. It is portable with only half size of a credit card. Maybe it is for keeping board size small, all IO ports on it do not lead to pins like Arduino . Today we are going to show you a small case to connect all pins on micro:bits with a breakout board.

Note:
For more funny creation, you can pay attention to : http://www.elecfreaks.com/

Our product store: http://www.elecfreaks.com/

Step 1: Introduction

Micro:bit is an educational product put forward by British Broadcasting Corporation (BBC), which aims to help young people to learn basic programming knowledge.BBC micro:bit has rich board carrier resources such as button, 5*5 LED dot matrix, gyro, Bluetooth module, etc.. It is portable with only half size of a credit card. Based on micro:bit, we produced raining alarm module to test raining condition. This module connects all pins on micro:bits with a breakout board so that it can show raining level with light and sound.

Step 2: Hardware and Software Preparation

Hardware:
Micro:bit X1

Breakout Board X1

Raining Sensor Module X1

Passive Buzzer Module X1

LED Module X1

Dupont Cable X3

USB Cable X1

Software:

Java Script Blocks Editor (Here’s the link: https://makecode.microbit.org/# )

Step 3: Component Assembly

First, you have to plug breakout board we prepared onto micro:bit board.
Second, connect raining sensor module, passive buzzer module and LED module to breakout board with 3 dupont cables.

The bottom base of pins on breakout board has 3 different colors. Black stand for GND, red for VCC, yellow for signal. These colors are completely relative to the color of dupont cable. You can connect cables according to the relative color as well. Or you can refer to the column below.

Relative Connection:
P0-- Passive Buzzer Module

P1-- Raining Sensor Module

P2-- LED Module

Step 4: Programming

After these modules are connected to the breakout board, we can move forward to the next step--Programming.
Now click this link: https://makecode.microbit.org/# to open the interface of programming.We are going to use Block method to start our programming.
Please note: The output of raining sensor module is analog signal and its correspond value read out by micro:bit is 0-1023. In this case, 0 for no rain, 1023 for pour rain. Bigger value stands for heavier rain. Now we set the threshold value as 200. If the value on P1 port tested beyond 200, then it is raining and we can see a sign of umbrella on LED screen of micro:bit. At the same time, buzzer will alarm with music.

Step 5: Whole Code

If you know how to set threshold value, we can go on complete our program. As for the whole program, you can refer to the picture above.

Once completed programming, connect micro:bit board to your computer with a USB cable. Click “Download” button to download the code into “MICRO:BIT” under “My Computer” .

After we downloaded the code to micro:bit board, it will start to run the program automatically. Now pour some water on the raining sensor module to analogue raining effect. Let’s do it and take a look!

Note: You can download the HEX file of code here:

https://makecode.microbit.org/_ikDgLV3fgWAW

Note:
For more funny creation, you can pay attention to : http://www.elecfreaks.com/

Our product store: http://www.elecfreaks.com/