Lesson 03 Trimpot
Introduction
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 by Micro:bit 5*5 LED screen with bar graph.
Components:
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 want to buy all components above, you may need Micro:bit Starter Kit.
Software:
Microsoft Makecode Online Editor
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.
Hardware Connection
Connect your components 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.
Programming
Click to open Microsoft Makecode Online Editor, write your code in the edit area. We would like to suggest you to write code by yourself first.
Of course, you can see the whole program in the link below. Just click the Edit on the right top corner , and then click Download on the right bottom corner to download code into Micro:bit.
Link of the whole program: https://makecode.microbit.org/_Kax5tiaRWXxU
Code Explain:
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.
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.
Think
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!