Skip to main content

iot:kit case03: An environmental quality monitoring station

Our goal

Let's make an environmental quality monitoring station.

Required materials

1 x IOT:kit

Background

What is the environmental monitoring

Environmental monitoringn Environmental monitoring is to design environemntal monitoring and display & save the collected information by using of GIS, it can also give a detailed analysis towards it's monitoring spot.

Hardware connection

As below picture, let the light sensor be connected to P1.

Let the BME280 module be connected to SCLP19 SDAP20 of the IIC.

Let the onboard RTC be connected to IIC.

Software

makecode

Coding

Step 1

Click on "Advanced" in the MakeCode Drawer to see more code sections.

We need to add an extension for coding to the IOT. Click on the “Extension” at bottom of coding drawer, then Search for “IOT” and click on the IOT package to add it to your project. (As below picture)

Note: If you get a warning telling you some packages will be removed because of incompatibility issues, either follow the prompts or create a new project in the Project file menu.

Step 2

Snap the initialize OLED in to the on start, initialize OLED screen pixels to 64*128.

Step 2

Snap the show string and show number blocks into the forever in turn.

Display current light intensity, humidity and temperature.

Then, snap into the insert newline.

Program

Program link:https://makecode.microbit.org/_ePDLFuUwqUhK

If you don't want to type these code by yourself, you can directly download the whole program from the link below:

Result

The light intensity, temperature and humidity are displayed every minute.

Think

How do you count the data in a day ?

Questions

More Information