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!

Forward Education's Solar Panel attached to the Energy Sensor and breakout board.

Prepare

You’ll need the following items to complete this project:

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.