The latest micro:bit has a built-in speaker, but you can also output sound to a pair of headphones or an external speaker by sending a signal on Pin0. 

Common ways to do this are by using a set of analogue headphones with a jack plug on the end or using an inexpensive piezo speaker



micro:bit connected to headphone jackmicro:bit connected to piezo speaker

Headphones/Audio jack

Connect Pin0 to the tip and GND to the sleeve of the jack. If you have four rings on the headphones, choose the top and bottom rings.

Piezo speaker

Connect Pin0 to the red lead and GND to the black lead of the speaker.

There are lots of fun and interesting ways to connect up the headphones or speaker. If you have tried another method, let us know so we can share it in this article

This example by @kgiori shows the headphone jack inserted through the GND ring so that the sleeve of the jack is touching GND. A bent paperclip connects the tip of the jack to Pin0.

This example from Daisy shows tin foil and tape being used to connect the pins to the headphone jack:



Place a play melody block from the Music menu underneath the on start block to play a melody when the micro:bit is powered on or reset.



Import the music module and then use music.play() to play a melody when the micro:bit is powered on or reset.

import music

Mute sound and control the volume

See our article on muting the micro:bit and controlling the volume for more information.