Trimpot (or potentiometer) is a kind of common pressure adjustment components. In the following experiment, we are going to read output voltage on trimpot and display it on the micro:bit 5*5 LED screen with bar graph.

Components List:


**Tips: If you want to buy all components above, you may need Elecfreaks Micro:bit Starter Kit.**

Major Components Introduction


Trimpot is a kind of adjustable electronic components. It contains a resistor and a rotary or sliding system. When add an outer voltage on the two fixed contact spots of the resistor, the contact spot of the resistor can be changed by the rotary or the sliding system, a voltage with certain relationship with the place of movable contact spot is formed between movable contact spot and two fixed contact spots. Most of the time, it works as a voltage divider.

Experimental Procedure

Hardware Connection

Connect your components according to the picture below:

You would see as below after you finish the connection:

Software Programming

Click to open Microsoft Makecode, write the following code in the editor.

Program as the picture shows:

Details for the code:



You can also download the links directly below:


Rotate the Trimpot button, voltage value will be displayed on micro:bit in the form of bar graph. When voltage read is “0”, the LED screen display a pixel spot only. While the voltage becomes 3.3V, LED screen will be fully illuminated.


If we want to use Trimpot to adjust the brightness of a LED, how can we design the circuit and program?