Introduction: Micro:Bit Weather Station

A 2 min project (check the video), that builds you a weather station using Micro:Bit and xSW01

Step 1: Things Used in This Project

Hardware components

Step 2: Story

Build a weather station using the Micro:Bit and a couple of xCHIPs from XinaBox, the xSW01 Weather Sensor, and the xIM01 Micro:Bit Interface. You can easily modify the code to add other data from the Weather Sensor, such as Barometric Pressure, Altitude and Humidity.

Follow this 2 min video to see the complete project:

2 min video in normal speed showing the entire project!

Step 3: Assemble the Circuit

  • Click the IM01 and the SW01 together using an xBUS connector (from the XC10 pack). Make sure that the xCHIPs faces the same way up, so you can see the the SW01 name and the IM01 name both facing up. Make sure the connection is aligned, there is only 2 sides of the SW01 that fits the IM01, but you can use any of the IM01 connections.
  • Click the Micro:Bit into the IM01. Make sure the LEDs faces up - same way as the SW01 name and the IM01 name.
  • Attach a Micro-USB connection from your computer to the Micro:Bit. Notice the yellow LED on the bottom side turning on.

Step 4: Install Package

  • Open a browser and go to https://makecode.microbit.org
  • Scroll down to "Advanced"
  • Then Scroll down to "Add Package"
  • Search for "weather" and click on "weather-bit"

Step 5: Programming

  • Drag and drop code elements until you get something that looks like the image below.
  • You can also cheat and click on the "{ } JavaScript" button on the top and simply copy and paste the code in the code section below. Click on "Blocks" again to see the result.

Step 6: Flash and Test

  • Click on "Download"
  • Drag the downloaded file, typically named: microbit-Untitled.hex, to your Micro:Bit drive, typically named: MICROBIT.
  • See the result on the scrolling LED display.
  • Place a finger on the sensor to see the temperature go up ... hopefully!

Step 7: Code

Weather Station Code JavaScript
Simply copy and paste this code into the JavaScript editor in your browser.

basic.forever(() => {
    basic.showString("T:")
    basic.showNumber(weatherbit.temperature() / 100)
})
weatherbit.startWeatherMonitoring()