BBC micro:bit Pedestrian Crossing Project:
In order to create this project in the same way as the example below, you will need to source the following components: Parts List:- A BBC micro:bit.
- 1 x Kitronik Prototyping System.
- 2 x Red LED’s.
- Two Green LED’s.
- An Orange LED.
- 1 x Piezo Sounder.
- A x NPN Transistor.
- 1 x 2.2kΩ Resistor.
- 5 x Resistors suitable for your LED’s (I used 220Ω resistors).
- 7 x M/F Jumper wires.
- 3 x M/M Jumper wires.
Stage 1 - The Traffic Lights:
First, I connected three LED’s to P0, P1 & P2 via series resistors as show in the picture below. Stage 1 Suggested Breadboard Layout:BBC micro:bit Edge Connector Breakout Board | Breadboard Connection |
---|---|
P0 pin | Red Traffic LED via 220Ω Resistor. |
P1 pin | Orange Traffic LED via 220Ω Resistor. |
P2 pin | Green Traffic LED via 220Ω Resistor. |
0V Pin | Breadboard negative rail. |
3V Pin | Breadboard positive rail. |
Stage 2 - Adding Pedestrian Crossing LEDS:
This worked well so I thought I would try adding two more LED’s via series resistors to ports (P8 & P12). I modified the pre-written program so that the two additional LED’s would also be controlled.Stage 2 Suggested Breadboard Layout:
BBC micro:bit Edge Connector Breakout Board | Breadboard Connection |
---|---|
P0 pin | Red Traffic LED via 220Ω Resistor. |
P1 pin | Orange Traffic LED via 220Ω Resistor. |
P2 pin | Green Traffic LED via 220Ω Resistor. |
P8 pin | Green Pedestrian LED via 220Ω Resistor. |
P12 pin | Red Pedestrian LED via 220Ω Resistor. |
0V Pin | Breadboard negative rail. |
3V Pin | Breadboard positive rail. |
Stage 3 - Adding The Crossing Beeper:
The final part of this project was to add a piezo sounder to simulate the crossing beeper. I connected a piezo sounder to port (P16) via a driver transistor. I modified the code once more to add this functionality.Stage 3 Suggested Breadboard Layout:
BBC micro:bit Edge Connector Breakout Board | Breadboard Connection |
---|---|
P0 pin | Red Traffic LED via 220Ω Resistor. |
P1 pin | Orange Traffic LED via 220Ω Resistor. |
P2 pin | Green Traffic LED via 220Ω Resistor. |
P8 pin | Green Pedestrian LED via 220Ω Resistor. |
P12 pin | Red Pedestrian LED via 220Ω Resistor. |
P16 pin | 2.2kΩ Resistor for Transistor. |
0V Pin | Breadboard negative rail. |
3V Pin | Breadboard positive rail. |
©Kitronik Ltd – You may print this page & link to it, but must not copy the page or part thereof without Kitronik's prior written consent.
2 comments
Mark Donnison
Hi Jay, they are to ensure that the supply is correct to each of the LEDs. We used ohms law to determine the value of the resistors that would be needed.
Jay
Why do we need the resistors?