December 29, 2016

Microbit Neopixel Christmas Tree

OK, so you’ve got your micro:bit RGB christmas tree from Andrew Gale’s kickstarter project. Its all soldered up ready to go as per his instructions but you’re not quite sure how to proceed.

First, use some croc-clip wires to connect the pads on the christmas tree to the pads with holes on the micro:bit edge connector. It is important to get the order right, and to avoid connecting also to the small pads between the main pads on the micro:bit. It doesn’t matter which colours you use, but normally 3V would be red, and 0V would be black.

  • Pin 0 to SOUND
  • Pin 2 to LED
  • 3V to 3V
  • GND to GND

Now you need some software. For a quick-start take this file directly from GitHub. Right click here and save-as (the file should be called tree.hex). Now plug your micro:bit into your PC, and copy the hex file to what looks like a flash storage device on your micro:bit. The yellow light should flash on the micro:bit as the file is transferred, this will take a couple of seconds. Now the program will start, and although the micro:bit display remains blank, the tree will have sound and light.

You can see the program (which is written in python) here on GitHub. We import both the neopixel module and the music module. These add extra functionality to the basic micro:bit, and they’re described here.

First, we initialise a neopixel on pin 2. This can drive several of the intelligent LEDs. They work in series over a single wire, and can be set to light each of Red, Green and Blue to different brightness. I am using 155 for each colour in turn which is a moderate brighness (255 is really too bright to look at safely).

Before starting to light the LEDs, we play the NYAN theme (non-blocking, so the program continues to run whilst the tune plays in the background).

We then cycle through all 5 LEDs and all 3 primary colours. Then we change the tune, and repeat.

Comments (0)

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)

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.

Close