Posts

Microbit WiFi weather station

Image
Introduction  This is a microbit project aimed at junior schools. It allows you to:  make regular readings of things you can measure electronically (such as  air pressure  and  temperature ) upload  those readings automatically via WiFi to a free  web service  ( ThingSpeak ) where you can store readings, and display the readings as a chart, for example It features: low current consumption (typically 2.2 mA average) easy set-up of your readings at ThingSpeak easy assembly of the parts  It evolved from some of my previous projects: a  Microbit weather station  for example, which used a pair of microbits to upload readings to a laptop or similar.  I've used a few good articles on the web to get this project running (see the Further reading section). The design is really quite simple and easy to use. No human intervention is required to upload the readings, and a Real Time Clock isn't needed as ThingSpeak records the date & t...

Microbit with an external ADC

Image
Update 4 Sept 2022: I found that the ADS1115 code below works fine when you are reading one channel. But when you are reading more than one channel (i.e. switching from one to the other) you can easily get a wrong reading. The reason behind this is described on a TI forum here . Briefly, you need to have a delay between setting the ADC channel and reading the conversion result. I have written an unpublished MakeCode extension which adds simple blocks and handles this delay. It can be used by pasting its Github location into the MakeCode Editor's "add extensions" search bar. Introduction This post shows how you can connect up a low-cost external ADC to a microbit using the I2C bus. The ADS1115 ADC has 4 channels and an on-chip voltage reference. Example code is provided for Micropython and MakeCode/JavaScript. Background The microbit includes an ADC, but it has limited usefulness for measuring voltages - particularly if you want to monitor the microbit's supply voltag...

Microbit ADC Logger

Image
Introduction This is a simple data logger that reads and logs the voltage on the microbit pins P0 , P1 and P2 every hour. It stores the reading as a text string together with the date and time of each reading. The date/time is kept by a DS3231 Real Time Clock (RTC) board. The readings can be uploaded to a device using the microbit’s USB. An example reading: #count = 3 17/06/2022 11:00,3.28,0,0 17/06/2022 12:00,3.28,0,0 17/06/2022 13:00,3.28,0,0 To allow the measured voltages to be greater than the nominal supply microbit voltage (3.3V) two external resistors are used to divide the measured voltage so that the pin voltage V(Pn) does not exceed 3.3V. The scaling in the code assumes external resistors of 270 kΩ from input to Pn and 330 kΩ from Pn to ground. So full scale is 6.0V . Other ratios require code change. The ADC voltage reference is the microbit “3V” supply (nominally 3.3V), so if the supply drops below this then the ADC readings will be wrong. It is possible to change the...

Microbit radio weather station

Image
I've built a couple of microbit weather stations in the past; the last one used Bluetooth to upload readings to a laptop for further processing. This one is aimed at younger students and uses the microbit's built in radio , which is a bit easier to code. The sender microbit records weather readings every hour or so (your choice). To upload the readings, to make a daily chart or graph perhaps, we use a second receiver microbit to fetch the readings. They can then be sent via USB, or some other means, to a laptop or phone. So the sender can be untouched and in a fairly inaccessible place (depending on the radio range, of course). Powering the sender I didn't want to use non-rechargeable cells, so I tried a power bank . This is a high-capacity rechargeable battery which is normally used to supply energy to a phone. It has some clever circuitry which, among other things, disconnects the battery from its load when the load current has dropped. Power bank But - this particula...

Microbit power bank

Image
Powering microbits outdoors isn't easy: dry cells have quite a low capacity. Typically a microbit battery of 2 AAA cells can provide around 500 mAh, which might power a weather station for a couple of days. Another solution is a power bank. These are rechargeable batteries that are aimed at the mobile phone market - to keep your phone battery topped up.  They are charged from a mains charger  via a USB input port, and deliver 5V from a second port. The one I'm using is an Apachie 5200 mAh , which is available for around £8. It's the size of a typical phone. Power banks are intended to give your phone 's battery a boost - not to power some electronics which need a continuous supply! So they come with a means of testing if the load has been disconnected; the power bank can then switch off its internal circuits to reduce power wastage. This power bank does that by switching off for a short time (about 500 ms), every 5 seconds or so. That will cause the microbit supply to c...

Rain gauge 2

Image
 Rain gauge 2 Update : I've added a chart showing an actual day's recording. A while ago I made a rain gauge based on measuring the resistance of rainwater.  This is an improved version: it should be more accurate because it measures the weight of the water collected in a tank over a given time. The weight can be converted to the depth of rain falling in a given period by simple arithmetic. The diagram below shows the scheme - rain enters the tank which is weighed periodically. When the tank is "nearly" full it is emptied, and the scales are reset. The overall arrangement Lengthy experiments with an electrically operated water valve were not successful! But a submersible pump does work quite well; provided the water tank side wall is quite low we can keep the settling time short. We are using an electronically controlled  pump . So no manual intervention is needed, and we should be able to have an unattended rain gauge! Ideally the process of emptying the tank shou...

Microbit weather station

Image
 Microbit V1 weather station Update: Feb 2021: I've published the microbit V2 version using Bluetooth (BLE) Update 7th Jan 2021 : I've found an error in my DS3231 extension, so now it is feasible to use the microbit's Bluetooth (BLE) - which means the second microbit won't be necessary. And I fixed my Google Apps Script code for the chart! This project lets you make regular hourly readings of weather measurements, store them, and upload them to a phone or computer. The date and time of each reading are also recorded. You can use the readings to plot a chart, for example, to show how the weather changed over time. Here's a set of readings over 24 hours: These are the measurements I am using for this project: Barometric air pressure Temperature Humidity You can add more "instruments" - for example, I plan to add a home-made rain gauge, as described in this blog. The weather station can be self-contained, powered from a couple of batteries perhaps. You can...