Arduino Electronic Voting Machine

Microcontroller-Based Digital Polling Engine & Real-Time Winner Analysis

📊 Operational Overview & Video Guide System Live Demo

This physical prototype models the fundamental operations of an Electronic Voting Machine (EVM) using an Arduino Uno[cite: 28]. Voters can securely cast ballots for one of three unique candidates via dedicated tactile input buttons, triggering immediate dual-mode confirmation (an audible beep alongside real-time LCD feedback)[cite: 27, 28]. Pressing an administrator result button tallies all stored values to instantly declare the statistical winner or signal a tied vote sequence on the display panel[cite: 27, 28].

Supported Candidates
🗳️ 3 Independent Ballot Channels[cite: 27, 28]
Verification Mode
🔊 Multi-tone Buzzer & Dual Line Display[cite: 27, 28]
🛠️ Structural BOM Requirements Hardware List

Assemble these hardware components to build your digital polling prototype[cite: 28]:

Target Component Label Structural Allocation Quantity Functional Deployment Purpose
Arduino Uno1 UnitPrimary processing core that scans inputs, tallies data, and manages display outputs[cite: 28].
16x2 I2C LCD Display1 UnitPrimary display rendering system states, ballot inputs, and final results[cite: 28].
Tactile Push Buttons4 UnitsUser interfaces for casting votes (3 candidates) and requesting final tallies (1 administrator button)[cite: 28].
Active Buzzer1 UnitGenerates brief audio tones to verify each successfully cast ballot[cite: 28].
Breadboard & Hookup Wires1 SetSupplies structural routing pathways and 5V system power distribution[cite: 28].
🔌 Device Interface Pin Maps I/O Infrastructure

Connect your hardware components to the Arduino Uno exactly as structured in the deployment table below[cite: 28]:

Interface Wiring Configurations:
Input / Output PinArduino Target Pin MappingFunctional Context
Candidate 1 ButtonDigital Input Pin D2Interruptible line utilizing internal pull-up resistor[cite: 28]
Candidate 2 ButtonDigital Input Pin D3Interruptible line utilizing internal pull-up resistor[cite: 28]
Candidate 3 ButtonDigital Input Pin D4General I/O line utilizing internal pull-up resistor[cite: 28]
Result Tally ButtonDigital Input Pin D5Administrator panel trigger using internal pull-up[cite: 28]
Active Buzzer (+)Digital Output Pin D8Drives confirmation and winner celebration tones[cite: 28]
LCD SDA TerminalAnalog Input Pin A4I2C Data Bus Interface Pin[cite: 28]
LCD SCL TerminalAnalog Input Pin A5I2C Clock Bus Interface Pin[cite: 28]
💻 Optimized Production Code Engine Firmware Source

Upload this robust voting machine program to your microcontroller board using the Arduino IDE[cite: 28]:

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);

// Button Pins
const int vote1 = 2;
const int vote2 = 3;
const int vote3 = 4;
const int resultBtn = 5;

// Buzzer
const int buzzer = 8;

// Vote Counters
int count1 = 0;
int count2 = 0;
int count3 = 0;

void setup()
{
  pinMode(vote1, INPUT_PULLUP);
  pinMode(vote2, INPUT_PULLUP);
  pinMode(vote3, INPUT_PULLUP);
  pinMode(resultBtn, INPUT_PULLUP);

  pinMode(buzzer, OUTPUT);

  lcd.init();
  lcd.backlight();

  lcd.setCursor(0,0);
  lcd.print("Electronic");
  lcd.setCursor(0,1);
  lcd.print("Voting Machine");

  delay(2000);

  lcd.clear();
  lcd.print("Ready to Vote");
}

void loop()
{
  // Candidate 1
  if(digitalRead(vote1)==LOW)
  {
    count1++;
    voteSuccess("Candidate 1");
  }

  // Candidate 2
  if(digitalRead(vote2)==LOW)
  {
    count2++;
    voteSuccess("Candidate 2");
  }

  // Candidate 3
  if(digitalRead(vote3)==LOW)
  {
    count3++;
    voteSuccess("Candidate 3");
  }

  // Show Result
  if(digitalRead(resultBtn)==LOW)
  {
    showResult();
  }
}

void voteSuccess(String candidate)
{
  tone(buzzer,1000);
  delay(200);
  noTone(buzzer);

  lcd.clear();
  lcd.print("Vote Recorded");
  lcd.setCursor(0,1);
  lcd.print(candidate);

  delay(1500);

  lcd.clear();
  lcd.print("Ready to Vote");

  while(
    digitalRead(vote1)==LOW ||
    digitalRead(vote2)==LOW ||
    digitalRead(vote3)==LOW
  );
}

void showResult()
{
  lcd.clear();
  lcd.print("C1:");
  lcd.print(count1);

  lcd.setCursor(8,0);
  lcd.print("C2:");
  lcd.print(count2);

  lcd.setCursor(0,1);
  lcd.print("C3:");
  lcd.print(count3);

  delay(5000);

  lcd.clear();

  if(count1>count2 && count1>count3)
  {
    lcd.print("Winner: C1");
  }
  else if(count2>count1 && count2>count3)
  {
    lcd.print("Winner: C2");
  }
  else if(count3>count1 && count3>count2)
  {
    lcd.print("Winner: C3");
  }
  else
  {
    lcd.print("Result: Tie");
  }

  tone(buzzer,1200);
  delay(500);
  noTone(buzzer);

  delay(3000);

  lcd.clear();
  lcd.print("Ready to Vote");

  while(digitalRead(resultBtn)==LOW);
}
Required Software Dependencies: Ensure both the Wire and LiquidCrystal_I2C libraries are installed in your workspace before compiling to prevent physical display communication issues[cite: 28].