BBC Micro:bit (Display side) |
BBC Micro:bit (Component side) |
- BBC's official site (https://www.microbit.co.uk/create-code)
- Microsoft PXT coding general site (https://www.pxt.io/)
- Microsoft PXT site for BBC Micro:bit (https://codethemicrobit.com/)
Kitronik Inventor's kit |
LED
|
Charge capacity
|
Red
|
25% -> 50%
|
Orange
|
50% -> 75%
|
Yellow
|
75% -> 90%
|
Green
|
90% -> 100%
|
Capacity charging experiment |
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.
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
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.
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.
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.
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
Selecting serial port |
Setting baud rate |
Viewing the data |
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.
- Install the Extension for BBC micro:bit on the Chrome Web Store.
- Restart Chrome and open the web editor
- 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