DIY electronicsNew ProductNews

How Micro:bit works with octopus? We made a Raining Alarm demo

By July 14, 2017 No Comments
QQ图片20170714201305


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.

1
(Picture 1)

In the following case, we will use micro:bit( breakout board connected) to produce a raining alarm module.
Requirement
When micro:bit senses raining,it will alarm with light and sound.
Materials
Micro:bit                  ×1
Breakout Board            ×1
Raining Sensor Module     ×1
Passive Buzzer Module     ×1
LED Module               ×1
Dupont Cable              ×3

(Picture 2)

IO Connection:
P0 connect to passive buzzer module;
P1 connect to raining sensor module;
P2 connect to LED module.
Note:Here, “P” stands for Pin.
You can refer to the following picture for IO connection:
3

(Picture 3)

Note: The bottom base of pins on micro:bit 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.
Programming:
After we completed cable connection, click this link: https://makecode.microbit.org/ to open programming interface. We are going to do programming with Block method.
Here we have to note that 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. You can refer to the following picture (picture 4) for how to set threshold value.
4

(Picture 4)

As for the whole program, you can refer to the following picture:
5

(Picture 5)

After we download the code to micro:bits, 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!
You can download the HEX file for this case here:
Question
If we want to divide raining to several levels like small rain, middle rain and pour rain and show it with different light and sound, then how to program? Your further discussion is welcomed!

For more details, you can refer to our User Guide.

VN:F [1.9.13_1145]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)
How Micro:bit works with octopus? We made a Raining Alarm demo, 10.0 out of 10 based on 1 rating