Implement a microcontroller/microprocessor-based application to operate a password-protected locker with machine-to-machine (M2M) communication incorporated in the design. Password is entered through a keypad and a digital display (LCD or seven-segment display) is used to show the current status of the locker. If the locker door is latched, password can be entered by the user to unlatch it. The password entered, by the user, is sent by the microcontroller (which we call the transmitter microcontroller) to another serially interfaced (UART) microcontroller (called the receiver microcontroller). At the receiver end, password entered is matched to the correct password of the respective locker. On ‘successful match’, a servo-motor interfaced with the receiver microcontroller is used to latch or unlatch the locker door. A dip switch/push button or any other mechanism can be used to latch the door-lock at the receiver microcontroller when the user wants it, thus updating the status of the locker at the transmitter end. The design should be robust enough to handle incorrect passwords entered. The design can be enhanced as per the vision of the design team, however, keeping the basic functionality and requirements in perspective.
- AVR kit
- Jumper Wires
- Servomotor
- Keypad
- Atmel Studio
- Proteus
- Khazama
- Build Receiver Code and Transmitter code on Atmel Studio.
- From Khazama, upload hex files on AVR kits.
- Connect wires as shown in Proteus.
- Again connect from CPU to power AVR kits.
Keypad is interfaced with the 4 MSB bits of DDRD register. The MSBs are then right shifted 4 times and AND masked to get an 8 bit number which is then used to get the index of a lookup array. The index of the lookup array then tells which key is pressed.
The pressed key is then transmitted to the receiver through USART port. PD0 and PD1 are used to connect the transmitter and receiver with each other. The transmitter first transmits to the receiver in order to initiate handshaking. And then when it is acknowledged by the receiver it then puts the key pressed into UDR register and its contents are then transmitted through pin PD0 serially.
The status of door transmitted by the receiver is received by the transmitter through pin PD1 which is then saved into variable receiveData.
The contents of variable receiveData are then sent to PORT A register which is declared as output register. It is then connected to the seven segment dislay where the door status is displayed.
The password sent by the transmitter is received through pin PD1 by the receiver.
The password is matched with the original password.
If the password matches and the push button is not pressed the servomotor rotates to 90 degrees and the door is unlatched. A variable status is updated and contains the new status of the door.
The status of the door is then transmitted back to the transmitter through pin PD0.
If the push button is pressed the door is latched and the status of door is updated to C which means closed.
I have used Proteus for simulation.