Micor:bit Environment Monitoring and Temperature-controlled Motor Fan
Introduction: Micor:bit Environment Monitoring and Temperature-controlled Motor Fan
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.
Supplies
* 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
Step 1: ​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.)
Step 2: 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.
Step 3: 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.
Step 4: 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. 832
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.
Step 5: 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 832