Connecting the Keyestudios Piranha LED to the Microbit

Tinkerer: Lory Livezey

The Pirahna LED Module is a very bright LED. Where many LED's would be used for display purposes, such as the LED on your Uno board, this one could be used for illumination, to light the way for your robot in the dark. In this tutorial, we'll connect the LED to the Microbit.

Previous Step

Using the Keyestudios 37 Sensor Kit with the Microbit

What you will need

(Or Longer)
(or a monitor/keyboard/mouse plugged directly into the Pi)
(Or Larger, Optional)

Plug the Microbit into the Breakout

The breakout board gives you an easy way to connect the smaller pins on the Microbit. You could use alligator clips, but connecting them to the sensor can be a bit of a challenge. I am using a Kitronik Motor Board as a breakout. There are several others that will basically work the same way.

Plug Microbit into breakout board

Hook Up the Sensor

First, we'll hook the lead wires to the sensor and the Microbit.

  • Connect Red [+] to 3V on the Microbit
  • Connect Black [-] to Ground on the Microbit
  • Connect Blue [S] to Pin 0 on the Microbit

When you plug the Microbit into your PC, Mac or Raspberry Pi, it should create a drive that you will use to upload the program you will create

Now that we're all connected, open up the browser to . I am using a Raspberry Pi, but if you are using a PC or Mac, it will essentially work the same:

Open a new project, and either copy/paste the following code into the window after selecting Javascript...

basic.forever(() => {
    pins.digitalWritePin(DigitalPin.P0, 1)
    pins.digitalWritePin(DigitalPin.P0, 0)

Or build the blocks like so:

Make Code Blocks

Their location:

Advanced > Pins > digital write pin P0 to 0
Basic > Pause(100)

Change the time to 2000 (that's 2 seconds)

Give the sketch a name and click Download.

Open your Downloads directory and drag the file (it will have a hex extension) over to the drive that was created when you plugged in the Microbit.

On the Rasbperry Pi, it's located here:

Media > Pi > Microbit

Once the Microbit reboots, the LED should blink on and off every 2 seconds!

Be sure to subscribe to our channel!