micro:bit Tinker Kit Project 03 – Electro Theremin
What you will learn
- Learn how to use an analog sensor with the BBC micro:bit
- Make an electro-theremin
What you need
- 1 x BBC micro:bit
- 1 x Micro USB cable
- 1 x Buzzer
- 2 x Female to Female Jumper Wires
- 1 x Potentiometer
How to assemble
Step 1
Plug in your Buzzer to Pin0. Make sure the positive lead is connected to the yellow signal pin and the negative lead is connected to the black ground pin on the breakout board. Plug in the potentiometer to Pin1. You can plug according to the color. Make sure that the wire colors and the pin colors on breakout board are well matched!
Step 2
In Makecode, we’ll track the value of the potentiometer using a variable. Variables are like buckets that can hold changing values. Make a new variable called reading (or anything you like, really) in the Variable drawer. We want to constantly set our reading variable to the analog value of the potentiometer instead of the digital. Reading the analog value allows us to access a whole range of signals from the potentiometer, instead of just a digital 1 or 0. Find this block in the Pins drawer.
Step 3
Check your minimum and maximum values for your potentiometer by showing the number of the reading variable.
Turning the knob anti-clockwise all the way gives you the minimum, and clockwise all the way gives you maximum. Notice how the values jump? That’s because the micro:bit takes some time to scroll a large number across the screen, and by the time you read a new value, the potentiometer would be way ahead!
Step 4
Now we’re going to use those values you just read from your potentiometer to map out your notes! Our music blocks may not have a range as wide as your potentiometer. In this instance, we want to make sure the highest potentiometer value still corresponds to the highest note we can play. Check out the value of the lowest and highest notes in the micro:bit piano keys.
Using the map block from the Pins drawer to key in all the values.
Step 5
You may have noticed we made another variable called note in the previous step. Make sure you set the note variable to the mapped values. Ring the tone using the note variable. Save these code into your micro:bit and you are ready to make some noise!
If you don’t want to type these code by yourself, you can directly download the whole program from the link below:
https://makecode.microbit.org/_5jUeetL6oKqi
Or, you can download from the page below:
Now you’ve learned how to play around with the potentiometer, you can try to use it to control LEDs, servos, and other components! And if you get your hands on another analog sensor, you’ll know just how to use it!
Tinker Kit Projects
- Project 01 – Music Machine
- Project 02 – Smart Light
- Project 03 – Electro-Theremin
- Project 04 – Simple Alarm Bot
- Project 05 – Plant Monitoring Device
- Project 06 – Intruder Detection
- Project 07 – Fish Feeder
- Project 08 – Motion Detector
- Project 09 – Lie Detector
- Project 10 – PADDLEBALLSUPERSMASHEM
- Project 11 – Avoid Asteroids
- Project 12 – Remote Control Everything
- Project 13 – micro:bit Car
- Project 14 – Flipping Pancakes
- Project 15 – Maze Runner
- Project 16 – QUICK MATHS
- Project 17 – Pitch Perfect
- Project 18 – Finger Dexterity
- Project 19 – Electric Spirit Level
- Project 20 – Space Shooter
- Project 21 – Flappy Bird
- Project 22 – Wire Transmission
- Project 23 – Snake Game