Smart Attendance System
The Smart Attendance System is an innovative solution developed using PictoBlox that automates the process of recording attendance in schools, offices, or any organization. Traditional attendance methods are time-consuming and prone to errors. This system addresses those issues by integrating AI-based face detection and CSV data management for accurate and efficient attendance tracking.
By using a webcam and simple block-based coding, the system identifies individuals, records their details like Employee ID and Name, and logs their login/logout times into a structured CSV file. The interface also supports dynamic paragraph blocks for improved user interaction.
This project demonstrates how AI and automation can be effectively used in educational settings or real-world scenarios to streamline routine tasks and ensure reliable data handling.
Supplies
- Computer with PictoBlox Installed
- Web Camera
- Internet connectivity
Setup the Stage
Open PictoBlox Software & select Block coding Environment.
Setup the Stage
Now add all the extensions that are mentioned below
- Face Detection
- Content creation
- Sheets & Data logger
- Text to Speech
Setup the Stage(Making Paragraph)
Click on the "content creation" Block palette & click on "make a Paragraph."
Setup the Stage(Making Paragraph)
- Add all the necessary details, such as name, header, body, and image.
- Create two buttons for Employee & Admin.
- Select size & theme, along with the alignment of text
Setup the Stage(Making Paragraph)
Please follow all the steps mentioned to create another paragraph.
- Add all the necessary details like Name, header, body, and image.
- Create three buttons for Login, Logout & Back
- Select size & theme, along with the alignment of text
Step-by-step Code Sequence
1) From the Events palette, drag:
- when green flag clicked
This begins the script when the project starts.
2) From the Looks palette, add:
- hide
This makes the sprite invisible at the start.
3) From the face detection extension blocks, add:
- turn off video on stage with 0% transparency
This disables the camera/video feed on the stage.
4) From the Data logger blocks, add:
- create file [Staff Attendance 2026]
This creates a file with the name Staff Attendance 2026
5) Now add the data-setting blocks one by one.
First data field:
- set data 1 to [EMP ID]
This stores the label for employee ID.
Second data field:
- set data 2 to [EMP Name]
This stores the label for employee name.
Third data field:
- set data 3 to [Login]
This stores the login field.
Fourth data field:
- set data 4 to [log out]
This stores the logout field.
6) Add the block:
- save data
This saves all the entries into the file you created.
7) Add the block:
- show [Intro] on stage
This displays the Intro screen or paragraph.
8) Add the block:
- hide [Employee] on stage
This hides the Employee screen or Paragraph.
Step-by-step Code Sequence
1) From the Content Creation, drag:
- when [Intro] [Employee] is clicked
This is the trigger that starts the script when that item is clicked.
2) From the Content Creation, drag:
- hide [Intro] on stage
This makes the Intro section disappear.
3) Add the next block:
- show [Employee] on stage
This makes the Employee section appear.
Step-by-step Code Sequence
1) From the Content Creation, drag:
- when [Employee] [Back] is clicked
This starts the script when the Back button on the Employee screen is clicked.
2) Add the block:
- show [Intro] on stage
This makes the Intro page visible again.
3) Add the block:
- hide [Employee] on stage
This removes the Employee page from the stage.
Step-by-step Code Sequence
1) From the Content Creation, drag:
- when [Intro] [Admin] is clicked
This starts the script when the Admin option on the Intro page is clicked.
2) Add the block:
- hide [Intro] on stage
This removes the Intro screen from the stage.
3) Add the asking block from the sensing palette:
- ask [What is the employee ID?] and wait
This prompts the user to enter the employee ID.
4) Add the data block:
- set [Emp ID] to [answer]
This saves the typed employee ID into the variable Emp ID.
5) Add another ask block:
- ask [What is the Name of employee ?] and wait
This asks for the employee’s name.
6) Add the next data block:
- set [EMP Name] to [answer]
This stores the entered name in the variable EMP Name.
7) Add the video block from face detection block palette:
- turn on video on stage with [0] % transparency
This activates the camera feed on the stage.
8) Add:
- wait [1] seconds
This gives the camera a moment to start properly.
9) Add:
- show [bounding box]
This displays the detection box on the camera image.
10) Add:
- wait [0.5] seconds
This adds a short pause before the next step.
11) Add from the face detection block palette:
- analyse image from [camera]
This tells PictoBlox to process the live camera image.
12) Add another pause:
- wait [0.5] seconds
This gives the system time before classification.
13) Add the classification block:
- add class [Emp ID] as [EMP Name] from [camera]
This links the camera capture with the entered employee details.
14) Add:
- wait [1] seconds
This allows the recognition/classification action to complete.
15) Add:
- turn off video on stage with [0] % transparency
This stops the camera feed.
16) Add from content creation block palette:
- show [Intro] on stage
This returns the display back to the Intro page.
Step-by-step Code Sequence
1) From the Content Creation, drag:
- when [Employee] [Login] is clicked
This starts the script when the Employee Login button is clicked.
2) Add:
- hide [Employee] on stage
This removes the Employee page from the screen.
3) Add from face detection block palette:
- turn on video on stage with [0] % transparency
This starts the camera feed with no transparency.
4) Add:
- wait [0.3] seconds
This gives the camera time to start properly.
5) Add:
- show [bounding box]
This displays the face-detection box on the camera.
6) Add:
- wait [0.2] seconds
This gives the system a short pause before analysis.
7) Add from face detection block palette:
- analyse image from [camera]
This processes the live camera image.
8) Add:
- wait [0.2] seconds
This gives the analysis a moment to complete.
9) Add from face detection block palette:
- do face matching on [camera]
This checks the face against the saved classes.
10) Add:
- wait [0.2] seconds
This gives the face matching operation time to finish.
First condition: Face Class 1 detected
11) Add:
- if [ ] then block
This checks whether Class 1 is recognized.
12) Inside the IF block, add:
- show
This makes the result visible.
13) Add:
- speak join [Hello] [get class of face 1 detected]
This speaks a greeting such as:
- Hello [name]
14) Add from face detection block palette:
- say [get class of face 1 detected] for [2] seconds
This displays the recognized name for 2 seconds.
15) Add from Content Creation & face detection:
- set [data 2] to [get class of face 1 detected]
This stores the employee name.
16) Add:
- set [data 1] to [01]
This stores the employee ID as 01.
17) Add:
- set [data 3] to [get timestamp]
This stores the login time.
18) Add:
- save data
This saves the attendance record.
Else branch for Class 2 and others
If Class 1 is not detected, the script moves to the next checks.
19) Wait before the next check, Add:
- wait [0.5] seconds
This pause appears before checking the next class.
Second condition: Face Class 2 detected
20) Add the next IF then block
- if [ ] is [2] class detected then
This checks whether Class 2 is recognized.
21) Inside this block, add:
- show
22) Add:
- speak join [Hello] [get class of face 1 detected]
23) Add:
- say [get class of face 1 detected] for [2] seconds
24) Add:
- set [data 2] to [get class of face 1 detected]
25) Add:
- set [data 1] to [02]
26) To save the timestamp, add:
- set [data 3] to [get timestamp]
27) To save the data, add:
- save data
Else branch for Class 3
Similarly, implement the script as per the classes' implementation over the images.
Step-by-step Code Sequence
1) From the Content Creation, drag:
- when [Employee] [Log out] is clicked
This starts the logout process when the Log out button is clicked.
2) Hide the Employee screen
Add:
- hide [Employee] on stage
This removes the Employee page from the stage.
3) Turn on the video feed
Add:
- turn on video on stage with [0] % transparency
This activates the camera feed.
4) Wait a short time
Add:
- wait [0.3] seconds
This gives the camera time to start properly.
5) Show the bounding box
Add:
- show [bounding box]
This displays the face-detection box on the camera view.
6) Wait again
Add:
- wait [0.2] seconds
This adds a short pause before analysis.
7) Analyse the image from the camera
Add:
- analyse image from [camera]
This processes the live camera image.
8) Wait again
Add:
- wait [0.2] seconds
This gives the analysis time to complete.
9) Do face matching
Add:
- do face matching on [camera]
This checks the captured face against the stored classes.
10) Wait again
Add:
- wait [0.2] seconds
This allows the face matching to finish.
First condition: Class 1 detected
11) Add the IF block
Add:
- if [ ] is [1] class detected then
This checks whether Class 1 is recognized.
12) Show the result
Inside the IF block, add:
- show
This makes the result visible.
13) Speak the logout message
Add:
- speak join [Thanks, See you tomorrow] [get class of face 1 detected]
This speaks a message like:
- Thanks, See you tomorrow [name]
14) Say the detected name
Add:
- say [get class of face 1 detected] for [2] seconds
This shows the detected name on screen for 2 seconds.
15) Save the detected name in data 2
Add:
- set [data 2] to [get class of face 1 detected]
This stores the employee name.
16) Save the employee ID in data 1
Add:
- set [data 1] to [01]
This stores the employee ID as 01.
17) Save the logout timestamp in data 4
Add:
- set [data 4] to [get timestamp]
This records the logout time.
18) Save the data
Add:
- save data
This saves the logout attendance record.
Else branch for Class 2 and Class 3
If Class 1 is not detected, the script moves to the next checks.
19) Wait before the next check
Add:
- wait [0.5] seconds
This pause appears before checking the next class.
Second condition: Class 2 detected
20) Add the next IF block
Add:
- if [ ] is [2] class detected then
This checks whether Class 2 is recognized.
21) Show the result
Inside this block, add:
- show
22) Speak the logout message
Add:
- speak join [Thanks, See you tomorrow] [get class of face 1 detected]
23) Say the detected name
Add:
- say [get class of face 1 detected] for [2] seconds
24) Save the detected name
Add:
- set [data 2] to [get class of face 1 detected]
25) Save the employee ID
Add:
- set [data 1] to [02]
26) Save the logout timestamp
Add:
- set [data 4] to [get timestamp]
27) Save the data
Add:
- save data
Else branch for Class 3
Similarly, implement the script as per the classes' implementation over the images.
Link: https://drive.google.com/drive/folders/1bmarB5eEn2WfvKRnICjlIc8zFvRtfcU_
Learning Outcomes
- Understand face detection and recognition using AI.
- Create an interactive UI with buttons and paragraphs.
- Use block-based coding for automation.
- Control the webcam and analyze real-time video.
- Record data in CSV format (login/logout).
- Capture and log timestamps.
- Develop real-world problem-solving skills.
Conclusion
The Smart Attendance System, developed in PictoBlox, successfully demonstrates how AI and automation can simplify everyday tasks like attendance tracking. By integrating face recognition, real-time timestamping, and data logging, the system ensures accuracy, efficiency, and ease of use. This project not only enhances technical skills in AI and programming but also provides a practical solution for modern institutions and workplaces.