Bits and pieces

Computational Thinking - Alien Contact! - Lesson 2

Objectives

  • To understand that binary code can represent many things
  • To explain how images are converted into binary code and vice versa
  • To recognise and apply computational thinking concepts and approaches to solve problems

Lesson Resources

Before the lesson

Print out the class task resource sheets and slice each sheet into 7 strips of paper by separating the rows. 

 

Introduction

Binary data is a type of data that is represented or displayed in the binary numeral system. It is the only category of data that can be directly understood and executed by a computer. Binary data is numerically represented by a combination of zeros and ones. Everything that is stored on a computer can be represented as binary data, this includes photos, videos and music.

This second lesson focuses on images, how they are created on screens, and how a computer ‘reads’ and converts an image into a binary number and vice versa. 

Do not mention any of this, or the lesson objectives to the students at the beginning of the lesson. 

 

Begin with this; another message from the aliens has arrived! Share this with your class via the video in the teacher presentation, or just read it to them.

 

 

Mix up and give out the strips of paper you sliced up before the lesson, spread them randomly around the room. The coloured dots on each strip are a clue to show which sets go together, but don’t mention this or explain it if asked. Make sure you put a mix of coloured dots on each table. 

Tell the students that the answer and the code they need is hidden in these strips of paper, they must now all work together to solve this new problem and get the next number code to give to the aliens.

Ask:

  • What could your strip mean?
  • What do you think you need to do with it?
  • Were there any clues in Lord Htron’s message?

 

Ensure they picked up on the final part of the alien message ‘1 = white and 0 = black’.

 

 

Hopefully the students will begin by colouring in their strips, but that won’t immediately reveal the solution (the better they colour them in the easier they will find it!). They will then need to get up, move and talk to other people and see what they have on their tables. They might then consider that the strips are designed to go together (remember, the coloured dots show which sets go together). If they struggle and don’t notice the coloured dots give them this clue after a while.

Once in groups (of coloured dots) they still need to work out how to get the code. If needed prompt them that what they have is a jigsaw.

Once coloured in and placed in the right order, they should create this image. Which reveals the secret code of 3489. This is the key code the aliens will require at the end of the lesson. 

 

 

But how were the coded numbers converted into a picture?

Explain that this is called a bitmap. It’s an example of how computers create images. It uses something called binary data. Everything a computer does is converted into and controlled by binary code: images, letters, sounds and videos, they all get converted into a string of 0s and 1s and electrical pulses that go through the computer’s circuits, but how?

This video from the excellent code.org does a really great job of explaining some of the basics behind binary numbers and how they are converted to represent other things on a computer, such as text, pictures or sounds. 

So our number is an example of how a single binary number can be converted into a picture (and vice versa). This is the number for the image above:

 

111111111111111111100010111100010001111010111101010101110010101100010001111010000101011101100011101100011101111111111111111111

 

On it’s own the number means nothing to us or a computer, but if we assign meaning to the digits it can become the picture. Each binary digit (bit) represents a pixel of the image, but the computer needs to know more than that. Extra information is attached to the file, this is called metadata and might contain the dimensions of the pixels in the image (in this case 18 x 7) and also the colour key for the image (here 1 = white and 0 = black). 

This metadata is vital as, for example, the wrong dimension for the pixels will distort the image and make it unreadable for us. 

 

18 x 7 pixels:

 

7 x 18 pixels:

 

But most images are made up of more than two colours, so what happens when we use more colours? We need to use more binary data for each pixel to give us more code (and therefore colour) combinations. Which results in more binary data being required for the whole image and more metadata.

 

 

Binary data for the image above:

0000010000000110010000000100001100110011001111110000001100001111111111

 

Metadata:

  • Grid size: 5 x 7 pixels
  • Bits per pixel: 2          
  • Colour key: 00 = Blue 01 = Red 10 = Yellow 11= Green

 

As an image gets more complex, with more pixels and more colours, it will need even more binary data and therefore take up even more storage space on a device. 

 

More colours, more pixels = higher file size

 

Even more colours and pixels = even higher file size

Having more pixels in an image is called having a higher resolution.

Main task

Followed by individual tasks:

Worksheet (Two 5 x 7 grids side by side one for bitmap, one for binary code. Fold it down the middle to be able to display either the image or the binary data)

Ask each table to think of a positive word that they could send back to the aliens via your agent ‘Teacher’. The number of letters in the word should match the number of people on their table. 

Give each child a copy of the worksheet

 

 

1.  Each child must first draw one letter of their group’s word into a 5 (width) x 7 (height) grid by shading in the pixels needed.

2. Next they convert their bitmap pixels into binary code by assigning a 1 or a 0 to black and white.

3. They then take the single binary number for their letter (all the data in the grid arranged consecutively from top to bottom)

4. Finally they should complete the metadata section on their sheet to show how the data would be organised and represented by colours.

 

 

You can fold the sheets in half and peg them on a washing line to make a nice double sided display of their work, which displays just the letters, or just the binary data depending on which side you look at. 

We’d love you to send us a photo of your finished class messages and code. Transmit them to the mothership by emailing them to thealiens@ntlp.org.uk, and the aliens will get back to your class! 

 

Plenary

Take a look at the computational thinking poster with the class:

 

 

Which of these concepts do you think you have covered today? Which of the approaches did you use? How did your team help you today? Logic, pattern recognition, decomposition and abstraction should all have been key concepts today:

  • Logic - in analysing the separate parts of the problem. 
  • Pattern recognition - converting binary into colours and mapping the patterns
  • Decomposition -  the problem was already broken down into parts that needed solving before the end solution could be found.
  • Abstraction - removing the detail of the binary data, once placed into the bitmap, revealed the whole image. 

 

Reveal the lesson objectives, and that they were secret until now so as not to spoil the binary data task. Ask the children to consider how successful they have been. 

Finally, upload the code you found today to the aliens to see if they accept it.

Go to this link and enter the code number from the problem at the start of the lesson (3489):

 

https://scratch.mit.edu/projects/260924009/#fullscreen

< Previous Lesson

Next Lesson >