Visualize Electricity Flow with a Current Monitor
In this project, you’ll build a monitor that measures the current (the flow of electricity) generated by your solar panel. You’ll then convert this measurement into a visual display on your micro:bit, showing you how much electricity is flowing in real-time!

Prepare
You’ll need the following items to complete this project:
- Smart Solar Energy Kit
- micro:bit V2
- Computer with access to Microsoft MakeCode
Build
First, let’s set up your solar panel and energy meter:
Code
For this project, you have two options for coding. You may download the completed code or follow a step-by-step tutorial to code from scratch:
- Download
- Tutorial
Explore the code below to get started with your current monitor:
- Connect your project to the computer and download the code to make it work.
- Review the code comments on each block to learn about how your solar data logger works, then try testing it in real life.
Improve
How would you modify the sample code provided, or create your own code that includes the following features?
- Adjust Sensitivity: Change the current thresholds in the
if/else if
statements. How does this change the sensitivity of your display? - Add Sound Feedback: Make the micro:bit play a different sound effect for each level of current (e.g., a low tone for low current, a high tone for high current).
- Display Exact Current: Add a button (e.g.,
on button A pressed
) that, when pressed, temporarily shows the exact numerical current reading on the micro:bit’s displays.
Feeling Stuck? Explore the Knowledge Base for common questions and troubleshooting tips.