Skip to main content

Case 01 AI Alarming Device


This course will guide students to create an AI alarm using the Nezha Inventor Kit V2 and AI Expansion Pack. With the face recognition function of the AI Lens, a rainbow light effect will be triggered and accompanied by a buzzer alarm when someone approaches the predefined range. Students will learn how to combine hardware and AI technology to create an interesting device with practical applications.

Teaching Objectives

  • Understand the use of AI technology in daily life.
  • Learn to make AI alarms.
  • Develop problem solving and creative design skills.

Teaching Preparation

Nezha Inventor's Kit V2

AI Accessories Pack

A Computer

Teaching Process


Teachers can guide students to think about the following questions: what is face recognition technology? What are its real-life applications? How can this technology be used in an interesting device, such as an AI alarm? These questions will stimulate students' interest and lead them to think about how to combine technology with creativity.

Hi everyone! In today's lesson, we will explore the amazing world of AI. We will be making a special AI alarm that recognises faces through the camera and will display rainbow lights and loud beeps when someone approaches. How is this achieved? The answer lies in the face recognition feature of the AI lens. Let's get our hands on and explore how technology can play a role in our daily lives, let's use our creativity and skills to create an amazing piece of work!


Group discussion to get students to think about how to make an AI alarm using an AI lens, focusing on the use of face recognition features and the use of AI technology in daily life.

​ How does face recognition technology work? How does it recognise a person's face?

  • How to connect the AI lens and components such as rainbow light effect and buzzer, and write a programme to achieve the alarm effect when someone approaches within a predefined range?
  • How to debug and optimise the performance of the alarm to ensure accuracy of face recognition and timeliness of the alarm?


Work in groups to make an AI alarm from building block materials according to your own design scheme.

Follow your own design scheme to make an AI alarm using building block materials.


Assembly Steps

Assembly Completed

Hardware Connections

Connect the Rainbow LED to J1 and the AI lens to the IIC port on Nezha breakout board.

Software Programming

Go to makecode

Create New Project

Click "Extensions"

Search with planetx and have it downloaded.



You may download it directly below:

Teamwork and Display

Students are divided into small groups and work together to create and programme the case.

Students are encouraged to co-operate, communicate and share their experiences with each other.

Each group has the opportunity to present the cases they have produced to the other groups.

Example cases

When the AI lens detects a human face it will automatically sound an alarm and the rainbow light ring will flash.


Group sharing allows students in each group to share their production process and insights, summarise the problems and solutions they encountered, and evaluate their strengths and weaknesses.

Extended Knowledge

What is artificial intelligence?

Artificial Intelligence (AI) is a computer system and technology that simulates intelligent human thinking and behaviour. It aims to equip computers with human-like cognitive abilities to understand, learn, reason, solve problems and adapt to new situations. Artificial Intelligence involves a variety of technologies and methods, including:

Machine Learning : Machine learning is a key branch of AI that enables computers to learn from data and improve performance without explicit programming. Machine learning algorithms enable computers to make predictions or decisions based on pattern recognition from past data.

Deep Learning: Deep learning is a special form of machine learning that uses models called neural networks to simulate the structure and function of neurons in the human brain. Deep learning has achieved significant results in areas such as image recognition, speech recognition, and natural language processing.

NATURAL LANGUAGE PROCESSING: Natural language processing is the technology that allows computers to understand, process and generate human language. It involves areas such as text analysis, semantic understanding, and machine translation.

Computer Vision: Computer vision enables computers to understand and interpret images and videos. It is used in areas such as object detection, face recognition, and medical image analysis.

Reinforcement Learning: Reinforcement learning is a technique that allows computers to learn optimal behaviour by interacting with their environment. It has applications in areas such as autonomous driving and game strategy.

Knowledge Representation and Reasoning: These techniques enable computers to store and process complex knowledge and use logical reasoning to solve problems.

Human-Computer Interaction: Artificial Intelligence also involves improving the way people interact with computers to make them more natural and intelligent, such as voice assistants and intelligent dialogue systems.

Artificial intelligence aims to mimic many aspects of human intelligence, but not necessarily all. It has already achieved remarkable success in many areas, but still faces challenges in some areas, such as common sense reasoning, emotional understanding, and truly intelligent creativity.

Applications of Artificial Intelligence Technology in Life.

Artificial Intelligence technology has been widely used in various areas of daily life, here are some examples:

Intelligent Assistants: Virtual assistants such as Siri, Google Assistant and Alexa use speech recognition and natural language processing technologies to help people perform tasks such as setting reminders, finding information, playing music etc.

Social media: Social media platforms use AI technology to analyse users' interests and behaviour to recommend content, friends and advertisements. In addition, image recognition technology can also automatically identify people and objects in photos, making it easy for users to tag and share them.

Recommender systems: In streaming media platforms, e-commerce sites and news apps, recommender systems use AI to analyse users' historical behaviours and preferences, and recommend content they may be interested in, thus improving the user experience.

Smart Home: IoT devices combined with AI technology enable automated operation of home devices such as smart lighting, smart temperature control, and smart appliances that can be managed through mobile apps or voice control.

Medical Diagnostics: Medical image analysis uses computer vision technology to assist doctors in diagnosis, such as through scanning results to help detect diseases, such as cancer. In addition, AI can analyse large amounts of medical data to provide personalised treatment recommendations.

Self-driving: Self-driving cars use sensors and AI algorithms to sense their surroundings and make driving decisions, enabling driverless or assisted driving.