diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe2f152..4c14b72 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/README.md b/README.md index cfdb586..33a34a6 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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