Friday, December 5, 2025

AI-Powered Smoking Detection System Using MaixCam and YOLOv5

EFY tested mark

Over the past few years, smoking prevalence among adults in India fell from 14.0% (2009-2010) to 10.7% (2016-2017), thanks to public smoking bans, advertising its harms, and higher taxation. Despite this, tobacco use remains high—particularly smokeless varieties—and occasional public smoking still occurs in parks, train toilets, and office cabins.

This system deploys an automated detector that sounds a buzzer alarm and captures a MaixCam snapshot on the SD card whenever a cigarette is lit or smoked, alerting nearby individuals and deterring the smoker.

Demo Video

Fig. 1 shows the MaixCam board used in this system. The components required to assemble the unit are listed in the Bill of Materials table.

- Advertisement -
MaixCam board
Fig. 1: MaixCam board

EFY note: As this board has been used previously, refer to related articles published in the April and May issues. Those articles offer additional details on the MaixCam development board.

Here are those two articles: Detecting Workers Without Helmets and Real-time Face Recognition.

- Advertisement -
Bill of Materials
ComponentsQuantity
MaixCam1
5V power adaptor1
LED2

Operating System

The MaixCam runs a lightweight, custom Linux-based operating system designed specifically for Kendryte K210 boards. Key features include:

  • Integrated support for YOLOv5 through YOLOv8
  • Headless mode for efficient remote operation
  • Python 3.11 for scripting and automation
  • SSH daemon for secure remote access

This configuration supports real-time machine learning and is well-suited for entry-level AI systems and lightweight edge AI applications. Fig. 2 shows the pin description of the MaixCam device.

Working

For smoker detection, the system uses a pre-trained and modified Chinese neural network (YOLOv5) model named `smoking.mud,` which internally uses `smoking.cvimodel.` The model is uploaded to the `/root/models` directory or another designated location on the MaixCam board’s SD card.

The MaixCam’s camera captures images at a 320×240 resolution in high-resolution 24-bit RGB format. These images are processed using a Python script that runs the YOLOv5 neural network model to analyse each frame and determine whether the smoke is caused by a smoker or if a burning cigarette is present (see Fig. 3). The pre-trained model does not detect smoke alone in the absence of a cigarette (see Fig. 4). A visible cigarette must be present in the image for a positive detection.

Cigarette with smoke
Fig. 3: Cigarette with smoke
Fig. 4: Cigarette’s Smoke

Upon detection of a smoker, the following actions are triggered:

EFY Icon

Sorry! You cannot read this post further, as this is for EFY PRIME subscribers only.

EFY PRIME subscribers get access to our BEST content, in an AD-free environment for readers who value faster and clutter-free reading experience.

If you're already an EFY PRIME subscriber, please login below. Else, please make a small investment by
CLICKING HERE and upgrade your level to access this and many more of such content.

SHARE YOUR THOUGHTS & COMMENTS

Somnath Bera
Somnath Bera
Somnath Bera combines industrial leadership in thermal power systems with expertise in electronics, IoT, AI, and embedded systems. Through his prolific contributions to EFY, plus public demos and tutorials, he empowers both hobbyists and professionals with practical, impactful projects. His work reflects a rare blend of deep technical knowledge and hands-on innovation aimed at solving real-world problems.
×