Skip to main content

From Motion to Meaning: Detect your nose in Scratch 3

From Motion to Meaning: Detect your nose in Scratch 3

When I first wrote about Scratch and Webcams back in 2019, the excitement was centred on the "New Frontier" of Scratch 3.0. We were exploring how to bring back the classic video sensing features—making cats jump or bubbles burst when we waved our hands. At the time, that was the peak of "Magic" in the classroom: the physical world interacting with the digital one.

Fast forward to today, and the landscape for STEM educators and makers has shifted. We are no longer satisfied with the computer merely knowing that something moved; we want the computer to know what is moving  We have moved from simple motion detection to Artificial Intelligence and Computer Vision.

If you want to re-energize your STEM lab or maker space, it’s time to move beyond the basic Video Sensing blocks and dive into the Face Sensing extension, So here is an example project playing with htese ideas.


The Project: The Nose-Tracking Security "Mask"

The goal of this project is to create a digital lock. When no one is present, a "Green Button" sits idle on the screen. But the moment a face is detected, the AI springs into action, switches to a "Red Button," and physically tracks your nose as you move.

Think of it as a biometric "Privacy Shield"—the computer recognises you and immediately places a digital mask over your face.

face coveredd with a big red button



Step 1: Create the buttons

You will need two costumes for your "Lock" sprite:

  1. Button 1: The standard button from the Scratch library (Green).

  2. Button 2: A modified version with the centre filled in (Red).

creating the sprites as two button

Button2 just has the centre filled in, button 1 is the standard one from the library of sprites.


Step 2: The Idle State

Start with the camera closed or covered. We want the program to behave like a standard screensaver when no one is around, placing the green button randomly on the screen to show the system is "Ready."

scratch blocks for the idle state



Step 3: Adding the AI Magic

To level up, you need to add the Face Sensing extension (found in the Extensions menu in the bottom-left corner). Once added, you’ll see a brand-new set of blocks that can detect eyes, ears, and—most importantly for us—the nose.

We are going to use logic that continually checks the environment:

  • If a face is detected: Switch to the Red Button (Button 2) and use the go to [nose] block.

  • If no face is detected: Switch back to the Green Button and return to the random "idle" movement.

Using the face sensing extension 

The face-sensing blocks in the extension library

We have a number of new blocks to play with

the face-sensing blocks


We are going to use the logic that the program continuously checks 

- if the face is detected, then go to the nose and change the button to the red burron (Button2) and then place it on the nose - check tracking the nose;

-if there is not a face detected, then switch to the green button


The complete code with all the blocks


The "Aha!" Moment

What was the "wow" moment for me? It was the precision.

Using such a simple set of blocks, the tracking is incredibly robust. Even when I moved my head quickly or tilted to the side, the AI kept that red button pinned exactly to my nose. In 2019, this would have required complex coding; in 2026, it’s a three-block script. It proves to students that AI isn't "magic"—it's just very clever math that they can control


Where can we go next?

The possibilities for makers are endless:

  • The Biometric Password: Create a screen that only hides or reveals a "secret" message once a face is detected.

  • Physical Integration: Connect a Micro:bit. When the nose is detected, have a physical servo motor move a latch or ring a bell.

  • More AI: Go further by using Machine Learning for Kids to train the computer to recognise specific faces or objects.

By building this, students aren't just consumers of AI technology—they are the architects of it.

What will you build with Face Sensing? Let me know in the comments!



All opinions in this blog are the Author's and should not in any way be seen as reflecting the views of any organisation the Author has any association with. Twitter @scottturneruon

Comments

Popular posts from this blog

Robot Software

In the previous blog posts for this 'series' "It is a good time...."  Post 1  looked at the hardware unpinning some of this positive rise in robots; Post 2  looked at social robots; Post 3  looked at a collection of small robots; Post 4 looked at further examples of small robots Robots, such as the forthcoming Buddy and JIBO, will be based some established open sourceand other technologies. Jibo will be based around various technologies including Electron and JavaScript (for more details see:  http://blog.jibo.com/2015/07/29/jibo-making-development-readily-accessible-to-all-developers/ ). Buddy is expected to be developed around tools for Unity3d, Arduino and OpenCV, and support Python, C++, C#, Java and JavaScript (for more details see http://www.roboticstrends.com/article/customize_your_buddy_companion_robot_with_this_software_development_kit ).  This post contin ues with some of the software being used with the smaller robots.  A number ...

Speech Recognition in Scratch 3 - turning Hello into Bonjour!

The Raspberry Pi Foundation recently released a programming activity Alien Language , with support Dale from Machine Learning for Kids , that is a brilliant use of Scratch 3 - Speech Recognition to control a sprite in an alien language. Do the activity, and it is very much worth doing, and it will make sense! I  would also recommend going to the  machinelearningforkids.co.uk   site anyway it is full of exciting things to do (for example loads of activities  https://machinelearningforkids.co.uk/#!/worksheets  ) . Scratch 3 has lots of extensions that are accessible through the Extension button in the Scratch 3 editor (see below) which add new fun new blocks to play with. The critical thing for this post is  Machine Learning for Kids  have created a Scratch 3 template with their own extensions for Scratch 3 within it  https://machinelearningforkids.co.uk/scratch3/ . One of which is a Speech to Text extension (see below). You must use this one ...

Scratch and web-cams in Scratch 3

Scratch 3 was launched on 2nd January 2019, so I wanted to know would Webcams still work with Scratch 3 as it did with Scratch 2. For example, in a previous post  Scratch, webcams, cats and explosions  the cat (Scratch) moved across the screen and a button burst when the object moved in the camera onto it.  Can the same thing be done in Scratch 3? The short answer is yes, but it is done slightly differently. The first change the video capture is not there in the blocks automatically; but is an extension that needs to be added. First, you need to add the extension blocks for video sensing. Go to the little icon at the bottom left of the screen (as shown below) this takes you to the extensions menu. Next, find the Video Sensing option and selected. The webcam, if enabled, with start automatically. A video sensing set of blocks is now in the list of block options.  The rest is very similar to doing this in Scratch 2. Moving ...