Disco Ball Micro:bit STEM Project Tutorial | Coding Lesson and Craft Activity

IMG_3495

I classify this STEM project as easy. There are some fine points that I will mention, but in general, if you have seen and know how the LEDs and the Microbit board work, then you should not have any problems.

Take a ping pong (that’s what we call table tennis) ball and turn it into a disco ball using a little dexterity and some Microbit programming. The project is not very useful for real life, but it is fun and teaches us some basics of electrical engineering and coding. And why wouldn’t it be useful, come to think of it? What if you wake up at 2 in the morning, can’t sleep, want to hear your favorite song and want a little more special effects while listening to the voice of your favorite artist? In this case the disco ball for table tennis is a great solution :)

MATERIALS:

  • table tennis ball (ping pong)
  • 3 LEDs with different colors
  • 4 crocodile clips cables
  • a microbit
  • a utility knife or scissors
  • hot glue gun

How to do the project:

Poke 3 little holes in the tennis ball. The holes should a tiny bit bigger than the head of an LED.

Use the hot glue gun to glue the head of the LEDs inside the tennis ball. Look at the picture below. Place the LED’s heads in the wholes you just poked, one in each hole.

     

IMG_3494

Now comes one of those fine moments that will predetermine whether the project will turn out in the predicted successful way, or will totally fail. The LED has two legs – one short and one long. The long leg represents + (plus) and the short leg – (minus). We need to take the short leg of all three LEDs and twist the three short legs together into a single mega leg in the middle between the 3 holes. We do nothing with the positive legs (the longer ones) at this point, and they stick out separately. The end result looks like this:

1

We clip the 4 protruding legs with a crocodile clip cable – the three individual positive legs and the negative twisted leg. And each positive leg is then clipped to a pin on the microbit, either 0, 1 or 2. The negative twisted leg in the center is clipped to the GND pin of the microbit (which stand for GROUND and is the minus pin). The result can be seen in the previous picture.

We are done with the part of the project where we need to be dexterous. We continue with some softer skills, namely – writing the code of the program that will make the ball (actually – the LEDs) light up. Go to makecode.microbit.org and open a new project to write a program.

We can do the coding part in many ways. Let’s try the following: The first light turns on (1) and turns off (0), the second light turns on (1) and turns off (0), the third light turns on (1) and turns off (0), and it all starts over in a loop that is rotated 20 times. This happens by sending an electrical signal to the first 3 pins of the microbit. There are pauses of half a second (500 milliseconds) between each turn on and turn off. The code can be seen in the image below:

2

The most important thing here is the “digital write pin” block. This block outputs a 1 or 0 signal (yes or no, true or false, current or no current). This signal is fed to the corresponding pin of the board and goes to the LED. If the board receives a 1 signal on pin 0, then it gives electricity to that pin, which powers the LED and it lights up. At signal 0, the opposite effect is obtained – the board stops supplying electricity to the corresponding pin and the light goes out.

I’m going to assume you have Microbit experience when attempting this project, so I’ll skip over how to download the makecode program and how to upload it to the board.

You can watch a short video about how the completed project looks like on my YouTube channel by clicking here.

Or, if you’re a visual learner, you can watch a full step by step tutorial on how to do this project by seeing this video instead, click here.

The disco ball tutorial is done and now all that’s left to do is make it, turn off the lights, run some electricity on the board and LEDs, and enjoy the light show.

Want to take your micro:bit LED projects even further? 💡

For absolute beginners:

If your students are beginners and have never connected anything to the pins of the microbit, connecting an external LED for the first time using crocodile clip cables and programming a full light show on the micro:bit’s LED matrix is a great idea!

I’ve put together a complete ready-made resource for exactly this – the Micro:bit Light Show Project with External LED on TPT includes:

  • A step-by-step student PDF with theory, instructions, and a full answer key
  • Detailed teacher notes with tips, coding advice, and pictures
  • A ready-to-upload .hex file — drag, drop, and go!
  • An optional fun DIY card activity to make the lesson even more memorable

It’s beginner-friendly, works with both micro:bit v.1 and v.2, and your students can even unplug the tiny circuit board and walk around the room showing off their light show to each other. Perfect for tech class, robotics club, or STEM sessions. ⭐ Rated very highly by teachers that have used it!

For more advanced learners (meaning this is not their first or second time grabbing a microbit):

If you’d like to bring this project into your own classroom without the prep work, I put together a full done-for-you resource – photo-rich slides, wiring diagrams, 3 coding tasks, answer keys, and ready-to-use hex files. Check out the Micro:bit Disco Ball STEM Project

Coding blocks used in the coding part:

  • digital write pin
  • pause block
  • forever loop
  • on button pressed event block (Task 2)
  • variables, if statements, and the light level input block (Task 3)

Leave a Reply