{"id":26359232,"url":"https://github.com/rezagooner/timer-4digit-7segment","last_synced_at":"2025-10-14T07:16:05.508Z","repository":{"id":281918458,"uuid":"946860416","full_name":"RezaGooner/Timer-4digit-7segment","owner":"RezaGooner","description":"This project is a Digital Clock that displays time in minutes and seconds on a 4-digit 7-segment display. It uses the ATmega32 microcontroller, a BCD to 7-Segment Decoder (IC 7447), and the Multiplexing technique.","archived":false,"fork":false,"pushed_at":"2025-03-11T20:20:17.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T21:20:58.270Z","etag":null,"topics":["7segment","7segmentdisplay","atmega32","bdc","cprogramming","electronics","electronicsproject","embeddedsystems","hardwaredesign","ic7448","opensource","timedisplay"],"latest_commit_sha":null,"homepage":"","language":"Assembly","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RezaGooner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-11T19:38:53.000Z","updated_at":"2025-03-11T20:14:04.000Z","dependencies_parsed_at":"2025-03-11T21:21:02.863Z","dependency_job_id":"f7bfc94d-03cc-4465-8492-8abf97df74dd","html_url":"https://github.com/RezaGooner/Timer-4digit-7segment","commit_stats":null,"previous_names":["rezagooner/timer-4digit-7segment"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/RezaGooner/Timer-4digit-7segment","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RezaGooner%2FTimer-4digit-7segment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RezaGooner%2FTimer-4digit-7segment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RezaGooner%2FTimer-4digit-7segment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RezaGooner%2FTimer-4digit-7segment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RezaGooner","download_url":"https://codeload.github.com/RezaGooner/Timer-4digit-7segment/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RezaGooner%2FTimer-4digit-7segment/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018219,"owners_count":26086303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["7segment","7segmentdisplay","atmega32","bdc","cprogramming","electronics","electronicsproject","embeddedsystems","hardwaredesign","ic7448","opensource","timedisplay"],"created_at":"2025-03-16T15:59:04.049Z","updated_at":"2025-10-14T07:16:05.478Z","avatar_url":"https://github.com/RezaGooner.png","language":"Assembly","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Display Time on a 4-Digit 7-Segment Display Using ATmega32 and BCD to 7-Segment Decoder (IC 7447)\n\nThis project is a simple digital clock that displays time on a 4-digit 7-segment display. It is implemented using the **ATmega32** microcontroller, a **BCD to 7-Segment Decoder (IC 7447)**, and the **Multiplexing** technique.\n\n---\n\n## Table of Contents\n- [Introduction](#introduction)\n- [Components Required](#components-required)\n- [How It Works](#how-it-works)\n- [Hardware Connections](#hardware-connections)\n- [How to Run the Project](#how-to-run-the-project)\n- [Programming](#programming)\n\n\n---\n\n## Introduction\n\nThis project is a simple digital clock that displays minutes and seconds on a 4-digit 7-segment display. The **ATmega32** microcontroller generates BCD (Binary-Coded Decimal) values, which are then converted to the appropriate signals for the 7-segment display using the **BCD to 7-Segment Decoder (IC 7447)**. The **Multiplexing** technique is employed to display all digits simultaneously.\n\n---\n\n## Components Required\n\n- **ATmega32** microcontroller\n- 4-digit 7-segment display (Common Cathode)\n- BCD to 7-Segment Decoder (IC 7447)\n- NPN transistors (e.g., 2N2222 or BC547) (4 pieces)\n- 5V power supply\n\n---\n\n## How It Works\n\n![ezgif-2ca358baa20250](https://github.com/user-attachments/assets/ce49f578-de18-416c-88c3-9d5308b665e8)\n\nIn this project, time is calculated in minutes and seconds and displayed on the 7-segment display. The **ATmega32** generates BCD values for each digit, which are then sent to the **BCD to 7-Segment Decoder (IC 7447)**. The decoder converts the BCD values into the appropriate signals to drive the 7-segment display.\n\nEach digit is activated one by one and quickly turned on and off to create the illusion that all digits are lit simultaneously. This process is achieved using the **Multiplexing** technique.\n\nThe time increments every second, and after reaching 60 seconds, the minutes increase. If the minutes reach 60, they reset to zero.\n\n---\n\n## Hardware Connections\n\n![Untitled](https://github.com/user-attachments/assets/d4d270d4-0642-4630-af11-df8734856a1c)\n\n\n### Port C (PORTC):\n- Port C is used to send BCD values to the **BCD to 7-Segment Decoder (IC 7447)**.\n- Each BCD value corresponds to a digit (0-9).\n\n| 7448 Pin | Microcontroller Port |\n|---------|----------------------|\n| A       | PC0                  |\n| B       | PC1                  |\n| C       | PC2                  |\n| D       | PC3                  |\n\n### Port D (PORTD):\n- Port D is used to control the common cathodes of each digit.\n- Each pin of Port D is connected to the base of an NPN transistor.\n- The collector of the transistor is connected to the common cathode of a digit on the 7-segment display.\n- The emitter of the transistor is connected to ground (GND).\n\n| input Not Gates | Microcontroller Port |\n|-------------------|----------------------|\n| Gate 1   | PD0                  |\n| Gate 2   | PD1                  |\n| Gate 3   | PD2                  |\n| Gate 4   | PD3                  |\n\n\n| 7-Segment Cathode | output Not Gates |\n|-------------------|----------------------|\n| Digit 1 Cathode   | Gate 1                  |\n| Digit 2 Cathode   | Gate 2                  |\n| Digit 3 Cathode   | Gate 3                  |\n| Digit 4 Cathode   | Gate 4                  |\n\n### BCD to 7-Segment Decoder (IC 7447):\n- The BCD inputs (A, B, C, D) are connected to Port C of the microcontroller.\n- The 7-segment outputs (a, b, c, d, e, f, g) are connected to the corresponding segments of the 7-segment display.\n\n| IC 7447 Pin | 7-Segment Pin |\n|-------------|---------------|\n| QA           | A             |\n| QB           | B             |\n| QC           | C             |\n| QD           | D             |\n| QE           | E             |\n| QF           | F             |\n| QG           | G             |\n\n\n| IC 7447 Pin | Connected to |\n|-------------|---------------|\n| LT           | VCC             |\n| RBI           | VCC             |\n| BI/RBO           | VCC             |\n\n\n\n---\n\n## How to Run the Project\n\n1. **Hardware Connections**: Connect the components as per the tables above.\n2. Compile the project code in a suitable programming environment (e.g., CodeVision or Atmel Studio).\n3. Program the generated HEX file onto the ATmega32 microcontroller.\n4. Power on the circuit and observe the time displayed on the 7-segment display.\n\n![bandicam2025-03-1123-31-47-335-ezgif com-video-to-gif-converter](https://github.com/user-attachments/assets/63f7eec3-4477-42bf-b7cb-46672a03548d)\n\n\n---\n\n## Programming\n\nThe code for this project is written in C and uses the `\u003cmega32.h\u003e` and `\u003cdelay.h\u003e` libraries. In this code, time is calculated in minutes and seconds, and BCD values are generated for each digit. These BCD values are sent to the **BCD to 7-Segment Decoder (IC 7447)**.\n\n```c\n#include \u003cmega32.h\u003e\n#include \u003cdelay.h\u003e\n\nvoid main(void){\n    int i, j;\n    int seconds = 0;\n    int minutes = 0;\n    int s[4] = {0, 0, 0, 0};\n    DDRD = 0x0f;\n    DDRC = 0x0f;\n    \n    while(1){\n        s[0] = minutes / 10;\n        s[1] = minutes % 10;\n        s[2] = seconds / 10;\n        s[3] = seconds % 10;\n\n        for (j = 0; j \u003c 250; j++) {\n            for (i = 0; i \u003c 4; i++) {\n                PORTD = ~(1 \u003c\u003c i);\n                PORTC = s[i];\n                delay_ms(1);\n                PORTC = 0;\n                PORTD = 0;\n            }\n        }\n\n        seconds++;\n        if (seconds \u003e= 60) {\n            seconds = 0;\n            minutes++;\n            if (minutes \u003e= 60) {\n                minutes = 0;\n            }\n        }\n    }\n}\n```\n\n---\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezagooner%2Ftimer-4digit-7segment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frezagooner%2Ftimer-4digit-7segment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frezagooner%2Ftimer-4digit-7segment/lists"}