https://digitalpeople.blog.gov.uk/2018/08/09/gds-stem-ambassadors-bring-coding-to-life-with-fireflies-and-microbits/

GDS STEM ambassadors bring coding to life with fireflies and micro:bits

Irene Lau, Maisie Fernandes, Venus Bailey, GDS
Irene Lau, Maisie Fernandes, Venus Bailey, GDS

Outside of our work as a technical architect, tech lead and a senior developer at the Government Digital Service (GDS), we are active STEM (Science, Technology, Engineering and Mathematics) ambassadors.

When we were invited to submit a conference workshop proposal on physical computing to the British Computing Society Software in Practice 2018 Conference (SPA), we saw an opportunity to share our knowledge and inspire people to look at coding from a different perspective.

What we chose for our workshop theme

At our SPA conference workshop, we decided to show distributed algorithms in action. In computing, algorithms tell a computer what to do to solve a problem. Distributed algorithms can run across multiple systems simultaneously.

The aim of our workshop was to:

  • explain how distributed algorithms work in the natural world
  • observe the behaviour of our group as they tried to use a distributed algorithm in a real-time scenario
  • encourage discussion about how distributed algorithms can help solve challenges such power conservation and efficiently distribute data within networks

During our session, we first looked at how thousands of fireflies coordinate with each other to light up at the same time. The reason we chose this is because it’s a fascinating example of how nature can help improve technical algorithms. Fireflies work individually and coordinate with nearby individuals. As a group, they can achieve a common objective.

A natural assumption would be to think that the fireflies co-ordinate by following a leader. However, that’s not the case. Every firefly has an internal clock and every time this clock strikes 12, the firefly flashes.

But here’s where things get more technical: when a firefly sees a nearby neighbour flashing, its individual clock moves forward a notch. This behaviour is replicated by a group of fireflies until they eventually synchronise with each other and light up.

The way firefly light shows occur is an example of a biological distributed algorithm in action. It’s also something we could take inspiration from to solve engineering problems and run networks more effectively.

Creating our own light show

Participants code with micro:bit at the workshop
Workshop participants running the code for the fireflies on their micro:bits

Our workshop had 30 attendees with a mix of technical experience. We gave each participant a micro:bit, which is a small device used to teach computing. For this exercise, each micro:bit was used to represent a firefly. The aim was to get the group to make the LED lights on all the micro:bits flash in synchronisation by organising themselves and adapting the code for the micro:bits.

We divided the activities into two stages to do this:

  1. Participants started by programming their micro:bit using the online Python editor. They had to complete tasks using the features of the micro:bit.
  2. Next, they uploaded a program to their micro:bit and modified the code they wrote in the first stage to try to synchronise the fireflies.

In the fireflies exercise, we used multiple variations of one piece of code. We wanted to show how any changes would impact how the fireflies synchronised.

In nature, fireflies adapt in order to synchronise with each other by adjusting a little at a time. With our simplified code, the micro:bits adjust its internal clock to the first “flash” it can “see”.

Interestingly, one of the changes we made to the code for the workshop resulted in synchronisation only happening for parts of the group - illustrating one of the common challenges developers face when designing distributed algorithms.

Lessons learned

Running this workshop with STEM students and professionals was a good opportunity to work with a group of people with mixed technical knowledge and gave us a lot of insight into what concepts they want to learn about.

The two-and-a-half-hour session generated plenty of discussion points. We found that giving participants a physical device to code on really seemed to engage them compared to simply talking about programming concepts or watching us demonstrate them. We were also pleased to find our workshop worked for a wide range of programming skills.

We’re aiming to tweak the workshop based on the feedback we received for future sessions. We incorporated a second paper based exercise into the session, but we did not have enough time to complete it as the first part overran. It also confused some participants as it was not directly linked to the fireflies exercise.

Next time, we might keep it simple with just the micro:bit coding or think about ways to better incorporate the paper exercise to make it more relevant.

We would also like to simplify and refine our materials and make them available for STEM activities in schools and across government.

If you are interested in learning more about the workshop, please leave a comment below.

Follow @DigiCareersGov to know more about the different careers that exist in government.

Subscribe for blog updates.

Leave a comment

We only ask for your email address so we know you're a real person