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.

This application is available for iOS and Android smartphones

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

Accelermeters 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:

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 celcius:

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

bitty data logger downloads

Get the app for Android

Get the app for iOS here

Follow the micro:bit tutorial for bitty data logger