Skip to main content
Skip to main content

Smartphone security

Integrating Digital Technologies
Years 3-4; 5-6

This lesson provides an opportunity to investigate security measures, including those powered by artificial intelligence (AI), that are used to protect users from unauthorised (unapproved, unwanted) access to their digital devices.

Unauthorised use of our digital devices is an everyday threat and is a key aspect of cybersecurity. We need to ensure measures are in place to protect our personal information and privacy.

There are a range of security measures used, depending on the device. On a smartphone, AI has opened up the way to use biometrics (for example, thumbprint or face recognition) to protect the authorised user of a phone and deny access to unauthorised users.

Students can create computer programs to demonstrate a security measure such as using a Personal Identification Number (PIN) – for example, a 4-digit code. Alternatively, students can incorporate a type of image recognition to mimic AI. Another option is to use an AI tool to create a model and incorporate this into their Scratch program.

This lesson provides a level of differentiation to cater for students’ range of programming skills.

Developed in collaboration with Digital Technologies Institute.




Preliminary notes

Different tools are suggested depending on the task selected based on student skill level. These tools include:

  • Scratch 3.0

    Use Scratch 3.0 or a similar visual programming environment to create a digital solution.


  • Machine Learning for Kids

    Use Machine Learning for Kids to incorporate AI into the digital solution.

    Note: Before the activity, this tool requires an initial set up by the teacher completed prior to the lesson. View the step-by-step guide to help with this process.




The following matrix shows which tools are required for each level in the Plugged part of this lesson.

Suggested steps

Unplugged activity

  1. Discuss the many things that people use their smartphones for in daily life. Then ask: ‘How do users make sure their smartphone is secure?’

    List security measures used to protect a user from someone else’s unwanted (unauthorised) use of their smartphone.

    Examples include:

    • Personal identification number (PIN)
    • thumbprint or fingerprint scan and recognition
    • eye (iris) scanning and recognition.

    Discuss which of these would use AI to perform the security measure. Explain that biometric security often uses image recognition to reform this function.

  2. Ask students to list or draw the steps they or other people follow to unlock their own smartphones. (Bear in mind that many primary-age students may not have their own smartphone.) Consider a flowchart or similar as a suitable representation of the process. To encourage thinking, pose the following questions:
    1. How do users access their smartphone?
    2. What prompts might people see on screen to unlock their device?
    3. How does the user gain authorised access?
    4. What happens when access is granted?
    5. What happens when access is denied?

Plugged activity

These activities explore ways of implementing a digital solution that demonstrates a smartphone security measure.


Program a smartphone to unlock with a PIN (skill level: medium)

This option uses Scratch 3.0 or a similar programming environment. It requires the following programming skills:

  1. Create a sprite (or upload an image to represent a smartphone).
  2. Change the costumes of the sprite smartphone (to represent access denied and access granted).
  3. Use the ‘When this sprite is clicked’ block.
  4. Use the ‘Broadcast message’ and ‘When I receive’ message blocks.
  5. Use the ‘ask’ block to enable a user to input an answer (in this case a 4-digit pin).
  6. Use the ‘if … then’ and ‘else’ block to decide when to grant or deny access.
  7. Optional: use a ‘forever’ block to loop the program.

Present the challenge of creating a program in Scratch 3.0 (or other familiar visual programming language) that uses a PIN to unlock a smartphone.

Depending on your students’ skill level, choose from among these:

  • Provide students with the sample completed Scratch program Phone unlock/lock to play with and use to remix their own version.
  • Provide students with the basic code of inputting four numbers to change screens, using the sample Scratch program Basic Phone lock/unlock. Students then add further screens and functionality.
  • Ask students to design their own digital solution, creating an algorithm that they follow to implement their solution.

A basic program can use the logic of first asking for a PIN – personal identification number – as an ‘answer’. An ‘ask’ block is selected for this purpose. It can be initiated when the green flag is clicked/selected.

Image: Screen capture of Scratch 3 Phone lock/unlock: ask for PIN (pin)

If the PIN (answer) is correct, broadcast ‘Unlock’ and switch the costume.

Note: The ‘costume’ changes depending on the broadcast message.

Image: Screen capture of Scratch 3-coded program showing broadcast message ‘Unlock’ (access granted), with matching costume.

If the PIN is wrong (an ‘else’ situation), broadcast ‘Locked’, say ‘Incorrect pin. Try again’, and switch the costume to a locked one.

Image: Screen capture of Scratch 3-coded program, showing broadcast message ‘Locked’ (access denied), with matching costume.

A flowchart representation of the steps described above could look like this:

Image: Flowchart representation of ‘Lock’/’Unlock’ steps depending on whether a PIN is correct or not.

Sample code: Basic Phone lock/unlock


Extension

A more complex solution can include multiple sprites and an option to access the screen by selecting a home button. This will involve showing and hiding sprites at different stages of the program. A forever block can be used to animate the home button by looping the next costume block.

Image: Screen capture of Scratch 3.0-coded program where Home button is used as one step to lock or unlock a smartphone

Image: Screen capture of Scratch 3.0-coded program with broadcast message ‘Unlock’

Sample completed program: Phone unlock/lock


Ideas for a remix

Students:

  • change the value of the answer to a different pin number or string
  • create their own costumes for the smartphone
  • add a block of program code that locks the screen after a certain number of failed attempts
  • create supplementary screens that will appear after access.

Program a smartphone to unlock with an image (skill level: medium to high)

The first solution involves using Scratch 3.0.

The second option requires a higher level of skill, but students learn how to train an AI and incorporate the AI model into their Scratch programming. This option requires the use of an AI tool: Machine Learning for Kids.


Coding with Scratch 3.0

The first step is to have a Start screen that asks the user to scan their facial image. A sprite can be made and labelled ‘Scan’.

Image: Screen capture of Start screen coded in Scratch3.0

In the following example, avatars have been used. Students use the broadcast message to switch the background to show ‘Scanning’.

Image: Screen capture of ‘Scanning’ image coded in Scratch3.0

To avoid privacy issues when using a student’s image, suggest using a toy with a face. Students can capture an image of the toy’s face with the device’s camera. Students label one toy image as granted and identify the costume number. In our program, If costume number 2 is scanned, then broadcast is granted and the screen will show granted. Else any other image (costume number will be denied). A range of other toy faces can be uploaded to the program (these will be denied access).

Image: Screen capture of granted image coded in Scratch3.0

Image: Screen capture of denied image coded in Scratch3.0


Ideas for a remix

Students can:

  • add their own images (upload a photo of a toy or take a photo of a toy using a device camera)
  • add more than two images (as costumes)
  • create their own Start screen
  • create a program based on their own algorithm
  • design the user interface.

Sample code: Scratch Basic Phone lock/unlock


Coding with Scratch 3.0 and incorporating an AI model

Visit the worksheet page on Machine Learning for Kids. Select the project Face Lock. Download the step-by-step guide, which has explanations and colour screenshots for students to follow. Ensure students do not upload their own image or images of others to the bank of data. Instead use toys with faces. This will avoid any privacy risks where their image potentially may be used without their consent.

Note: Although the guide is labelled ‘easy’ on their site, relative to our activities it is medium to high.

Here is the main script students would use. The main difference between this and the code above (see Sample code: Scratch Basic Phone lock/unlock IMAGE) is that the AI is invoked to determine if an image has been recognised. The screenshot below shows the additional black Machine Learning for Kids blocks.

Image: AI model incorporated into Scratch 3.0

Discuss the ways the AI responded to the different facial images.

  1. How well did the AI recognise the images?
  2. What did you learn about the training of an AI?
  3. How important is the background when training and recognising images?

IMPORTANT NOTE – AUTOMATIC DELETION OF AI MODELS.

By default, after 24 hours Machine Learning for Kids automatically deletes AI models trained by students. As a teacher, you can increase this time to as much as 1.5 weeks (but remember that there is a limited number of models that a class can have at any time). Student training data is not deleted, so models can always be retrained.

IMPORTANT NOTE – SAVING PROGRAMS.

To accommodate each AI model, a custom Scratch 3 environment is launched when you select Make. This is different from the regular Scratch 3 environment accessed at scratch.mit.edu. Programs cannot be shared or uploaded across the two different environments. This means several things:

  • Students cannot easily share their programs with the teacher or other students. Assessment evidence may need to be screenshots, video recordings or teacher observations.
  • Students who wish to keep a program at the end of a lesson must download it as a file. Later, they must re-enter the custom Scratch environment by clicking the Make button in their Machine Learning for Kids project. Then, they can upload the program file again. Also see the note 'Automatic deletion of models' at the end of Training the AI.


Discussion

Share what you have learned about AI and how ‘smart’ a computer can be.

  • Consider the program you created. How well did it use or mimic AI.
  • Discuss potential privacy issues and potential misuse of your personal image uploaded to applications. Explain why we avoided using an image of ourselves and others in the program.

Why is this relevant

Algorithms and programming are essential to developing machines powered by artificial intelligence (AI). AI is the ability of machines to mimic human capabilities in a way that we would consider 'smart'.

In conventional programming the computer is provided with a set of instructions for a defined set of scenarios. In the 4-digit PIN program and the basic image unlock program, the students hard-coded the program with specific inputs to create an output. To include an AI model we used Machine Learning for Kids to use the AI to recognise images as ‘granted’ or ‘denied’.

Machine learning (ML) is an application of AI. With machine learning, we give the machine lots of examples of data, demonstrating what we would like it to do so that it can figure out how to achieve a goal on its own. The machine learns and adapts its strategy to achieve this goal.

This lesson focuses on:

  • text recognition
  • image recognition
  • training an AI with suitable data.

Resources


Articles