Smart Door Lock System
In this project, we will build a Smart Door Lock System using Quarky and its AI face detection feature. The system detects the position of a person's face and automatically controls a servo motor to lock or unlock the door.
- When the detected face moves horizontally (X-axis), the system considers the user authorized and displays "ACCESS GRANTED" on Quarky's screen. The servo motor rotates to 90°, representing the unlocked door.
- When the detected face moves vertically (Y-axis), the system displays "LOCKED" on the screen. The servo motor returns to 0°, representing the locked door.
Supplies
- Pictoblox software Download PictoBlox | Windows, MacOS, Linux, Chromebook, Android & iOS
- Quarky
- Sensor
- Laptop
- RGB Display
Connect the Hardware
- A sensor is essentially any material or equipment that can detect an abstract or physical attribute.
- An ultrasonic sensor is an electrical device that uses ultrasonic sound waves to determine the distance to a target item. It is a demanding instrument in robotics as well as in industrial purposes.
Now we will connect the Ultrasonic Sensor to the Robot. The sensor and the robot have the following pins:
- Ultrasonic Sensor Pins:
- VCC
- GND
- Trig
- Echo
- Quarky Pins:
- GND
- V
- D1
- D2
We will start with connecting the ultrasonic sensor with Quarky using the 4 set wire provided in the kit. But, first, make the connection in the following way:
- First, connect the VCC of the ultrasonic sensor with the V pin on the Quarky.
- Connect the GND of the ultrasonic sensor with the Ground pin on the Quarky.
- Connect Trig of the ultrasonic sensor with D1/D2 pin on the Quarky.
- Finally, connect the Echo of the ultrasonic sensor with the D2/D1 pin on the Quarky.
- First, power On your Quarky.
- Start the PictoBlox Link.
- Open PictoBlox on your desktop.
- After that, select Block Coding as your coding environment.
Then, click the Board button in the toolbar and select board as Quarky.
To work with Quarky, you can connect Quarky to PictoBlox in two ways:
- Using USB-C Cable.
- Using Bluetooth.
Next, click the Connect button. We will connect Quarky to PictoBlox using Bluetooth. Thus from the dialog box that appears, click on Bluetooth Ports and then select the appropriate port from the list to connect Quarky.
- First, power ON Quarky.
- Open PictoBlox on your smartphone. Go to My Space and do a new project by clicking the ‘+(plus)’ button in the bottom-right corner.
Then, tap the Board button in the top-right corner of the toolbar.
Select board as Quarky.
Next, tap the Connect button.
Select the name of your Bluetooth module from the list.
Quarky is now connected to PictoBlox. Now, let’s make a script in PictoBlox to display expressions on Quarky’s matrix!
Unlock Condition – Access Granted & Lock Condition - Door Locked
When the face moves in the horizontal direction (X-axis):
- Detect the change in the X-coordinate.
- Display the message:
Access Granted
on Quarky's display.
- Rotate the servo motor to:
90deg
This represents that the door is unlocked and access has been granted to the authorized user.
Lock Condition – Door Locked
When the face moves in the vertical direction (Y-axis):
- Detect the change in the Y-coordinate.
- Display the message:
Locked
on Quarky's display.
- Rotate the servo motor to:
0deg
This indicates that the door remains locked.
Testing the System
Test 1: Horizontal Face Movement
- Move your face left or right.
- Observe the display showing "ACCESS GRANTED".
- Verify that the servo rotates to 90°.
Test 2: Vertical Face Movement
- Move your face up or down.
- Observe the display showing "LOCKED".
- Verify that the servo returns to 0°.
Repeat the tests multiple times to ensure the system works reliably.
Conclusion
The Smart Door Lock System Using Quarky demonstrates how AI-based face tracking can be integrated with hardware to automate security functions. By analyzing the face's X and Y positions, the system intelligently decides whether to unlock or lock the door. This project introduces learners to practical applications of Artificial Intelligence, servo control, and smart access systems, making it an engaging and innovative STEM project suitable for classrooms and exhibitions.