The Bitty Software Applications

Bitty Data Logger Bitty Controller Bitty Blue Bitty Audio Prank Bitty Xmas Bauble

Bitty Data Logger

With bitty data logger you can capture and chart accelerometer, magnetometer and temperature data from your micro:bit's internal sensors over Bluetooth. You can also capture and chart data from external, analogue devices connected to your micro:bit's pins. After capturing data, you can export it for analysis in a spreadsheet or other application.

After capturing data, you can upload it to the internet and then download the data to a desktop computer for analysis in, for example, a spreadsheet. Perfect for school projects!

The associated micro:bit coding tutorial will teach you how to send sensor data from your micro:bit to Bitty Data Logger running on a smartphone or tablet over Bluetooth.

Understanding accelerometer data

Accelerometers measure *acceleration* and express this as three values which we refer to as X, Y and Z. These values are "vectors" meaning they express both a magnitude (amount) and direction. In the case of the BBC micro:bit, with the micro:bit held flat with its LED display facing upwards and the edge connector facing toward you, the X value measures the amount of acceleration to the left and right of you. Y measures the acceleration in the direction away from you or back towards you whilst Z measures acceleration up or down. So X and Y describe acceleration in the two horizontal planes whereas Z measures acceleration in the vertical plane. Perhaps a picture would help :-)

The micro:bit uses values which are in multiples of one "milli-g" i.e. one thousandth of the acceleration due to gravity. Bitty Data Logger scales the values up to be relative to g itself.

Understanding magnetometer data

Magnetometer data is available over Bluetooth from the micro:bit in two forms.

Raw magnetometer data

In the first form, simply entitled "magnetometer data" in the Bitty Data Logger application, magnetic forces are expressed as a collection of X, Y and Z vector values very much like the data we can obtain from the micro:bit accelerometer. The vector values measure the strength of magnetic force in the following three directions:

X is the magnetic field strength in the direction of magnetic north
Y is the magnetic field strength in the direction of magnetic east i.e. 90 degrees from magnetic north
Z is the magnetic field strength vertically down
The strength of the force in a given direction and therefore the value of X, Y or Z is expressed in Teslas.

You can calculate the overall magnetic field strength from these values using a simple mathematical formula:
    sqrt(X*X + Y*Y + Z*Z)

Compass bearing data

It's also possible to obtain data which provides a 'bearing' measured in degrees from magnetic north.

Calibrating the micro:bit magnetometer

When you first power up your micro:bit after installing a hex file which supports magnetometer data over Bluetooth, you will be prompted to "draw a circle" by a message which scrolls across the display. Hold your micro:bit so that the display is oriented in the vertical plane and then slowly rotate it through 360 degrees. You should see a single LED pixel lit and it should move to the bottom of the display with respect to gravity. This strange process involves collecting both data about magnetic fields in the local environment and motion and results in your micro:bit being properly calibrated for use in that environment.

The magnetometer may generate strange looking data if used in an environment other than that in which the calibration procedure was performed. Motion may also affect magnetometer data. For best results, always reinstall the hex file and recalibrate in any environment in which you want to capture magnetometer data.

Working with external, pin connected devices

You can connect external devices such as temperature sensors, motion sensors, light dependent resistors and so on, to pins 0, 1 and 2 and bitty data logger will periodically sample values from those pins and chart the data over time. This is a great capability for science and engineering experiements and education.

Data from pin connected sensors can be charted in raw form or in millivolts or you can associate mathematical formulae with each pin and bitty data logger will derive the values to chart by evaluating your formulae live, as each data point arrives over Bluetooth. You make this choice in the Settings screen after connecting to your micro:bit and before you start capturing data.

Raw data

The micro:bit APIs include the getAnalogValue() function. It returns a value in the range 0-1023 and this is what's meant by "raw" data. In fact the reciprocal of the raw value represents a fraction of the maximum voltage, which in the case of micro:bit is 3.3 volts or 3300 mV.


You guessed it. If you select the millivolt format for a pin, the raw data will be converted into millivolts using the reference voltage from the Settings screen which by default is set to 3300 mV.


The raw data value for each selected pin is available in a variable called p0_raw, p1_raw and p2_raw for each of the pins 0, 1 and 2 respectively. If you select the Formula format, you must then provide an expression to be applied to the raw data acquired from that pin. Usually this expression will include the raw data variable for this pin.

For example, with a TMP36 temperature sensor connected to pin 0, the following formula will convert the raw data obtained by reading the pin value to a temperature in degrees celsius:

    ((p0_raw * 3300 / 1024) - 500) / 10

Bitty Controller

User Interface Options

On/Off Switches

Dual D-pad


Touchpad, Sensor Data and Button

Touchpad with multiple buttons


The 'bitty controller' app acts as a Bluetooth remote control for things connected to a device like a BBC micro:bit, Arduino or Raspberry Pi. Basically, you should be able to use any programmable micro-controller, developer board or computer which has Bluetooth Low Energy (LE) support inside or added to it in the form of an external module. 

Bitty controller gives you a choice of user interfaces too, so you can select a style of interface which is best suited to the machine you wish to control. Available interfaces include a classic dual d-pad game controller an analog touchpad, which gives you finer-grained control, an enhanced touchpad which can include data from up to 5 sensors and has an extra button, a version of the touchpad UI which can include up to 12 configurable buttons and.... a UI which provides 3 on/off rocker switches. In short, you should be able to find a control UI which is a good fit for your maker project.

We have ready-made example and template code for various device types in our GitHub repository.


micro:bit code should respond to Bluetooth communication from the bitty controller application as described in this section. How the micro:bit code needs to respond to communication from bitty controller will depend on the hardware the micro:bit is connected to. 

In all cases, micro:bit code must include the Bluetooth event service. This is included by default in  MakeCode projects. Event codes and values used by the D-pad and touchpad controller UIs are as follows:

Dual D-Pad Controller
Event Code Name Value Name Comment
1104 MES_DPAD_CONTROLLER_ID 5 MES_DPAD_BUTTON_C_DOWN left hand pad, left button down
1104 MES_DPAD_CONTROLLER_ID 6 MES_DPAD_BUTTON_C_UP left hand pad, left button up
1104 MES_DPAD_CONTROLLER_ID 7 MES_DPAD_BUTTON_D_DOWN left hand pad, right button down
1104 MES_DPAD_CONTROLLER_ID 8 MES_DPAD_BUTTON_D_UP left hand pad, right button up
1104 MES_DPAD_CONTROLLER_ID 9 MES_DPAD_BUTTON_1_DOWN right hand pad, top button down
1104 MES_DPAD_CONTROLLER_ID 10 MES_DPAD_BUTTON_1_UP right hand pad, top button up
1104 MES_DPAD_CONTROLLER_ID 11 MES_DPAD_BUTTON_2_DOWN right hand pad, bottom button down
1104 MES_DPAD_CONTROLLER_ID 12 MES_DPAD_BUTTON_2_UP right hand pad, bottom button up

Touchpad Controller

Event Code Name Value Name Comment
9011 TOUCHPAD_MOTION Coded direction and magnitude N/A value[0]
-ve=back +ve=forwards range:0-10.
0=no movement forwards or backwards.
1 to 10=forward speed (1=slowest, 10=fastest)
-1 to -10 backwards
-ve=left +ve=right
0-2=no movement left or right (deliberately less sensitive than fwd/bwd control)
+/- 3-8 gradually increasing turn
+/- 9-10 sharp turn
9012 TOUCHPAD_CONTROL value[0]=0 value[1]=1 TOUCHED Touchpad controller ball was pressed in central position
9012 TOUCHPAD_CONTROL value[0]=0 value[1]=0 RELEASED Touchpad controller ball was released

Sensor Values
These events may be sent by the micro:bit to Bitty Controller. The value field contains a 10 bit sensor value in bits 0-9 and a 3 bit sensor number in bits 10-12. The sensor value must be in the range 0-1023, with 0 representing the minimum value that sensor can deliver and 1023 the maximum. This allows sensor cells to be colour coded according to where a received value is in this range. Formulae which can be set from the ioptions screen can be used to translate these raw values into something more suitabled for display.
Event Code Name Value Name Comment
9014 SENSOR_VALUE 1 CONTROL_TARGET_1_ON Extra Button on enhanced touchpad pressed
9013 OTHER CONTROL EVENT 2 CONTROL_TARGET_1_OFF Extra Button on enhanced touchpad released
9014 SENSOR_VALUE Composite sensor number and value sensor number (bits 10-12) and sensor value (bits 0-9)

Other Control Events
Event Code Name Value Name Comment
9013 OTHER CONTROL EVENT 1 CONTROL_TARGET_1_ON Extra Button on enhanced touchpad pressed
9013 OTHER CONTROL EVENT 2 CONTROL_TARGET_1_OFF Extra Button on enhanced touchpad released
9015 SENSOR SAMPLING START EVENT 1 Instructs the micro:bit to start sampling from its sensors.

Bitty Blue

Bitty Blue is no longer available

Bitty Blue provides a collection of fun things to do with a BBC micro:bit (or compatible device) and Bluetooth. Play with 3D "PolySquiggles", use your micro:bit as a compass, have fun with the micro:bit's buttons, design patterns and send them or text to the micro:bit LED display. You can also monitor the temperature and get alerted if it gets too cold or too hot or just send messages from your micro:bit to your phone to be displayed. Lots of fun and educational too!
This application is available for iOS and Android smartphones.

Calibrating the micro:bit magnetometer

Note that with the standard bitty data logger installed on your micro:bit, you will need to calibrate the internal ditigal compass whenever your micro:bit starts. Follow the on-display instructions.

Bitty Audio Prank

With the 'bitty audio prank' app on your smartphone or tablet you can make it emit surprising and funny sounds just by pressing buttons on your micro:bit in various ways. Communication between the micro:bit and smartphone is wireless using Bluetooth so you could hide your smartphone in a room and have fun watching friends and family react when they hear unexpected sounds coming from unlikely places :-)

This application is no longer available

Bitty Xmas Bauble

Hang a micro:bit on the Xmas tree or somewhere else, equally festive and remote control LED animations and (with suitable hardware), Xmas tunes!

Bitty Xmas Bauble lets you choose from any of 6 LED animations and 3 Xmas tunes to have your micro:bit perform. For audio, you need a piezo speaker connected to pin 0 and GND or better still, we recommend using a Kitronik MI:power board which neatly holds a battery and has a pretty good audio chip built in. Here are details of the MI:power board.

You only need to connect your smartphone or tablet over Bluetooth to the micro:bit when you want to change what it's doing. The rest of the time you can just leave the micro:bit to get on with being amazingly Christmassy!

There's even an emergency stop feature built into the micro:bit software. Yes, we know that not everyone is quite as into Xmas as you are and that a quick way to stop that delightful Xmas tune might just come in handy. So we programmed the buttons on the micro:bit to stop the current audio and LED display immediately.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

micro:bit V2 - key information