🎃Happy Halloween Sale🎃Get 12% Off For All Order

How Micro:bit Works With Octopus???We Made A Raining Alarm Demo

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
images
Children’s Programming Education is the Future Trend
images
Technical verification! Nezha series products can complete WRO competition tasks
images
Let's take part in the Ceremony of the New Factory of ELECFREAKS together!
images
Bluetooth Bee(HC-05 and HC-06) User Guide
images
In March, ELECFREAKS supported 5 schools to carry out school science and technology festival activities
Monthly Archive