Arduino Electronic Voting Machine

Microcontroller-Based Digital Polling System & Dynamic Result Calculator

📊 Operational Overview & Video Guide System Live Demo

This Electronic Voting Machine (EVM) demonstration uses physical hardware to establish a simple and transparent digital voting system. Supporting up to three unique candidates, voters cast ballots via dedicated pull-up push buttons. The system registers each choice on an I2C 16x2 LCD module, triggers a confirmation tone via an active buzzer, and stores calculations in dynamic registers. Pressing the dedicated Administrator/Result button prints instant tally states and automatically determines the winner.

Supported Candidates
👥 3 Voting Lanes + Result Button
Audible Confirmation
🔊 Active Buzzer (Success & End Polling)
🛠️ Structural BOM Requirements Hardware List

Gather the following components to assemble the interactive EVM circuit:

Target Component Label Structural Allocation Quantity Functional Deployment Purpose
Arduino Uno R31 UnitMaster control unit executing debouncing routines and storing voter tally arrays.
16x2 LCD with I2C Backplane1 UnitOutputs progress states, system prompt guides, and tally results.
Tactile Push Buttons4 UnitsActs as physical input switches (Candidate 1, 2, 3, and Result trigger).
Active Buzzer1 UnitProvides precise acoustic confirmation tones during cast procedures.
Breadboard & Hookup Wires1 SetBuilds reliable interconnect loops between processing, input, and output blocks.
🔌 Device Interface Pin Maps I/O Infrastructure

Connect the voting elements and screen displays directly to your microcontroller platform as outlined here:

Interface Wiring Configurations:
Device Terminal Pin OutArduino Target Pin MappingFunctional Context
Candidate 1 Push ButtonDigital Input Pin D2Sets candidate 1 voting input (active-low)
Candidate 2 Push ButtonDigital Input Pin D3Sets candidate 2 voting input (active-low)
Candidate 3 Push ButtonDigital Input Pin D4Sets candidate 3 voting input (active-low)
Result Button SwitchDigital Input Pin D5Triggers audit log and winner determination (active-low)
Active Buzzer (+) PinDigital Output Pin D8Drives confirmation beeps upon action trigger
LCD SDA TerminalAnalog Input Pin A4I2C Data Bus Connection
LCD SCL TerminalAnalog Input Pin A5I2C Clock Bus Connection
Common GND BusPower Ground Pin GNDCommon reference loop for all push buttons & components
💻 Optimized Production Code Engine Firmware Source

Copy this program directly to your Arduino setup to manage pull-up inputs and execute real-time vote totals:

#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);
}
Functional Pull-up Warning: Because this firmware relies on internal INPUT_PULLUP logic, the button terminals are designed to run active-low. Connect the opposing terminal of all four push buttons directly to common system Ground (GND).