Ang Bao Collector

Collect your Ang Baos with Micro:bit, Neopixel and a Buzzer

Goal

  • Build an Ang Bao collector that keeps count of the number of Ang Baos you have!
  • The LED strip should light up when an Ang Bao is deposited and show a tally of the number of Ang Baos.
  • Play “Gong Xi Gong Xi” when an Ang Bao is deposited.

 

Materials

  • 1 x Micro:bit
  • 4 x Neopixel LED Strip
  • 1 x HC-SR04 Ultrasonic Sensor
  • 1 x Battery Holder
  • Lots of Red Paper
  • 1 x Penknife
  • 1 x Buzzer
  • 1 x Shoe box
  • 2 x AAA Batteries
  • Lots of double sided tape

Step 1 – Cutting the Box!

  • Cut out a rectangular shaped hole at the top of the box for the insertion of Ang Baos.
  • Cut another hole at the back of the box to allow the placement of the HC-SR04 Ultrasonic Sensor

Step 2 – Wrap it up!

  • Wrap the box with red paper.
  • Re-Cut the holes if they were covered by the paper.

 

Step 3 – Setting up the LED Strips

  • Connect the 4 LED strips together (make sure the Din matches to the Dout when you connect the wires)
  • Poke holes at the side to hide the lengthy wires, by tucking them into the holes.
  • Connect the LED Strip to P4

 

 

Step 4 – Setting Up the Other Components

  • Tape the HC-SR04 to the back of the box
  • Connect the Trigger Pin to P15 and the Echo Pin to P16.

 

  • And connect the buzzer to P0.

 

Step 5 – Setting Up the Micro:bit

  • Tape the Micro:bit at the top.
  • Picture shows how the Micro:bit should look after all the connections.

 

 

Step 6 – Adding the Neopixel Extension

  • To add the Neopixel extension: Click on the Advanced Tab>Extension and search for “Neopixel”

 

Step 7 – Programming the Micro:bit

  • At the start we initialize the variables we willl be using as well as the Neopixel LED strip.

 

  • Create a “Music” function to play “Gong Xi Gong Xi”

 

 

  • If the HC-SR04 sensor detects an object, it will turn on the lights and simultaneously play “Gong Xi Gong Xi” in the background
  • The programme also keep a count of the number of Ang Baos received and show the tally on both the Micro:bit LED and the Neopixel LED Strip.

 

Demo Time!

  • After Inserting the Ang Bao, the LED strips will light up and music will be played from the buzzer.
  • The number of LEDs that remain lighted up will indicate the number of Ang Baos collected!