IoTBeginnerPRJ-169

IoT-Based Smart Voting System Using ESP32

Press a button to vote; counts update live in a mobile app.

Built and tested by Drisya K S · Industrial Robotics Institute

ESP32

Arduino IDE, Blynk IoT app

LevelBeginner
Build time1–2 hours
BoardESP32
Parts8 components

What is the IoT-Based Smart Voting System?

An electronic voting machine for school, college or club elections. Each candidate has a push button; pressing it adds a vote, gives a confirmation beep, and updates that candidate’s live total in the Blynk app so results are counted instantly without paper.

How it works

  1. Each of the three buttons represents a candidate.
  2. Pressing a button adds one vote to that candidate.
  3. The buzzer beeps for 300 ms to confirm the vote.
  4. The new totals are sent to Blynk V1, V2 and V3 for live results.

Parts list

ComponentQty
ESP32 Dev Board1
Push Buttons x3 (one per candidate)1
OLED / LCD Display (optional)1
Buzzer1
LED Indicators (optional)1
RFID Module (optional, for voter ID)1
Jumper Wires / BreadboardAs needed
5V Power Supply1

Software

  • Arduino IDE
  • Blynk IoT app

Wiring and connections

FromConnect to
Button 1GPIO 12 and GND
Button 2GPIO 13 and GND
Button 3GPIO 14 and GND
Buzzer +GPIO 26
Buzzer −GND
(Optional) OLED SDA / SCLGPIO 21 / 22

How to build the IoT-Based Smart Voting System

  1. Connect each candidate button between its GPIO pin (12, 13, 14) and GND.
  2. Connect the buzzer to GPIO 26.
  3. In Blynk, create datastreams V1, V2 and V3 (integer) and add value displays.
  4. Add your Blynk details and Wi-Fi to the code and upload.
  5. Label the buttons with the candidate names and press one to test.

IoT-Based Smart Voting System code

Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP32.

#define BLYNK_TEMPLATE_ID "YourTemplateID"
#define BLYNK_TEMPLATE_NAME "Smart Voting"
#define BLYNK_AUTH_TOKEN "YourAuthToken"
#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>

char ssid[] = "Your_WiFi_Name";
char pass[] = "Your_WiFi_Password";

#define btn1 12
#define btn2 13
#define btn3 14
#define buzzer 26

int vote1 = 0, vote2 = 0, vote3 = 0;

void voteConfirm() {
  digitalWrite(buzzer, HIGH);
  delay(300);
  digitalWrite(buzzer, LOW);
}

void setup() {
  Serial.begin(115200);
  pinMode(btn1, INPUT_PULLUP);
  pinMode(btn2, INPUT_PULLUP);
  pinMode(btn3, INPUT_PULLUP);
  pinMode(buzzer, OUTPUT);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}

void loop() {
  Blynk.run();

  if (digitalRead(btn1) == LOW) {
    vote1++;
    voteConfirm();
    Blynk.virtualWrite(V1, vote1);
    delay(500);
  }

  if (digitalRead(btn2) == LOW) {
    vote2++;
    voteConfirm();
    Blynk.virtualWrite(V2, vote2);
    delay(500);
  }

  if (digitalRead(btn3) == LOW) {
    vote3++;
    voteConfirm();
    Blynk.virtualWrite(V3, vote3);
    delay(500);
  }
}

Real-world uses

  • School and college elections
  • Club and society polls
  • Office surveys
  • Learning IoT dashboards

Frequently asked questions

What is a IoT-Based Smart Voting System?

An electronic voting machine for school, college or club elections. Each candidate has a push button; pressing it adds a vote, gives a confirmation beep, and updates that candidate’s live total in the Blynk app so results are counted instantly without paper.

What components are needed for the IoT-Based Smart Voting System?

You need: ESP32 Dev Board (1), Push Buttons x3 (one per candidate) (1), OLED / LCD Display (optional) (1), Buzzer (1), LED Indicators (optional) (1), RFID Module (optional, for voter ID) (1), Jumper Wires / Breadboard, 5V Power Supply (1). Software: Arduino IDE, Blynk IoT app.

Is the IoT-Based Smart Voting System project good for beginners?

Yes. It is rated beginner and takes about 1–2 hours to build, using the ESP32. The guide on this page explains every connection and step.

Where can I get the code for the IoT-Based Smart Voting System?

The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.

Can I buy a kit for the IoT-Based Smart Voting System?

Yes. IRI sells a kit with the parts for this project (PRJ-169). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.

Industrial Robotics Institute
Logo