TJ and Matei's Signal Badge

Identify friend and foe with a stylish hidden signal

There's a whole lot you can invent with a micro:bit - TJ came up with his own version of the alarmed box, but catching a spy before they even get to your secrets is another great way to keep things secure.

It's not hard to tell who's who up close, but how do you tell your fellow agents apart at a distance? Or in the dark?

Create this gadget... in a flash

Keep your friends close and your enemies closer, as they say. But when you spot someone at a distance, how do you know if they’re friend or foe?

Your mission, should you choose to accept it, is to use your micro:bit as a signal, so your friends can spot you at a distance… and maybe warn them of impending danger!

However, just holding your micro:bit up might give the game away, so were’re going to sneak our signal instead a stylish looking badge.

You’re going to need:

  • 1x BBC micro:bit & battery pack
  • 1x Sheet of craft foam or stiff card
  • 1x Scissors
  • 1x Badge pin (but a safety pin and double-sided tape works great)
  • 1x LED (or if you’re fancy, a sew-in LED with conductive thread)
  • 2x Crocodile clip wires

Create Your Badge

Right click and choose 'save as' to download a wolf head template you can use for your badge, but let your imagination run wild with your design. Transfer your design to your foam or card, and cut it out.

Attach the LED

Now, decide on the placement of your LED. For our design the LED is going to represent the wolf’s eye. If you’re using an ordinary LED, push the legs of the LED through the badge, and use pliers to bend the legs into small loops that you can attach the crocodile clips to.

Be sure to pay attention to the length of the LED legs! The long leg (the Anode) is specifically designed to be connected to the positive end of a circuit. The short leg (the Cathode) connects to the negative end of the circuit.

For sew-in LEDs, the positive and negative ends are marked. Use a needle and thread to sew in the LED with the loops a little loose on the other side, so you can attach the crocodile clips.

Turn it into a badge

Finally, attach the badge pin to the back of your badge. Try to make sure the placement of the pin won’t get in the way of your crocodile clips!

Code the Badge Signals

For this project, we want the signal badge to show three different signal patterns, and we can tell which pattern is selected by looking at either the badge or the micro:bit screen.

Right click here and "save as" to download the .hex file. I'll break down what the .hex file does:

  • Pressing the A button will rotate through the three signal patterns.
  • The micro:bit displays a different picture on its screen along with a flashing pattern for the badge LED.
  • The three signals I’ve chosen here are to represent “I’m here” “All clear” and “Run away”, but the micro:bit screen and flashing pattern can be whatever you like.

SIDE NOTE: To edit the code go to pxt.microbit.org and in the projects page, upload the file.

Taking it Further

The code above works great – but you’ll find that there’s no way to turn the signal off once you start it, other than disconnecting the power to the micro:bit. With some extra coding, we can turn the B button into an on/off switch for our signal.

What does this script change? Well:

  • There's now a new variable called Signal, that can be set to True or False.
  • Pressing the B button will switch the Signal variable between True and False
  • Pressing the A button still rotates between the three signal modes, but the LED in the badge will only flash if the Signal variable is True.

Right click here and "save as" to download the hex file

Congratulations, you're finished!

Give your newly-made badge a try! Pin your badge on on a coat or jacket where you can safely tuck your micro:bit inside a pocket. Sneaky!

Make some for your friends and you'll all be able to signal to each other. You can even change the colour of the LED or the shape of the badge to represent your Pack, or just to stand out from the crowd.

Continue the Story