77
Lesson 31 Password Lock
Introduction
After having learnt so many independent modules, let’s use several together to make some
comprehensive experiments. In this lesson, we use an LCD1602, a relay module, a
potentiometer and a keypad to assemble a simple password lock. The circuit is controlled
by the SunFounder Uno board and can be applied in security door. Let's get started!
Components
-
1 * SunFounder Uno board
- 1 * USB data cable
- 1 * Relay module
- 1 * LCD1602
- 1 * Keypad
- 1 * Potentiometer
- Several jumper wires
Experimental Principle
After the circuit and code are completed, first set a password (for example, 123456) with the
SunFounder Uno. Then input the password by the keypad. If this password is consistent with
what was set, the relay will be closed and the LED attached to pin 13 of the Uno will light up.
Otherwise, the relay will keep opened and the LED will be off.
Experimental Procedures
Step 1:
Build the circuit
Relay connection
: Connect pin S to pin 13 on the SunFounder board, pin - to GND, + to 5V
LCD1602 connection
: Connect pin RS to D0; R/W to GND; E to D1; D4~D7 to D2, D3, D4, and
D12; VSS to GND; VDD to 5V; A to 3.3V; K to GND
Potentiometer connection
: Connect the middle pin to VO of LCD1602 and any other pin to
GND
Keypad connection:
Connect row 1, 2, 3 and 4 to D11, D10, D9, and D8; connect column 1,
2, and 3 to D7, D6, and D5 (see the following figure for pins connected to columns and rows)
SunFounder