This premium tutorial will teach you how to combine a keypad, a TM1637 4-digit 7-segment display, a relay, a solenoid lock, and an Arduino Uno.
The display shows the input from the keypad, a Pincode. If the user enters the correct code, the solenoid lock unlocks.
The tutorial explains the code in detail, so you should have no problems modifying it to suit your needs. The code allows you to add multiple passwords. The passwords are predefined in the code.
Wiring diagrams are included in this tutorial. The tutorial starts with a breadboard layout that shows all the connections. This breadboard layout is explained in 3 sections. Each module connection is explained.
If you are new to Arduino, please visit the below tutorials before continuing.
What you will need to know?
Before continuing with this guide, you may want to check out any topics from the list below that sound unfamiliar.
Arduinoplatform is a participant in several affiliate programs. This means that I will earn a commision if you buy a product from the affiliated websites through clicking on the links provided above.
Most displays require a lot of connection pins. That is quite complex and does not leave much space for other sensors or modules to connect with the Arduino Board. The TM1637 display module only uses four pins. Two pins are required for the power connections and the other two are used to control display.
A 7-segment display contain individually addressable LEDs. The segments are labeled from A to G. To be able to set the LEDs you should know which segment corresponds to which letter. The image shows how the display segments are labeled.
TM1367 Wire connection
TM1637 4-digit display
Keypad 3 x 4
The buttons of each keypad are arranged in rows and columns. The keypad that we are using has 4 rows and 3 columns. Beneath each key is a switch. Each switch is connected with the other switches in the row. Each row and column should be connected to the Arduino Board. In total, we have 7 pins that we are going to connect.
Arduino detects which button is pressed on the keypad by detecting the row and columns pin that is detected to the button.
Keypad wire connections
3x4 Matrix Keypad
Pins 1 till 7
Pin 7 till 13
The relay module gives you the ability to separate two different circuits with different voltages. In the breadboard layout, the solenoid lock is separate from the Arduino Board with a relay module. The Arduino Board controls the relay. When the relay is activated, a HIGH signal is sent to the module. The 12 volts circuit is “activated.” This allows us to control the solenoid lock with a different voltage circuit (12V) with the 5V circuit from the Arduino Board. For the wire connection of the relay module with the Arduino Board, it is important to decide whether you want the relay to act as normally closed or as normally open.
COM: common pin
NC (Normally Closed): the normally closed configuration is used when you want the relay to be closed by default, meaning the current is flowing unless you send a signal from the Arduino to the relay module to open the circuit and stop the current.
NO (Normally Open): the normally open configuration works the other way around: the relay is always open, so the circuit is broken unless you send a signal from the Arduino to close the circuit.
Relay wire connections
GND DC Jack
The Arduino Board controls the solenoid lock. As stated above, the board sends a signal to the relay module that turns the solenoid on and off. The lock works only with electricity, so the lock cannot be opened or closed in case of power failure.
Solenoid Wire connections
Relay / Power Supply
NO Output relay
GND DC Power supply
The code that in this article is a paid part of the website. For only 10 dollars, you will be able to see and use the code. Most of the articles are free. However, the premium articles enable me to take time off my job and write more articles.
Furthermore, if there are any questions regarding adjustment, feel free to ask them in the comment section.
In summary, this premium code controls a solenoid lock by entering the correct password with a keypad (code is displayed on a TM1367 Display).
To access content from the group Password Protected Lock please activate subscription.
To view this post please login and activate subscription.