Pin Change Interrupt
Embedded Systems
A three-digit combination safe using a rotary encoder, register-level techniques, interrupts, a seven-segment display, and a bi-colour status LED.
Project
3.5
Controller
Arduino Nano
Input
Rotary Encoder
Output
7-Segment Display
Programming
Register Level
Project Context
The project was developed as a combination safe while expanding the Mega328P.h library and applying register-level techniques and interrupts through a physical circuit.
Reference
01
A rotary encoder allows the user to manually enter a three-digit combination through a seven-segment display.
The circuit consists of a 4511 seven-segment decoder, seven-segment display, bi-coloured LED, ACES debounce PCB, and ACES rotary encoder connected to an Arduino Nano.
The seven-segment display is driven by the 4511 decoder rather than directly by the Arduino Nano.
02
Rotation changes the displayed number while the encoder allows a three-digit combination to be entered.
Clockwise rotation adds one to the seven-segment display, while rotation in the opposite direction decreases the displayed value.
The goal is to enter the secret combination. When the safe is unlocked, the bi-colour LED turns green.
If an incorrect password is entered, the system can be reset using the ACES encoder PCB. The bi-colour LED then signals red and the combination is reset.
Combination Safe Circuit
03
The rotary encoder forms the hardware backbone of the circuit.
The encoder contains a disk with evenly spaced contacts connected to a common pin C and two additional pins, A and B.
As the disk rotates, pins A and B make contact with the common pin and generate two square-wave output signals.
Both signals can be considered together to determine rotation direction. The report describes the two output signals as being displaced 90 degrees out of phase.
04
The project applies register-level techniques and pin-change interrupts to read the physical controls.
INT0
Selection
INT1
Reset
PCINT2
Rotary Encoder
05
Number Output
7-Segment Display
The entered number is displayed using a seven-segment display driven by the 4511 decoder.
Lock Status
Bi-Coloured LED
Green indicates that the combination has unlocked the system, while red is used when the combination is reset.
06
Parts Table
Qty.
Arduino Nano
1
4511 7-Segment Decoder
1
ACES Rotary Encoder
1
ACES Denouncer PCB
1
330 Ω Resistors
7
Bi-Colored LED
1
7-Segment CA Display
1
Wires
Assorted
Full Size Breadboard
1
07
The completed circuit combines rotary input, interrupt-based control, a 4511 decoder, seven-segment feedback, and a bi-colour LED into a three-digit combination safe.
Completed Circuit
Pin Change Interrupt system
Rotary Encoder + Display
Combination input and feedback