Skip to content

Voting Machine using AVR Atmega32 with LCD, LED and button.This project provides a basic framework for an electronic voting machine, ensuring accurate vote counts and clear feedback to users throughout the voting process.

Notifications You must be signed in to change notification settings

AhmedRagabMogoda/Voting-machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voting Machine Project Description

This voting machine project uses an ATmega32 microcontroller to handle user voting inputs, display results on an LCD, and manage the voting process through buttons.

Components Used:

  1. ATmega32 Microcontroller: The central processing unit for handling button inputs, controlling the LEDs, and displaying information on the LCD.
  2. LCD Display (LM016L): Displays the current vote count for each candidate and provides feedback to the user during the voting process.
  3. Buttons: Used for casting votes and resetting the system.
    • Five buttons on Port B (PB0-PB4): Represent voting inputs and the "enter" button.
    • Two buttons on Port A (PA0-PA1): Represent the responsible button and reset button.
  4. LEDs: Indicate various statuses and provide visual feedback.
    • Two LEDs for the responsible party (green LED D1 on PC4, red LED D6 on PC5).
    • Four green LEDs (D2-D5 on PC0-PC3): Indicate the selection of candidates A, B, C, and D.
    • Red LED (D7 on PC6): Indicates when the system is ready for a new vote or needs user attention.

Operation Overview:

  1. Initialization:

    • The microcontroller initializes the LCD display, buttons, and LEDs.
    • The LCD is set up to display the initial vote counts for each candidate (A, B, C, D) as "0".
  2. Voting Process:

    • Responsible Button: Must be pressed to enable the voting process. When pressed, the system enters voting mode, and the appropriate LEDs are lit to indicate the start of the voting process.
    • Reset Button: Resets all vote counts to zero and clears the LCD screen.
  3. Voting for Candidates:

    • Candidate A: When pressed, the vote count for candidate A is incremented by 1, and the corresponding LED turns on. If a different candidate's button was previously pressed, that candidate's LED is turned off, and the count is adjusted accordingly.
    • Candidate B: Similar operation to candidate A, but for candidate B.
    • Candidate C: Similar operation to candidate A, but for candidate C.
    • Candidate D: Similar operation to candidate A, but for candidate D.
  4. Entering the Vote:

    • Enter Button: When pressed, finalizes the current vote. The LCD display updates to show the new vote counts, and the system prepares for the next vote.
  5. Displaying Results:

    • The LCD is continuously updated with the vote counts for each candidate. If the "enter" button is pressed with no changes in the vote counts, the system prompts the user to "please vote" to avoid accidental inputs.
    • The display shows the current vote count for each candidate in a structured format:
      A=XX     B=XX
      C=XX     D=XX
      
    • Where XX represents the two-digit vote count for each candidate.
  6. System States and Feedback:

    • *User Mode:
      • Green LEDs indicate the selection of each candidate.
      • Red LED turns on when pressed to confirm the vote.
    • Responsible Mode:
      • Green LED indicates that the system is in responsible mode and is awaiting votes.
      • Red LED indicates that the system is in a reset state or waiting for the responsible party to enable voting.

Code Explanation:

  • Initialization and Setup: Initializes the LCD, buttons, and LEDs. Sets up vote counters for each candidate.
  • Main Voting Loop: Continuously checks button states to handle vote casting, enter button press, and reset functionality.
  • Vote Management: Uses flags to track the current candidate selected and ensures only one candidate is selected at a time.
  • Vote Display and Update: Updates the LCD display with the current vote counts after each vote or when the "enter" button is pressed.

Use Case Scenario:

  • Voting Session Start:
    • The responsible button is pressed.
    • The user presses the button corresponding to the desired candidate.
    • The enter button is pressed to confirm the vote.
    • The LCD updates with the new vote counts.
    • The system resets, ready for the next voter.

This project provides a basic framework for an electronic voting machine, ensuring accurate vote counts and clear feedback to users throughout the voting process.

About

Voting Machine using AVR Atmega32 with LCD, LED and button.This project provides a basic framework for an electronic voting machine, ensuring accurate vote counts and clear feedback to users throughout the voting process.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published