Posts

Low-cost solar power source for microbits

Image
  Solar panel, microbit, battery and regulator Update I have made a few improvements since this post was published in September 2022: The key change is to use a   separate low-dropout regulator (LDO) to provide the 3.3V supply to the microbit and other components. I had previously used the microbit's internal regulator. I found subsequently that it has a curious high-current region as the battery voltage drops, which leads to a period of rapid battery discharge.  AA rechargeable cells, with 1200 mAh capacity, replace the previous AAA 850 mAh cells I use a 2W solar panel and a smaller current limit resistor, so that I can get a higher charging current I added a PNP transistor to the output of the TL431 shunt, so that it can handle more than 100 mA These changes do add a little to the overall cost, but they do give more reliable operation under a wide range of solar input. Introduction This article describes a low-cost DIY solar power source which is aimed at school...

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...