Using our website means you agree to using cookies which help us improve microbit.org.Learn more
Skip to content

Activity

Guitar 1 - touch tunes

Advanced | MakeCode, Python | Pins, Sound | Electricity, Electronics, Input/output, Sound

Step 1: Make it

What is it?

The first step to making a micro:bit guitar: play different tunes by using the micro:bit’s touch sensor.

photo showing how to connect silver foil pads to micro:bit pins 1, 2 and GND

How it works

  • This is like the Jukebox project, but instead of using the micro:bit’s buttons, you’ll make your own input device, touch buttons using crocodile clip leads and tin foil connected to the micro:bit's pins.
  • Flash the program on to your micro:bit. Attach headphones to pin 0 and GND so you can hear sound – see Make some noise project for details.
  • Attach crocodile clips to pins 1, 2 and another to GND. With one finger touch GND, and with another finger touch the wires connected to pin 1 and then pin 2. It should play a different tune depending on which pin you touch.
  • The micro:bit is using pin 0 as an analogue output, varying the electrical signal to make audio (sound). It’s using pins 1 and 2 as touch inputs. When you touch either of these pins and the GND (ground or Earth) pin, you’re completing an electrical circuit. A small amount of electricity flows through you and the micro:bit can detect it and the program triggers the playing of a tune.

What you need

  • micro:bit and optional battery pack
  • MakeCode or Python editor
  • headphones, buzzer or powered speaker
  • 5 crocodile clip leads
  • optional cardboard, tin foil, glue stick, scissors to make guitar or keyboard

Step 2: Code it

Step 3: Improve it

  • Make touch buttons using tin foil and cardboard. Shape them to look like a keyboard or a guitar.
  • Change the tunes that get played when you touch the tin foil.
  • Program your own tunes.