← Teacher guide

Bits all the way down

Students trace characters, colours and sound samples from data to numbers to bytes on eight binary cards, closing the loop between data representation and binary (AC9TDI8K04 node 4).

Data representation · Binary numbers · about 35 minutes · Open the student lesson

Classroom resources

Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.

Students will be able to

Timing

Predict and Try 6 min · Worked example 10 min · Vary 9 min · Practise and Make 10 min

Before class

The integration node (the kit calls it the cross-standard point between K03 and K04): students assemble data → number → binary for two kinds of data.

Simplification: text here is one byte a character (ASCII). Unicode characters beyond 255 take two to four bytes (Text as numbers).

Running the lesson

  1. Predict: students who chose 65 or A haven't joined the two halves yet; the Try does it.
  2. Worked example: ask what the 24 bits of a black pixel look like.
  3. Vary: ask why lower case is always the 32 card added.
  4. Make: have students write their initials as bytes on paper.

The hard part (on purpose)

Students think a character is one bit. Ask how many different things one bit can be (two), then how many characters there are.

When students get stuck

What you will seeA question to askThe fix
A student says a character is one bit (Sam's mistake).How many values can one bit hold? How many letters are there?A byte holds 256 values: enough for a character code.
A student mixes bytes and bits.How many bits in a byte?8. Multiply bytes by 8 to get bits.

Answers to the checks

  1. the letter A: The letter **A** has the code 65. How is it stored in the computer's memory?
    01000001. The computer stores only bits: 65 = 64 + 1, so on 8 bits (one byte) the 64 and 1 places are 1.
  2. Try: one byte for A: Set the eight cards to 65, the code for A. What pattern of bits is it?

    65 = 64 + 1, so A is 01000001: one byte.
  3. Text and a pixel: One pixel is three numbers (red, green, blue), each one byte. How many **bits** is one pixel?
    24
    3 bytes × 8 bits = 24 bits.
  4. Find the mistake: Sam works out how many bits the word cat takes. Click the line where it first goes wrong.
    line 3
    Line 3: one bit can only be 0 or 1, not one of all the letters. Each character's code needs a byte: 8 bits. So cat is 3 × 8 = 24 bits.
  5. What does a byte mean?: The byte **01000001** is in memory. What does it mean?
    It depends on how a program reads it: A as text, 65 as a number, a dark shade as a colour amount
    Bits are just bits. The encoding (text, number, colour, sound) decides what they mean, as in Everything is numbers.
  6. H to I: The cards show 72, the code for H. Make 73, the code for I.

    One more: only the 1 card changed. 01001001.
  7. Lower case: Now make 104, the code for lower case h. Which card did you have to add?

    104 = 72 + 32: lower case adds the 32 card. 01101000.
  8. Full colour: Make 255, a colour amount at full.

    255 is every card up: 11111111, the biggest byte.
  9. Silence: Make 128, a sound sample at the middle (silence).

    128 is just the left card: 10000000.
  10. A space: Make 32, the code for a space.

    A space is 00100000: still a whole byte, though nothing shows.
  11. Bits in a word: How many bits does the word **hello** take, at one byte a character?
    40
    5 bytes × 8 = 40 bits.
  12. Bytes in a picture: A 2 × 2 picture, three bytes a pixel. How many bytes?
    12
    4 pixels × 3 = 12 bytes (96 bits).
  13. Sound samples: Music often uses 65 536 levels a sample. How many bytes is each sample?
    2 (16 bits)
    2¹⁶ = 65 536, so 16 bits: 2 bytes.
  14. Byte to character: As text, which character is the byte **01000010**?
    B (66)
    64 + 2 = 66, which is B.
  15. a lower case letter: The number is hidden. Set the cards to the byte for lower case a.

    a is 65 + 32 = 97 = 64 + 32 + 1, so 01100001.

Solutions

One possible solution for each task. Other correct programs are fine.

Vary: one letter at a time › H to I

Open task: any program that does what the step asks.

Vary: one letter at a time › Lower case

Open task: any program that does what the step asks.

Vary: one letter at a time › Full colour

Open task: any program that does what the step asks.

Vary: one letter at a time › Silence

Open task: any program that does what the step asks.

Vary: one letter at a time › A space

Open task: any program that does what the step asks.

a lower case letter

Open task: any program that does what the step asks.

Stretch and support

Stretch: A phone photo is about 4000 × 3000 pixels. Roughly how many bytes before compression? (36 million.) Why do we need compression?

Support: Keep the 128 64 32 16 8 4 2 1 card values written above the board.

Exit ticket

Write the letter C as a byte. How many bits is the word Hi?

C = 67 = 64 + 2 + 1 = 01000011. Hi = 2 bytes = 16 bits.

What each step is for

Where it leads

This closes the Data representation course.

Next (Years 9–10): Making data smaller (compression). Code links: Secret messages shifts these codes; colour values in turtle are these bytes.