Skip to content

Commit

Permalink
Add more info about the project.
Browse files Browse the repository at this point in the history
  • Loading branch information
microbit-carlos committed Apr 26, 2024
1 parent c42d121 commit 369a3eb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Build default project using build.py
run: python build.py
- name: Upload hex file
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4
with:
name: build-py-${{ matrix.os }}
name: MICROBIT.hex
path: MICROBIT.hex
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
# BBC micro:bit V2 Battery Voltage Project
# BBC micro:bit V2 Battery Voltage Measurement

A C++ example project showing how to measure the BBC micro:bit V2 battery
voltage.

This project measures the input voltage, in millivolts, from the nRF52833
microcontroller and prints it on the display and serial.

A prebuilt hex file can be download from the
[GitHub Releases page](https://github.com/microbit-foundation/microbit-v2-battery-voltage/releases).

A similar example for micro:bit V1 can be found in:
https://os.mbed.com/teams/microbit/code/microbit-battery-test/

## How is the battery voltage measured

To measure the micro:bit battery voltage, the nRF52833 (the target MCU)
microcontroller ADC is used to measure its Vdd input voltage.

All the ADC channels are currently used for the Analogue pins and the on-board
microphone, so for this project we hijack the ADC channel used for P0 and
microphone, so for this example we hijack the ADC channel used for P0 and
re-route it to the internal Vdd (voltage from the microcontroller power input).

It's important to note that there are two protection diodes and a voltage
regulator between the battery connector and the microcontroller Vdd pin,
as can be seen in the
[micro:bit open source schematics](https://github.com/microbit-foundation/microbit-v2-hardware).

So, there is a voltage drop on these components that will vary on different
factors, like the current load and component temperature.
Through some of the micro:bit testing we measured this voltage
drop ranging from 210 to 300 mV (measured without any additional
load on the micro:bit power supply).
However, these values should not be considered definitive,
as they may further fluctuate under different conditions.

## Building the project

### Dependencies
Expand All @@ -15,8 +42,9 @@ re-route it to the internal Vdd (voltage from the microcontroller power input).
- [Git](https://git-scm.com)
- [CMake](https://cmake.org/download/)
- [Python 3](https://www.python.org/downloads/)
- [Ninja Build](https://ninja-build.org/) (only needed on Windows)

For example, on Ubuntu:
For example, to install these dependencies on Ubuntu:

```
sudo apt install gcc
Expand Down

0 comments on commit 369a3eb

Please sign in to comment.