Using a BBC Microbit to make traffic lights for a Lego town

Using a BBC Microbit to make traffic lights for a Lego town

Today I’m pleased to introduce the second instalment of the guest posts from our resident Engineer Matt, who has come up with an

Toby wiring up traffic lights
Toby wiring up traffic lights

activity to program a BBC microbit to solve an age old problem in Lego Town.  See the bottom of the page for full intro from the last post, including details of the kit used.

 

Aim: Every budding Lego builder’s worst night mare, traffic jam in down- town Lego city! The aim of the programme is to create a simple programme using the microbit to create a set of two way traffic lights.

Learning: Basic coding making the programmer think about timings and what sequence to turn on and off LEDs

The code:

traffic light code
traffic light code

 

The Setup:

Traffic lights in action
Traffic lights in action

Parts used:

2x Red/Green/Yellow LEDs

Male – Male, Male – Female jumper wires as required

Battery pack

Black electrical tape (I used these to form temporary joints for the LEDs)

Lego!

 

Results:

Toby using the traffic lights
Toby using the traffic lights

 

 

Toby loved creating the traffic lights out of Lego and adjusting the timers to run as quick as they can go, not sure if this eased congestion though! Making the temporary joints out of black tape was tricky an inline wire block may be better or have a go at soldering.

 

 

 

 

 

 

Notes:  read below for more info on why code with kids, and the kit used:

Kids Programming

The UK has a history of being at the fore front of computing with all modern computers based around the work of Alan Turing during the mid-20 century. The UK has now become one of the first countries in the world to make computing coding compulsory for school age children. The government sees coding as key life cycle to support an ever increasing technological world. (https://www.gov.uk/government/news/year-of-code-and-500000-fund-to-inspire-future-tech-experts-launched)

 

BBC Microbit

 

 

To support this we have been creating a  few simple experiments using the  BBC microbit computer similar to the raspberry PI.  The BBC microbit is around £14 and comes with tonnes of built in features. We have also brought an ‘Inventors kit’ from Kitronik (around £25) which contains some LEDs, resistors, buzzers  and a bread board  which allows you to connect everything up.

 

 

 

The programming software is free from (http://microbit.org) there are several programmes to choose from I tend to use Java script block editor for ease of use as its drag and drop codes.

Microbit inventors kit

The experiments we have tried are simple, practical and should take less than an hour from start to finish.

No Comments

Post a Comment