The MonkMakes Relay for micro:bit is a solid-state (no moving parts) relay that allows an output of a micro:bit to turn things on and off.
A micro:bit can turn an LED on and off directly, but anything more powerful requires something like a relay.
This relay can be used to switch low voltage devices such as light bulbs, a motor, a small heating element or even a string of 12V LED lighting. The voltage needs to be kept under 16V, but the relay will automatically protect itself against too much current.
- Solid-sate relay (up to 2 Amps)
- Active LED indicator
- Resettable ‘polyfuse’ to protect against over-current
CONNECTING TO YOUR MICRO:BIT
The Relay requires just two connections to the micro:bit. One to GND (ground) and one to whatever pin is to be used to control the relay’s switching action.
When attaching the alligator clips to the micro:bit, make sure that the clips are perpendicular to the board so that they are not touching any of the neighbouring connectors on the micro:Bit edge connector.
Here’s an example of how you could wire up a MonkMakes Relay for micro:bit to turn an old fashioned light bulb on and off.
The quickest way to try out your relay is to DOWNLOAD THIS HEX FILE and then copy it onto your micro:bit. The program will turn the relay on and off once a second.
Set the controlling pin to 1 and the relay contacts will close, set it to 0 and the contacts will open again. Its as simple as that. So, to make your relay turn on and off once a second, open the Blocks Editor, add a forever block and then the digital write blocks from the pins category and the pauses from the basic category.
Paste the following code into the Python window and then Download the file and copy it onto your your micro:bit
from microbit import * while True: pin0.write_digital(True) sleep(500) pin0.write_digital(False) sleep(500)