- Detection of human activities is a set of techniques that can be used in wide range of applications, including smart homes and healthcare.
- In Activity recognition, we need to correctly identify and recognize the individual’s current activities.
- Designed an IoT device to monitor the activities of the user, without breaching the privacy of the user.
- Implemented KNN Algorithm to learn the pattern in the sensor data, which has been used to recognize the user activity.
- The IoT device is placed in the Robotics Lab in Dept. of Computer Science at IIT Guwahati.
- The IoT device is fitted with PIR, PING and LIGHT sensor. All these sensors gave us different sensor values of the student's activities performed in the lab.
![]() |
|
---|---|
IoT device setup | System Architecture for the test bed |
The following four classes have been identified suitable for the problem.
- Sitting + Screen ON
- Idle + Screen ON
- Sitting + Screen OFF
- Idle + Screen OFF
- The data has been collected for 24 hours each day and it has been manually annotated.
- The following is the snapshot of the readings from LIGHT, PING and PIR sensor, during the beginning of SITTING activity.
Data recorded from IoT - Annotated | Normalized data |
- The light sensor provides us the luminosity in the environment.
- It is fixed to the system monitor, which has been used to infer whether the system monitor is ON / OFF.
- Assuming each individual in the lab has an independent system, we can use this light sensor information to infer,
- When did the individual start working each day
- What is the total duration of working time, each day
- Raspberry Pi is used to trigger the Ping sensor to send an ultrasonic pulse.
- The pulse waves bounce off from any nearby objects and some are reflected back to the sensor.
- The sensor detects these return waves and measures the time gap between the trigger and returned pulse.
- This information will be utilized to identify, if there is any human in-front of the system.
- Ping sensor cannot differentiate an object / chair from a human being.
- PIR sensor can detects changes in the amount of infrared radiation it receives.
- The infrared heat emitted by the human body is used to detect the motion of a human being before the system.
- SITTING activity cannot be recognized only with the help of PING sensor, due to the interruption of the PING values because of other objects like chair.
- Hence, PIR and PING is used as a combination to track this activity.
- If we analyse the data, we can infer that the PIR values show human motion from time-step 10-20 and the PING reading has dropped down ultimately at 22, indicating some person has come-in and sat before the system.
- Clone the repository and retain the same folder structure with the dataset in place.
- Execute the following command.
python knn.py
- The data collected from the IoT device is manually annotated.
- Raw data has been normalized to feed to the algorithm.
- The KNN algorithm has been implemented to identify the pattern in the sensor data and recognize the activity.
- The following is a snapshot of the KNN result.