Software apps and online services
The snap:bit is an electronic component for the Snap Circuits educational electronic kit. It features a socket for connecting the BBC micro:bit and allows the micro:bit to programmatically control Snap Circuits.
This project demonstrates how to amplify the sound coming from the BBC micro:bit before playing it through the 8Ω Speaker (SP) of Snap Circuits.
It is similar to the Connect Speaker to Micro:bit project where we connected the speaker directly to the micro:bit. We could hear the sound from the micro:bit, but it came out very quiet. Here, we will add the Amplifier IC (U4) part of Snap Circuits to amplify the sound and hear it loud and clear.Snap Circuits diagram
Build the circuit shown in the diagram above.Code
You can build the code yourself in the MakeCode Editor.
Alternatively, open the ready project here: https://makecode.microbit.org/_JtEPxq7xxFCg
The "set built-in speaker" block is required only for the BBC micro:bit V2. The new version of the micro:bit comes with a built-in speaker. You must turn it off to hear the sound through Snap Circuits' speaker.
Once ready, download the code to your micro:bit. Then disconnect all cables from your micro:bit. Both the USB and the battery pack must be disconnected from the micro:bit.How it works
The micro:bit plays music through pin P0. So the Speaker (SP) snaps must be connected across snap 0 and either the 3V or GND snap of the snap:bit. However, in the Connect Speaker to Micro:bit project, we have seen that connecting the speaker directly to pin P0 of the micro:bit leads to a low sound level. The reason for this is the low current coming out from pin P0. To hear the sound loud and clear, we have to amplify it through the Amplifier IC (U4) of Snap Circuits.
When you close the slide switch (S1), the Battery Holder (B1) powers the snap:bit through the 3V snap and the Amplifier IC (U4) in parallel. The micro:bit turns on. The “on start” event triggers, and the micro:bit plays the melody.
The micro:bit modulates the sound like a current through snap 0, which goes through the Red Jumper Wire to the Amplifier IC input snap. The amplifier amplifies this current and sends it to the output snap where the Speaker (SP) is connected. The speaker plays the amplified current, and we hear it as a loud melody. Finally, the current goes through the GND snap of the snap:bit and back to the batteries' negative terminal.