October 29, 2016

Data Logging with a microbit

Here is an example of how the BBC micro:bit can be used as a data logger. I was specifically interested in capturing the voltage of a LiPo battery as it discharged into a fixed load (so I could determine the capacity). I’ve also made a video of how this arrangement can be used to monitor the voltage on a supercap as it charges and discharges in a circuit.

Test Setup

The microbit has 6 inputs which can be used as Analogue to Digital inputs, including pins[0..2]. These sample voltages from 0V to 3.3V, returning the results as an integer from 0 to 1023. It is important that the inputs are not taken above the supply rail (as discussed on Electronics stack-exchange here) so I have used a series resistor (6k8 Ω, since that was the first I found). I use a 10k Ω potentiometer to adjust the full-scale reading to the maximum voltage that I need at any particular time.

Data Logger circuit

The source code can be found on github. There are two python scripts, one for the microbit which takes readings and sends them over the USB serial port when either the voltage changes or a couple of minutes passes. This is a trade-off between generating lots of data and capturing fast moving events. I have one LED flashing rapidly to give me some confidence that it’s not crashed and two set up to show a voltage readout as two analogue indicators.

On a windows PC (provided you have the mbed serial port driver) it should be easy enough to use a serial terminal application to save the data to a file. Since I’m using Windows 10 and the serial drivers are not always reliable, I use crouton on my chromebook (an Ubuntu chroot environment) where I can run python. Running the simple_log.py (as root) will guess the port name, dump the data to a file and copy it to the screen.

Here is a graph of the data captured in the video.

SuperCap charge profile


The charge phase is very rapid and it also shows that after running for a few minutes the unit seems to turn off (and the voltage stabilises again). This shows how it can sometimes be useful to monitor a circuit for minutes or hours to catch interesting events.

The noise on the plot is an artifact of my sampling algorithm, which captures positive peaks in noise, but tends to avoid negative noise peaks.  If I was using this again, I might re-think that sampling strategy.


Comments (0)

August 31, 2014

Heat Pump cost data, 2nd full year

My Hitachi Yutaki heat pump has been running for almost 3 years. I’ve made significant changes to the control logic with two external microprocessors, and have been logging data (manually and in real time). Whilst the system was a massive improvement compared with the old storage heaters/immersion heater (in terms of flexibility and control matching to heat load) the performance has been fairly disappointing from a technical point of view.

The Hitachi control logic seems optimised for steady-state operation into a load with a high thermal mass. Driving a small radiator based system it is always operating start-stop (even when there is a moderate heat load, the control logic tends to over-shoot in it’s heat output for the first 5-10 minutes of a cycle, by which time the loop is up to the trip point).

The controller will run the pump at 100% duty cycle unless the indoor temperature is clearly above the set-point. When the loop is cooling, this means heat is being pumped out to waste.

Switching between space heating and DHW is designed to run the space heating loop at a 60 degree setpoint for up to 20 minutes after the DHW target has been met. This means heating the whole space-heat circuit significantly, massive waste and inefficiency. For the communication between the two parts of the controller to function, DHW must be heated at 60 degree loop temperature)

The system was installed in November 2011. Degree days are referenced to 16 degrees outdoors (roughly the point at which domestic waste heat and insolation are insufficient to keep indoor temperature at above 20 degrees). In referring back to my post from 18 months ago, I see imeasure have (as part of website restructuring) changed the data reported for previous years (and now I see 2 different values for 2012 electricity on the site). Annual degree days is lost too. A once useful site decayed by a cute makeover… Wish I’d realised that before typing in 12 months of data this morning.

Total kWh
2010 7861
2011 9389
2012 6183 First full year
2013 5605 Better control functions

As a result of imeasure.org.uk changes, today post is void of useful data. Never rely on 3rd party providers…

I can in theory derive my own degree-day data, since I have 10 minute temperature data.

Comments (0)

December 6, 2013

Land of damp and rain

First published on http:houlihane.co.uk/blog, my trip to Iceland. Described by The Adventure Company as Land of Snow and Ice.

Day 0: Arrival

From Iceland, day 0 (Reykjavik)

I opted to book my own flights so that I’d be able to fly from Luton, and also to extend my trip by a day (so more chances to see the elusive Northern Lights and maybe catch up on any sites I’d missed). This meant quite an early start, but I was in Reykjavik and booked into my hotel by noon. It seemed that I was staying at a different hotel compared with the rest of the tour, but since it was an upmarket hotel, I wasn’t too bothered. Time to walk into town to find the main hotel, and luckily I took my camera since this was to be the only day of the week where there were clear skies over Reykjavik.

Once I reached the hotel shown on my joining instructions, it turned out that they (a) knew nothing of the tour I was looking for, and (b) did not feel they needed to pretend to be interested in my problem. Luckily, I found a tourist information centre which was open on a Sunday afternoon and they managed to contact the local tour operator and after a few calls back and forth, we located the guide who was preparing to drive to the airport and pick up the rest of the group. Luckily he was able to pick me up en-route. If the joining instructions had said ‘meet at the airport for a tour of the area before going to your hotel’, I’d have been able to save on the coach trip from the airport (although there isn’t a lot to do waiting at the airport for 4 hours). Further to this, It took me another 3 days to confirm that my extra day at the end of the trip really was in the same hotel as the rest of the trip (and the rest of the group).

Day 1: Reykjanes Peninsula & the Blue Lagoon

From Iceland, Day 1 (Reykjanes Peninsula)

Read more on Land of damp and rain

Comments (0)

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.