Skip to main content

Case 12: Anti-theft alarm

Introduction

This course aims to guide students to make an anti-theft car case, combining the functions of micro:bit to make the case.

Teaching objectives

Combining the functions of micro:bit to make the case.

Teaching preparation

Before starting the teaching, please make sure you have prepared the following necessary materials:

PictureNameNumberNote
TPbot Edu1
USB Cable1
micro:bit1Prepare on your own
PC1Prepare on your own

Course Introduction

Hello everyone! In today's class, we will make a very practical project - an anti-theft alarm system for a car. Imagine how cool it would be if your car could automatically sound an alarm when it is touched or moved when unattended!

With the development of technology, anti-theft systems have become an important tool for protecting property safety. In this class, we will use the vibration detection function of micro:bit to achieve this goal. The accelerometer of micro:bit can sense vibration, and we will use this feature to detect whether the car has been illegally moved.

Exploration Activities

What other applications does the vibration detection function of micro:bit have?

Software

Microsoft MakeCode

Programming

Click Advanced in the code drawer of MakeCode to view more code options.

In order to program TPbot Edu, we need to add an extension library. Find "Extensions" at the bottom of the code drawer and click it. A dialog box will pop up to search for "tpbot" and then click to download this code library.

Sample program

Program

Please refer to the program link: https://makecode.microbit.org/_9zLA6j87HDha

You can also download the program directly from the following website.

Conclusion

When the car vibrates, it will automatically alarm.

Extended Knowledge

What other applications does the vibration detection function of micro:bit have?

The vibration detection function of micro:bit is realized through its built-in three-axis acceleration sensor and can be applied to a variety of creative projects and educational activities. Here are some specific application examples:

  1. Small production of sitting behavior training The vibration detector made by micro:bit can remind people to sit civilized and keep a stable sitting posture. When human body vibration (such as shaking legs and shaking the body) is detected, micro:bit will change from a smiling face to a crying face and make a prompt sound.

  2. Game watch Using the vibration detection function of micro:bit, you can make a game watch, which can display patterns through key switches or vibrations, and play games with friends.

These applications show the diversity and practicality of micro:bit's vibration detection function, and they have broad application prospects in education, entertainment and daily applications. Through these projects, students and enthusiasts can learn the use of sensors, programming logic and the basics of electronic production.