Weather Station, With a Shake!

by dsberman in Circuits > Electronics

12 Views, 0 Favorites, 0 Comments

Weather Station, With a Shake!

20180119_114747_S1PtvZO17w.jpg

Create your own shake controlled weather station with the help of this tutorial in under 5 minutes!

Things Used in This Project

Hardware components

Software apps and online services

Story

About The Project

This project can be completed in under 5 minutes. This tutorial will show you how to build the Weather Station using no tools. The code for this project is simple using Micro:bit's drag-and-drop platform.

Introduction

I built this Weather Station using the Micro:Bit and a couple of xChips from XinaBox. It is a very simple and quick build. The XinaBox technology made this project extremely easy to do by eliminating the need for soldering and tools. The Micro:bit interface allows me to program easily. You can easily modify the code to add other data from the Weather Sensor, such as Barometric Pressure and Altitude.

Assemble the Circuit

  • Click the OD01 and SW01 together using a xBUS connector (from the XC10 pack).

Figure 1: Connected SW01 and OD01

  • Click 2 xBUS connectors to the left side of the IM02 then click on the connected SW01 and OD01. Make sure that the xChips faces the same way up, so you can see the SW01 name and the IM02 name both facing up.

Figure 2: Connected SW01, OD01 and IM02M

  • Use another xBUS connector to connect the MD01 to the PB04. Set aside the connected PB04 and MD01 with 3 xBUS connectors and the AA batteries.
  • Click the Micro:Bit into the IM02. Make sure the LEDs faces up - same way as the SW01 name and the IM02 name.
  • Attach a Micro-USB connection from your computer to the Micro:Bit. Notice the yellow LED on the bottom side turning on.

Install Package

  • Search for "weather" and click on "weather-bit" to add the package
  • Repeat points 2 and 3
  • Then paste this URL into the search bar : https://github.com/xinabox/pxt-OD01 then click on OD01 to add the package

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 into the code section below. Click on "Blocks" again to see the result.

Flash and Test

  • Click on "Download"
  • Drag the downloaded file, typically named: microbit-Untitled.hex, to your Micro:Bit drive, typically name: MICROBIT.
  • See the result on the scrolling LED display and OLED screen.
  • Place a finger on the sensor to see the temperature go up ... hopefully! If it doesn't retrace your steps until you find the problem and correct it.
  • Shake the unit to see if the humidity reading appears as instructed in the code.

Complete Weather Station

  • Disconnect the micro:bit from the Micro-USB connection.
  • Insert the AA batteries into the PB04
  • Use the 3 xBUS connectors to connect the PB04 and MD01 to the IM02 and SW01 as seen in the picture below.
  • Turn the switch on the PB04 on.
  • Now your Micro:bit weather station is portable and ready to be controlled via motions you input.

Building the project.

Code

Motion controlled Micro:bit weather station JavaScript
This is a code example for the Micro:bit motion controlled weather station using the XChips from Xinabox. This is in the JavaScript format. You can convert this to blocks by copying and pasting it into the { } JavaScript tab in the Micro:bit webpage @ https://makecode.microbit.org/

input.onGesture(Gesture.LogoUp, () => {
    OLED.showString("Temperature")
    basic.showString("T:")
    basic.showNumber(weatherbit.temperature() / 100)
    OLED.showNumber(weatherbit.temperature() / 100)
})
input.onGesture(Gesture.Shake, () => {
    OLED.showString("Humidity")
    basic.showString("H:")
    basic.showNumber(weatherbit.humidity() / 1024)
    OLED.showNumber(weatherbit.humidity() / 1024)
})
basic.showString("Wether Station")
weatherbit.startWeatherMonitoring()
OLED.init(64, 128)