Touchpad Password-Protected Device Using Python STEM Board

a black and yellow sign with letters
Johan JoeThomas
I am a 6th grader from California and I love to read and code.

About the Project:

Have you ever thought of having your own digital locker to protect the things you treasure? Like a digital locker for your treasure box, yes, it’s possible! When you enter the correct password in the digital locker’s touchpad, the box gets opened; otherwise, it’s kept closed, and your things are safe.

You could build a digital locker using a Python STEM Board, which has a cool touchpad LED screen and more,  this board could be programmed using Micro-Python.

You can also enhance the locker by adding lights and sound effects and you could even set an alarm for entering the wrong password!

Components Needed

  1. ESP-WROOM-32 dual-core Python Board (The main component we will use)
  2. USB cable (For connecting it to the computer)
  3. Computer (For coding)
  4. OLED screen (To show the output on the board)
  5. Touchpads (To enter the password)
  6. RGB LEDs and Buzzer (Optional, for light sound effects and alarm)

The Key Programming-Steps

1. Initialize:

  • Import mPython libraries.
  • Set up touchpads, OLED screen, RGB LEDs, and buzzer.
  • Define password (e.g., [“N”, “O”, “H”, “T”, “Y”, “P”]).

2. Display Instructions:

  • Show “Enter your password” and placeholders * * * * * * on OLED.

3. Input Detection:

  • Loop through each password character:
    • Wait for the touchpad press.
    • Compare input with the password character.

4. Password Attempts:

  • Track failed attempts (e.g., limit to 3 attempts).
  • If max attempts are reached, lock the system temporarily and display a message.

5. Feedback:

  • If correct: Show “Device Unlocked” on OLED, turn RGB LEDs green.
  • If incorrect: Show “Wrong Password” on OLED, turn LEDs red, play buzzer sound.

6. Optional Enhancements:

  • Password Change: Allow users to change the password after successful login.
  • Buzzer: Sound buzzer for wrong password attempts.
  • Max Attempts: Limit the number of attempts before locking the system.
Python
Initialize mPython libraries

Initialize touchpads, OLED, RGB LEDs

Display instructions on OLED: "Enter your password" and "using Touchpad"

Define password as ["Y", "N", "P", "T", "H", "O"]

Set i to 0 (index of password)

While i < 6:

    Check if any touchpad is pressed

    If touchpad pressed, compare input with the password at position i

        If wrong, exit loop (wrong password)

    If correct, increment i

    Wait for 1 second

If i < 6 (wrong password):

    Set RGB LEDs to red

    Display "WRONG PASSWORD" on OLED

Else (password correct):

    Set RGB LEDs to yellow

    Display "Device unlocked!!!" on OLED