Introduction
Connect a piezo speaker to a Bit Board and control it with code.
We'll explore how we can make sounds using a piezo speaker.
Video Overview
Featured Document
-
-
We'll use Maker Tape to connect the Piezo to the Bit Board on a LEGO baseplate.
-
The Piezo will connect to Pin 8 and to Ground (GND).
-
You'll notice the Ground on the Bit Board (as well as the Piezo and other Crazy Circuits components we'll use) is color coded White.
-
-
-
If you've never used a micro:bit before you'll want to check out this guide: Bit Board V2 Setup and Use
-
We're going to load the following code for our Piezo Tone Time program: https://makecode.microbit.org/_PkCd12REd...
-
We're going to set the tempo to 400 bpm (beats per minute) in the setup, and then use beat as a measure of time (instead of pause) in our loop.
-
We've stuck to 1 beat for most of the code, but then rest for 4 beats at the end, but here's where you can experiment! Adjust the temp, adjust the number of beats, and see what your new "song" sounds like.
-
Note that this time we have disabled the built-in speaker, so you will only hear sound from the Crazy Circuits Piezo we've connected.
-
-
-
Once the code is loaded it should start running immediately.
-
You can power the micro:bit via the USB cable you used to load the code or you can use a battery pack plugged into the Bit Board.
-
You should hear four tones, a slight break, and the it'll repeat again.
-
-
-
Follow along with our recorded Live Stream!
-
You can watch the full video of us walking through this project, along with explaining and exploring the code: https://www.youtube.com/live/3olw8CrFukM...
-
