Introduction: Micro:bit Experiment 03: Trimpot —— Elecfreaks Mirco: Bit Starter Kit Course

About: ElecFreaks is an open design house founded in March 2011. Our goal is to create rapid prototypes and give small-batch manufacture solution for makers and startups. With over 50% staff as engineers and expanded…

Trimpot -Trimmer Potentiometer is a kind of common pressure adjusting components. In the following experiment, we are going to read output voltage on trimpot and display it by Micro:bit 5*5 LED screen with bar graph.

Step 1: Component List

Hardware:

1 x Micro:bit Board

1 x Micro-B USB Cable

1 x Microbit Breadboard Adapter

1 x Transparent Breadboard - 83 * 55 mm

1 x 10K Trimpot

1 x Breadborad jumper wire 65pcs pack

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

Software:

Microsoft Makecode Inline Editor

Step 2: Major Components Introduction

Trimpot

Trimpot is a kind of adjustable electronic components. It consists a resistance and a rotary or sliding system. When add an outer voltage on the two fixed contact spots of resistance, by changing the place of contact spots on resistance with rotary or 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.

Step 3: Hardware Connection

Please complete hardware connection according to the picture below.

After connection, you will see:

Rotate trimpot button, then output voltage will change from 0V to 3.3V as with the rotation of the button.

Step 4: Programming

Open Microsoft Makecode, write code in edit window. I suggest you program by yourselves first.

Of course, you can see the whole complete program in the link below. Just click "Edit" on the right top corner, then click "download" to download code into Micro:bit.

Step 5: Code Explanation

plot bar graph

Displays a bar graph of the numbers you say. A bar graph is a kind of chart that shows numbers as lines with different lengths.

analog read

Read an analog signal (0 through 1023) from the pin you say.

Step 6: Experiment Result

Rotate trimpot button, voltage value will be displayed on Micro:bit 5*5 LED screen with bar graph. When voltage read out to be "0", LED screen display a pixel spot only. While the voltage becomes 3.3V, LED screen will be fully illuminated.

Step 7: Question

If we want to use trimpot to adjust the brightness of a LED, then how to design circuit and program? Your further discussions or comments are welcomed!


Step 8: Relative Readings: