Instructions
PROJECT 6. CLAP CONTROLLED FAN
You will need:
• micro:bit
• MonkMakes Relay for micro:bit
• AA Battery holder and battery
• Motor with fan attached
• Program: P6 Clap Controlled Fan
This project uses exactly the same wiring as
Project 5, but uses the micro:bit 2's built-in
microphone to toggle the motor on and off
when a loud noise such as a clap is
detected.
Clap once to start the fan and then clap
again to turn it off.
Follow this link for the code for this project:
https://makecode.microbit.org/_LszHsFf37P0u
How it Works
The Relay controls the separate circuit of
the battery and fan, just like Project 1. The
variable fan on is used to control whether
the fan is running or not. Initially, this is set
to false.
When a loud sound is detected, the on loud
sound block is run. This first uses the not
block to set fan to true if it is false and false
if it is true, the value of fan on is then used
to decide whether to turn the pin 0 (that
controls the Relay) on or off (1 or 0).
This project would work just as well with the
LED lamp, but make sure the + side of the
battery goes to the + of the lamp.
Page 18