1.Materials Required
micro:bit x 1
Nezha extension board x 1
Planet X – BME280 Sensor x 1
Planet X-OLED Display x 1
Planet X -Motor Fan x 1
16*32 Baseboard x 1
2*3 Bricks x 12
RJ11 Wires x 3
- Hardware Connections
Insert the micro:bit to Nezha extension board and connect BME280 and OLED display to IIC port on Nezha board with the RJ11 connectors, and then connect the Motor fan to J1 port.(You can see the color of the connection is the same with the equivalent port in the sensor you connect.)
- Bricks Building Up
Connect 2*3 bricks on the 16*32 baseboard as the picture shows.(Note: There are six bricks used in the right upper side)
Connect the devices on the baseboard through 2*3 bricks we just connected as the picture shows.
- Software programming
Go to MakeCode page:(https://makecode.microbit.org/#editor)
Add the Planet X entension and click extension on the menu of the settings.
Search with “PlanetX”in the dialogue box to add the package.
Go to the coding page to edit the program.
Programme to show an icon while on start.
In forever brick, programme to let the OLED display Hello,ELECFREAKS.
Display the temperature on the third line on the OLED display. Here we need to use the text brick in the MakeCode to show the text info and the detected value from BME280.
Now we program in a similar to to display the moisture, the air pressure and the altitude on the fourth, the fifth and the sixth line on the OLED screen.
Here comes to the part of making the motor fan controlled by the temperature. We use BME280 module to detect if the current temperature is no less than 30.
If the temperature is over 30℃, the motor fan drives to cool the environment, if it is below 30℃, the motor stops driving to save energy. (You can see the color of the connection is the same with the equivalent port in the sensor you connect.)
Link: https://makecode.microbit.org/_g2hXKLhHpEe9
- Result
The current moisture, temperature, air pressure and the altitude are displaying on the OLED screen. If the detected temperature is no less than 30℃, the motor starts driving the fan for cooling, or it stops driving to save the energy.