About this product
In this project, we are making a Cows and Bulls game in which Keypad membrane is used. This is an old code-breaking mind or paper and pencil game for two or more players, predating the similar commercially marketed board game Mastermind
KIT INCLUDES
Arduino Uno with USB Cable - 1
16x2 LCD Display - 1
10k potentiometer - 1
Single stand wire 2 mt - 1
4x4 keypad membrane – 1
Breadboard (840 pins) – 1
Jumper wires(Male to Male) – 40 pcs
9v Battery -2
DC Jack snapper – 1
snapper - 1
HARDWARE REQUIRED
Arduino Uno with USB Cable - 1
16x2 LCD Display - 1
10k potentiometer - 1
Single stand wire 2 mt - 1
4x4 keypad membrane – 1
Breadboard (840 pins) – 1
Jumper wires(Male to Male) – 40 pcs
9v Battery -2
DC Jack snapper – 1
snapper - 1
SOFTWARE REQUIRED
Arduino IDE 1.8.5 (programmable platform for Arduino)
Click To Download: https://www.arduino.cc/en/Main/Software
SPECIFICATIONS
16*2 LCD Display
LCD Display Mode: STN, Positive, Transflective
Display Color: Deep Blue/ Yellow Green
Viewing Angle: 6H
Driving Method: 1/16 duty, 1/5 bias
Back Light: Yellow-Green LED backlight
Outline Dimension: 803615.8 MAX
4*4 Keypad membrane
Maximum Rating: 24 VDC, 30 mA
Interface: 8-pin access to a 4x4 matrix
Operating temperature: 32 to 122 °F(0 to 50°C)
Dimensions: Keypad, 2.7 x 3.0 in (6.9 x 7.6 cm),Cable: 0.78 x 3.5 in (2.0 x 8.8 cm)
PIN DESCRIPTION
16*2 LCD Display
Symbol
External Connection
Function
VSS
Power Supply
Signal GROUND for lcm
VDD
POWER SUPPLY for logic lcm
V0
Contrast Adjust
RS
MPU
Register Select Signal
RW
MPU
Read/Write Select Signal
E
MPU
Operation Enable Signal
DB0~DB3
MPU
Four Low order bidirectional three state bus lines. Used for data transfer between the MPU and LCM. These four are not used between 4 Bit operations.
DB4~DB7
MPU
Four high order bidirectional Three state bus lines used for data transfer between the MPU
A
LED BKL power Supply
Power Supply for BKL
K
4*4 Keypad membrane
Matrix keypads use a combination of four rows and four columns to provide button states to the host device, typically a microcontroller. Underneath each key is a push button, with one end connected to one row, and the other end connected to one column
CIRCUIT CONNECTION
16*2 LCD to Arduino Uno
16*2 LCD
Arduino Uno & other
VSS
GND(make a negative rail on breadboard for making further gnd connection)
VDD
5V (make a positive rail on breadboard for making further 5v connection)
V0
Variable terminal pin of 10K potentiometer (Mid pin)
RS
Digital pin 7 (arduino)
RW
Gnd
E
Digital pin 8 (arduino)
D0
Na
D1
Na
D2
Na
D3
Na
D4
Digital pin 9 (arduino)
D5
Digital pin 10 (arduino)
D6
Digital pin 11 (arduino)
D7
Digital pin 12 (arduino)
A
5v on breadboard 5v rail
K
GND
4*4 Keypad membrane to Arduino Uno
4*4 Keypad Membrane (Right Side)
Arduino Uno
Pin 1(on right side of Membrane)
Digital Pin 0 (RX)
Pin 2
Digital Pin 1(TX)
Pin 3
Digital pin 2
Pin 4
Digital pin 3
Pin 5
Digital pin 4
Pin 6
Digital pin 5
Pin 7
Digital pin 6
Pin 8(on left side of Membrane)
Digital pin 13
CODE
Click to see the code
https://docs.google.com/document/d/e/2PACX-1vRXercHOLKZXfl_wZQEBSWdp4mbXuSRTB9ZsLpXCp9qYxXyJAVUfVdt9c1mMYdSj9Ro_vuM5RIHIJ0v/pub
WORKING
This is an old code-breaking mind or paper and pencil game for two or more players, predating the similar commercially marketed board game Mastermind.
It is a game with numbers that may date back a century or more. It is played by two opponents.
On a sheet of paper, the players each write a 4-digit secret number.
The digits must be all different. Then, in turn, the players try to guess their opponent's number who gives the number of matches. If the matching digits are in their right positions, they are "bulls", if in different positions, they are "cows". Example:
Secret number: 4271 Opponent's try: 1234 Answer: 1 bull and 2 cows. (The bull is "2", the cows are "4" and "1".)
This time is made for playing against the Arduino, which generates 4 random digits that are not repeated.
The player enters its 4 digits through the keypad and press key D to confirm the digits. The lcd displays the amount of cows and bulls that the player gets. After 5 tries you have not guessed the secret number, you lost and the secret number is shown.
Pressing the key 'A' starts a new game.
Pressing the key 'B' resigns the game and shows the secret number.