The snap:bit is an electronic component for the Snap Circuits educational electronic kit. It features a socket for connecting the BBC micro:bit. This allows the Snap Circuits to be programmatically controlled by the micro:bit.
In a previous project, we have learned how to connect the 8Ω Speaker of Snap Circuits to snap:bit to play music from the micro:bit. In this project, we will replace the speaker with the Whistle Chip (WC) components to play the Ode to Joy.
Snap Circuits diagramBuild the circuit shown in the diagram above.
CodeYou can build the code yourself in the MakeCode Editor.
Alternatively, open the ready project here: https://makecode.microbit.org/_AAqUCALTjTKD
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 Whistle Chip (WC) snaps must be connected across snap 0 and either the 3V or GND snap of the snap:bit.
When you close the slide switch (S1), the Battery Holder (B1) powers the snap:bit through the 3V snap and the micro:bit turns on. The “on start” event triggers and the micro:bit plays the melody. The sound is modulated as a current through snap 0, which goes through the whistle chip and makes it play the sound.
In fact, you will hear louder sound from the whistle chip than from the speaker. This is because the current from pin 0 of the micro:bit is weak. The micro:bit is designed to play music to headphones, not to loudspeakers. The speaker has a higher resistance than the whistle chip. Therefore, the sound from the whistle chip is louder.
Minimal whistle chip connectionJust like the speaker, you can connect the whistle chip directly across the 0 and 3V snaps on top of the snap:bit without any additional wires.
This minimal setup is very useful when experimenting with the code and the micro:bit is connected to the computer. This way you can have just the snap:bit with the whistle chip next to your computer without any additional components.
Comments