Saturday, 6 August 2016

BBC Micro:Bit

As part of looking at the capabilities of the BBC Micro:bit Single Board Computer (SBC) I have put together the following using the Inventor's kit from Kitronic.


BBC Micro:bit (Display side)

BBC Micro:bit (Component side)

The board can be programmed from applications running within a web browser

The Inventor's board adds an easy interface for a breadboard and comes with 10 tutorials

Kitronik Inventor's kit
One of the tutorials in the kit is an experiment that lights different colour LED's as a capacitor charge as per the table below. The rate of charging can be varied using a potentiometer and there are two switches that enable charging or discharging of the capacitor.

LED
Charge capacity
Red
25% -> 50%
Orange
50% -> 75%
Yellow
75% -> 90%
Green
90% -> 100%

Capacity charging experiment
The experiment whilst fine as is, could be improved and here are my improvements.

Improvement 1 - Monitor discharge


The experiment is about charging, but if the circuit is left the charge leaks from the capacitor and the percent charge drops, however the current programme does not show this discharge and the LED's don't turn off until the second switch is pressed and the capacitor discharges.

I modified the supplied programme to reflect this allowing the monitoring of charging and discharge to take place.

Modified Touch Develop Script

Improvement 2 - Adding serial data


The first improvement is not exactly rocket science but adds an extra element in the experiment to demonstrate charging and discharging of the capacitor.

The BBC Micro:bit can output serial data to to a host PC via the USB connection. It requires a drive from mbed. The instructions can be found on the coding the microbit site

You must install a device driver (for the computer to recognise the serial interface of the micro:bit); then, you must also install a terminal emulator (which is going to connect to the micro:bit and read its output).

Follow the instructions at https://developer.mbed.org/handbook/Windows-serial-configuration to install the device driver.

ARMmbed are partners with the BBC on the Micro:bit project.

The connection from any terminal can be created using the following settings
  • Serial port : COM port that says “mbed Serial Port”
  • Baud rate: 115200.
Any terminal will then list the data being sent from the Micro:bit

Selecting serial port

Setting baud rate

Viewing the data
To get the Micro:bit to send the data a new application was written. Using the Code for Microbit site and the block editing tooling available on it, each time led.plotBarGraph is called, the value is also written to the serial output.

CapacitorChargeSerialSend application

If you are using Chrome their is an easy way to capture the data within the coding tool.

You can use the Micro:bit extension to get serial data streaming in the editor.

  1. Install the Extension for BBC micro:bit on the Chrome Web Store.
  2. Restart Chrome and open the web editor
  3. The serial data will show below the simulator

Microsoft Micro:bit extension

LogView

The log view will automatically start to collect and organize the data it detects. Simply click on the log view to open the various options to export the data. The simplest option is to download the data as a CSV file. This file can easily be opened in programs like Office Excel.

In the data export dialog, there is another option to upload the data to the Azure cloud. This allows to upload small amounts of data without any kind setup. The data can be accessed via web services or directly from Office Excel.


Captured capacitor charge / discharge curves

Hopefully this gives you a test of what can be achieved easily with the BBC Micro:bit.

I will be following up with other articles in the future on this single board computer

No comments:

Post a Comment