Adjustable Timer With 7-Segment Display
by AustinS89 in Circuits > Arduino
127 Views, 1 Favorites, 0 Comments
Adjustable Timer With 7-Segment Display
In this project, we'll build an adjustable timer using an Arduino UNO and a 7-segment display. The timer duration is set using a DIP switch, and a tactile button starts the countdown. An LED and a buzzer provide visual and auditory alerts when the timer reaches zero.
This project was created by xboxusr666 using Cirkit Designer. Full credit goes to xboxusr666 for designing and sharing this innovative project with the community.
- Project Link: Adjustable Timer 7 Segment Display
- Documentation: Project Documentation
Supplies
- 1 x Arduino UNO
- 1 x SparkFun 7-Segment Serial Display (Green)
- 1 x Tactile Switch Button - 12mm Square
- 1 x DIP Switch (4 Position)
- 1 x LED (Red)
- 1 x Resistor (1 kΩ)
- 1 x Buzzer
- Jumper wires
- Breadboard or perfboard
Circuit Design
The complete circuit diagram and code are available in the Cirkit Designer IDE. You can view, edit, and interact with the project directly through the provided link.
- View the Circuit Diagram and Code: Open the project link in Cirkit Designer to access the detailed schematic and code.
Assemble the Circuit
Follow these detailed instructions to assemble the circuit. Refer to the circuit diagram in the Cirkit Designer IDE for visual guidance.
1. Setting Up the Arduino UNO
Place your Arduino UNO on the workspace or attach it to a breadboard if preferred.
2. Connecting the 7-Segment Display
- Power Connections:
- Connect the VCC pin of the 7-segment display to the 5V pin on the Arduino.
- Connect the GND pin of the display to one of the GND pins on the Arduino.
- I2C Communication Lines:
- Connect the SDA pin of the display to the A4 pin on the Arduino.
- Connect the SCL pin of the display to the A5 pin on the Arduino.
3. Wiring the Tactile Switch Button
- Button Connections:
- One leg of the button connects to a GND pin on the Arduino.
- The opposite leg connects to digital pin D2 on the Arduino.
- Pull-up Configuration:
- Since the button is configured with an internal pull-up resistor (set in the code), no external resistor is needed.
4. Setting Up the DIP Switch (4 Position)
The DIP switch allows you to set the timer value in binary form.
- Grounding One Side of the Switches:
- Connect pins 1, 2, 3, and 4 of the DIP switch to the GND rail.
- Connecting the Other Side to Digital Pins:
- Connect pin 5 of the DIP switch to digital pin D6 on the Arduino.
- Connect pin 6 to digital pin D5.
- Connect pin 7 to digital pin D4.
- Connect pin 8 to digital pin D3.
- Note: Pins 1 to 4 are internally connected to pins 5 to 8 when the switches are in the ON position, completing the circuit.
5. Connecting the LED and Resistor
- Anode Connection:
- Connect the anode (longer leg) of the LED to digital pin D7 on the Arduino.
- Cathode Connection:
- Connect the cathode (shorter leg) of the LED to one end of the 1 kΩ resistor.
- Connect the other end of the resistor to the GND rail.
- Purpose of the Resistor:
- The resistor limits the current through the LED to prevent damage.
6. Wiring the Buzzer
- Positive Terminal:
- Connect the positive pin (usually marked with a + or red wire) of the buzzer to digital pin D8 on the Arduino.
- Negative Terminal:
- Connect the negative pin of the buzzer to the GND rail.
7. Ensuring Common Ground
Make sure all GND connections are connected to the same ground rail or point on the Arduino to ensure proper circuit operation.
Upload the Code Using Cirkit Designer
The code for this project is included with the Cirkit Designer project link. You can upload it directly to your Arduino UNO without the need for any additional software.
Steps to Upload the Code:
- Connect Your Arduino:
- Use a USB cable to connect your Arduino UNO to your computer.
- Open the Code Tab:
- In the Cirkit Designer IDE, navigate to the Code tab.
- Select the USB Port:
- Click on the Port button within the IDE.
- Select the USB port that corresponds to your connected Arduino UNO.
- Upload the Code:
- Click the Upload button.
- The Cirkit Designer IDE will compile and upload the code directly to your Arduino UNO.
- Wait for the upload to complete. A confirmation message will appear once it's done.
Cirkit Designer automatically manages library installations and configurations, simplifying the upload process.
Test the Timer
Now that your circuit is assembled and the code is uploaded, it's time to test the adjustable timer.
1. Setting the Timer Value with DIP Switches
- Understanding the DIP Switches:
- Each of the four switches represents a bit in a 4-bit binary number.
- From left to right (pins 5 to 8 connected to D6 to D3), the switches represent bits 2^3, 2^2, 2^1, and 2^0 respectively.
- Configuring the Timer:
- Flip the switches to the ON position to represent binary 1.
- The combination of switches sets the timer value from 0 to 15 seconds.
- For example:
- All switches OFF: 0000 (0 seconds)
- Switch D3 ON (pin 8): 0001 (1 second)
- Switch D4 ON (pin 7): 0010 (2 seconds)
- Switches D3 and D4 ON: 0011 (3 seconds)
- Up to all switches ON: 1111 (15 seconds)
2. Starting the Timer
- Press the Tactile Button:
- Press the button connected to D2 to start the timer.
- The button uses an internal pull-up resistor, so pressing it connects D2 to GND.
- Timer Countdown:
- The 7-segment display will show the timer counting down from the set value.
- The display may blink the decimal point to indicate the timer is running.
3. Observing the Alerts
- When Timer Reaches Zero:
- The LED connected to D7 will start blinking.
- The buzzer connected to D8 will emit beeping sounds intermittently.
- The 7-segment display will show 0000 or may blink to indicate the timer has finished.
4. Resetting the Timer
- Press the Button Again:
- Press the tactile button to reset or stop the timer.
- You can set a new timer value using the DIP switches and start the process again.
Additional Tips
Debugging Connections:
- If something isn't working, double-check all your connections against the circuit diagram.
- Ensure that all components are securely connected and that there are no loose wires.
Power Supply:
- The Arduino UNO can be powered via the USB connection during testing.
- If using an external power supply, ensure it provides a stable 5V.
Code
Below is the Arduino code for the adjustable timer. You can also access and edit this code directly in the Cirkit Designer IDE.
Notes:
- Libraries Used:
- Adafruit GFX Library
- Adafruit LED Backpack Library
- These libraries are automatically managed within the Cirkit Designer IDE.
How It Works
DIP Switches: Set the initial timer value in binary form, allowing you to choose a duration between 0 and 15 seconds.
Tactile Button: Starts and stops the timer. When pressed, it initiates the countdown based on the DIP switch settings.
7-Segment Display: Provides a visual countdown of the timer value using I2C communication with the Arduino.
LED and Buzzer: Activate when the timer reaches zero, providing visual and auditory alerts to signal that the countdown has finished.
Acknowledgments
All credit for this project goes to xboxusr666, who designed and shared this project using Cirkit Designer. We appreciate the opportunity to showcase this innovative design and thank xboxusr666 for contributing to the Cirkit Designer community.
Conclusion
You've successfully built an adjustable timer using an Arduino and a 7-segment display. This project serves as an excellent introduction to working with timers, user input, and display output in embedded systems. Feel free to explore the project further in Cirkit Designer, modify it, and expand upon it to suit your needs.