Hello, I just made this little project, I hope you like it, as the title says it's about how to use a keypad to set the DS1302, it's one of the basic projects you can add it to your own project if you want to add other modules or functions... It's very easy to understand and adaptable, I hope you like it and find it useful.
Watch the video above if you need further help, or ask in a comment it's a pleasure.
Step 1: Modules and Material Needed
For this, we'll need:
-Arduino board here I'm using Arduino UNO
-DS1302 RTC module
-4*4 or 4*3 Matrix Keypad here I used 4*4
-LCD i2c screen
Some jump wires and 1k resistor (Only if you have RTC problem)
Step 2: Wiring
The wiring as the schematic shows it:
-Keypad pins: 1-8 with D5-D12
-RTC DS1302: - Vcc - 5v
- GND - GND
- CLK - D2
- DAT- (1k resistor optionnal, if only you get priting problem) - D3
- RST - D4
-LCD i2c: - Vcc - 5v
- GND - GND
- SDA - A4
- SCL - A5
Step 3: Libraries, Code and Functioning
Here you can download all libraries I've used (.zip) ready to install and code in ".ino" format:
And here's the code: Download Code
Functioning: After wiring, uploading the code, power your Arduino board, normally a default or set-before date and time should appear on the LCD, you press "*" to start setting up using the keypad, it will ask you to set the year, month ... When you press the button the program automatically store the values, example: when it will asks you to set the year you press (2-0-1-8) it will automatically be stored then it will asks you to enter month... for month, hour... you should always enter two digits like for April (0-4)...
I didn't add seconds neither day of the week, "Laziness :D :D" add them if you want.
Feel free to leave a comment, suggestion or a question if you have a problem.