Micro:bit Experiment 03: Trimpot —— Elecfreaks Mirco: Bit Starter Kit Course
by ElecFreaks in Circuits > Electronics
112 Views, 0 Favorites, 0 Comments
Micro:bit Experiment 03: Trimpot —— Elecfreaks Mirco: Bit Starter Kit Course
![Trimpot850.jpg](/proxy/?url=https://content.instructables.com/F1I/30V7/J76GGSXS/F1I30V7J76GGSXS.jpg&filename=Trimpot850.jpg)
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.
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
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
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.
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.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.
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.
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!