Aurdino Voting Machine
Aurdino Voting Machine
Aurdino Voting Machine
A PROJECT REPORT
Submitted by
SHIVASANKARI.M 411818106005
SABAREESWARAN.R 411818106004
VENKATESAN.K 411818106312
of
BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
JULY 2022
iii
A PROJECT REPORT
Submitted by
SHIVASANKARI.M 411818106005
SABAREESWARAN.R 411818106004
VENKATESAN.K 411818106312
of
BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
JULY 2022
iii
ANNA UNIVERSITY: CHENNAI 600 025
BONAFIDE CERTIFICATE
under my supervision.
SIGNATURE SIGNATURE
Engineering, Engineering,
Vanchuvancherry, Vanchuvancherry,
iii
AURDINO VOTING MACHINE USING
RFID AND FACE DETECTION
SHIVASANKARI.M 411818106005
SABAREESWARAN.R 411818106004
VENKATESAN.K 411818106312
Engineering Held On .
iii
ACKNOWLEDGEMENT
Our hearts are filled with gratitude to the ALMIGHTY for empowering us wisdom ,
courage and strength to complete this project successfully .
At the outset , we to express our sincere gratitude to our beloved chairperson Prof.
Dr.R.Renugadevi.,M.D., for her encouragement and blessings and our thanks to our
honourable Director Dr.S.Renganathan .,Ph.D., for his support to us , whenever we
approached him for a help regrading the project .We extended our gratitude to our humble
principal Prof. Mr. P.VEERAPPAN M.E., for his support and encouragement .
Our heart full thanks to the entire teaching faculty as well non – teaching faculty of
the department of Electronics and communication Engineering , RRASE College of
Engineering, for shaping us into what we are today all through these four years and shaping
has into promising professionals
iii
ABSTRACT
In this concept, the system is using most advanced and secure way of e-voting. In this, system
Actually use two steps for verification of the voters during the voting session, one is RFID
data verification of voters and followed by successful face authentication will allow the
voters to vote for their desired candidate using Haar Cascade Algorithm. These two
authentication process will definitely reduce the piracy issues of voters and counterfeit vote.
In India, there are two types of voting in practice. They are secret Ballet paper and Electronic
Voting Machines (EVM), but both of the process has some limitation or demerits. The
current
voting system is not secure and time consuming as well. The people who are not eligible to
vote can also cast their votes by unwanted means, which may cause various problems. In
India, Computerized voting system has not yet been implemented. So, initiating this system
we are proposing a way for voting which will be more effective. Here we have two level of
security in voting process. The first level is the verification of RFID number and second level
is face recognition. The security level of our system has been highly improved by the use of
new method for each voter. The authentication of the user in the system is improved by using
face recognition in the application, which will be able to identify whether the user is
iii
Table of Contents
1.1 EVM..................................................................................................................................7
Programming NodeMCU ESP8266 with Arduino IDE................................................................35
History[edit]....................................................................................................................................36
ESP8266 Arduino Core[edit].......................................................................................................36
How to start with NodeMCU?..............................................................................................................38
How to write codes for NodeMCU?.....................................................................................................38
The difference in using ESPlorer and Arduino IDE...............................................................................39
NodeMCU ESP8266 Specifications & Features.......................................................................39
Defining RFID:..............................................................................................................................43
A Basic RFID System:....................................................................................................................43
2 Types of RFID Systems:.............................................................................................................44
A brief idea about How the Passive RFID System Works:.............................................................45
An Idea about How the Active RFID System Works:....................................................................47
Good to know..................................................................................................................................60
Watermark using OpenCV...............................................................................................................60
Removing Background Noise using OpenCV..................................................................................61
Filter Images using OpenCV............................................................................................................63
Convert Images into Cartoon using OpenCV...................................................................................65
5.2 Conclusion..............................................................................................................................66
What is an Embedded C Programming.......................................................................................68
Embedded System Programming.................................................................................................68
Comments....................................................................................................................................69
Directives of Processor.................................................................................................................70
Configuration of Port...................................................................................................................71
SFR Register.................................................................................................................................73
Global Variables...........................................................................................................................73
Core Function / Main Function....................................................................................................73
Declaration of Variable................................................................................................................74
Main Factors of Embedded C Program........................................................................................75
Differences between C Program and Embedded C Program........................................................76
Advantages.................................................................................................................................76
5.4 Disadvantages.......................................................................................................................77
5.5 Applications of Embedded C Program...............................................................................77
iii
CHAPTER 1
INTRODUCTION
1.1 EVM
Electronic voting machine has already been developed and widely used in many
developed countries. But during the election time, verification process takes a lot more time
and there is possible to occur counterfeit vote. In India, they are using two types of method
for voting. The first method is secret ballot paper, in which many papers are used and second
method is EVM (electronic voting machine) which is in use since 2003.
1.1.1 RFID
iii
1.1.2 OVERVIEW OF EVM
1.2 DISADVANTAGES
There are some disadvantages of the conventional election voting process which is being
used in our country such as machine stops working, chances of brutality, time consuming,
resource consuming, spot arranged etc. Many people couldn't vote because the voter has to
reach the poll booths to vote or some people like those who are living far away from their
origin birth place where they are allowed to vote. So to get rid of there drawbacks, a new
System is introduced i.e. Online Voting System, which provides accuracy, security,
flexibility, mobility etc. An online voting System in a web based application to use in
election process. Initially ballot paper technique was used in election process. Then
Electronic Voting Machine comes, these are easy to store the data and easily manageable.
These are more secure than the ballot paper and less time consuming.
1.3 ADVANTAGES
Elections are the foundation of any democracy as the true spirit of democracy lies in people
choosing their own government. But, the way elections are conducted right now in our
country has defects and loopholes which are being used to advantage by contestants and
political parties. The current system has a lot of loopholes like the possibility of duplicate
votes, rigging EVMs, faking the count, all of which tamper the true meaning of democracy.
Moreover, the election conducting body, Election commission of India (ECI)uses Electronic
machines for conducting elections in most of the places which is quite time-consuming,
energy-consuming and should be done at an assigned place which is not comfortable to all.
The EVMs have to be checked, transported, monitored with more human power and is an
iii
expense. The system we are proposing is a solution that addresses all the above concerns
mentioned. Through the Smart voting system that uses Facial recognition, people who do not
live in the same place or the old or someone who cannot wait in long queues for a long time
will be benefitted. The voter can comfortably vote from anywhere and the possibility of
duplication of the vote is also less through the same. This Online Voting System uses Image
processing to detect voter’s faces and matches it with the existing image present in the
database. Facial features of the voters are the key information fed to the system to distinguish
the eligible voters from the fake ones. More importantly, the system developed is entirely
web-based which is very inexpensive compared to the present systems, very less manpower
will be required if proper strong cyber-security is provided to the website. Hence, making it
superior to the existing systems and is also, an authentic model.
CHAPTER – 02
LITERATURE SURVEY
2.1 GENERAL
iii
It’s a web based named as “online voting system” which aims to develop a computerized
system to make the election process more secure and user friendly. This system has many
features which are generally not available in current days. With the help of this system, user
can cast their vote without going to any polling booth; it can save their time and effort. This
system can also save money of government which is spent in preparation of election process.
This system uses face detection and recognition technology to make this system more secure
and safe. Overall this project of ours is being developed to help staff of Election commission
of India and also reduce the human efforts.
2.1.1 [1] Shrivastava et al. build an online voting system in which voter can cast their
vote without going to pooling booths. They use username and passwords for
authentication and do not use biometric authentication. In our project we use biometric
authentication, which can help to improve the security of the system. Abdulhamid et al.
[2] build E-voting system to make the voting process more efficient. They use username
and secret word to confirm the client and furthermore validation of meeting and meeting
break has been given to forestall meeting capturing in our undertaking we use Face
Recognition Technology to make sure about the framework from unapproved client. Firas. I.
Hazzaa proposed a “Web Based Voting System Using Fingerprint Design and
Implementation”( Hazzaa et al., 2012)
[3]to improve the security of voting system and make it more secure. The anticipated
EVS allows the electorate to investigate their unique mark that is facilitated with the current
duplicate put away in the database.
Nautiyal [4] based on the face recognition process under propose system this work has
suggested better approach for identification used in criminal identification. They used
Image partitioning algorithm. In this work pre captured image was taken in future win 10 to
take a real image and perform real time image processing. Patel & Patel
iii
[5] paper presents the face acknowledgment technique dependent on incomplete
Hausdorff separation. They utilized Hausdorff separation. Further work should be possible
to improve the time taken by the calculation. This should be possible by pre changing the
database pictures and furthermore utilizing a few models to have them into gatherings.
Yamini et al.
[6] build class attendance system in Python language using OPENCV, Haar’s Cascade
and Viola- Jones framework. In universities and cooperate offices, RFID scanners and
biometric fingerprints systems are used to mark the attendance of the employees. By using
these systems securities and ethics problems occurs. So they build a system using face
detection and recognition technique. They used ViolaJones algorithm for face detection and
Histogram of Oriented Gradients and Local Binary Patterns for face recognition. And used
OpenCV library as image processing framework. This system is much more secure than the
previous one and it is less time consuming as we compare it with RFID scanners.
Soomro & Ali [7] build an authentication application using face recognition technology.
They used NI MyRIO and LabVIEW, combination of software and hardware devices
integration of OpenCV and NI VISION tool kit to recognize the faces in minimum time. The
MyRIO devices is used to process the large real time data with the help of some algorithms
which are implemented in it and it is programed through LabVIEW. Also LabVIEW is used
to develop the database of the system. To make electronic voting system more secure they
used this system for authentication. Kavitha, S. N. (n.d.).
[8]Developed a fully biometric authentication system for voting purpose. They used
FM220 Starttek Scanner to scan the human finger prints and store the data. Normal camera is
used to capture the image of the voter and PCA(Principal Component Analysis) is used to
feature extraction and IRRIS detection. When all the recorded data successfully matched with
the Aadhar card data which is saved in the database voter is allow to use the system. They
used three layer biometric authentication technique for security of the system which makes it
more secure and on the other hand it makes the system more complex. Face acknowledgment
by a PC is modified by python over OpenCV and this paper and this paper is about execute
the Eigenfaces and Fisherfaces customized in Python. Geometric component and marker
iii
guide utilized toward assemble highlight vector. Calculations utilized for a neighborhood
include extraction are Gabor Wavelets, Discrete Cosinus Transform and Local Binary
Patterns(Wagner, 2012)
[9]. Current voting process have many faults and the objective of this project is to
minimize possibilities of manipulation. This project worked on implementation of
fingerprint and facial recognition for vote verification. They used different technologies and
tools like Python Development Environment, Linux Interfacing Engine and, Visual Basic.
This dual authentication system reduces the chances of fraud and illegal activities and
improves the security and efficiency of the voting process(P et al., 2018)
iii
CHAPTER 3
PROPOSED METHODOLOGY
1) Level 1: RFID number. At the time of voter registration, system will request for the unique
id from the voter. Unique id is verified from the database provided by the election
commission.
2) Level 2: Face recognition with respective election commission id number. In this level,
Haar Cascade algorithm is used to verify the facial image of the voters from the database
provided by the election commission.
3) Level 3: If the Face recognition is successful then face authentication will allow to vote for
their desired candidate.
iii
3.1 BLOCK DIAGRAM
HARDWARE REQUIREMENTS
Arduino
RFID
Camera
SOFTWARE REQUIREMENTS
Arduino IDE
Python
Open CV
Embedded C Language
HARDWARE DESCRIPTION
iii
3.2 AURDINO
The Arduino microcontroller is an easy to use yet powerful single board computer that has gained
considerable traction in the hobby and professional market. The Arduino is open-source, which means
hardware is reasonably priced and development software is free. This guide is for students in ME 2011,
or students anywhere who are confronting the Arduino for the first time. For advanced Arduino users,
prowl the web; there are lots of resources.
This guide covers the Arduino Uno board (Spark fun DEV-09950, $29.95), a good choice for students
and educators. With the Arduino board, you can write programs and create interface circuits to read
switches and other sensors, and to control motors and lights with very little effort.
An important feature of the Arduino is that you can create a control program on the host PC, download
it to the Arduino and it will run automatically. Remove the USB cable connection to the PC, and the
program will still run from the top each time you push the reset button. Remove the battery and put the
Arduino board in a closet for six months. When you reconnect the battery, the last program you stored
will run. This means that you connect the board to the host PC to develop and debug your program, but
once that is done, you no longer need the PC to run the program.
The Arduino Uno is a microcontroller board based on the ATmega328.It has 14 digital input/output
pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB
connection, a power jack, an ICSP header, and a reset button. It contains everything needed to support
the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC
adapter or battery to get started.
The Uno differs from all preceding boards in that it does not use the FTDI USB-to-serial driver chip.
Instead, it features the Atmega16U2 (Atmega8U2 up to version R2) programmed as a USB-to-serial
converter.
iii
3.3 CODE
Microcontroller ATmega328
Operating Voltage 5V
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
iii
3.4 PIN CONFIGURATION
The Arduino Uno can be powered via the USB connection or with an external power supply. The
power source is selected automatically.
External (non-USB) power can come either from an AC-to-DC adapter (wall- wart) or battery. The
adapter can be connected by plugging a 2.1mm center-positive plug into the board's power jack. Leads
from a battery can be inserted in the Gnd and Vin pin headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less than 7V, however,
the 5V pin may supply less than five volts and the board may be unstable. If using more than 12V, the
voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
• VIN. The input voltage to the Arduino board when it's using an external power source (as opposed to
5 volts from the USB connection or other regulated power source). You can supply voltage through
this pin, or, if supplying voltage via the power jack, access it through this pin.
• 5V. this pin outputs a regulated 5V from the regulator on the board. The board can be supplied with
power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board
(7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your
board.
• 3V3. A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.
• IOREF. This pin on the Arduino board provides the voltage reference with which the
microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the
appropriate power source or enable voltage translators on the outputs for working with the 5V or 3.3V.
iii
3.5 MEMORY
Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(),
digital Write( ), and digital Read( ) functions. They operate at 5 volts. Each pin can
provide or receive a maximum of 40 mA and has an internal pull- up resistor
(disconnected by default) of 20-50 kohms. In addition, some pins have specialized
functions:
• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and Trans mit (TX) TTL serial
data.
These pins are connected to the corresponding pins of the ATmega8U2 USB-to- TTL
Serial chip.
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analog Write ()
function.
• LED: 13. There is a built- in LED connected to digital pin 13. When the pin is HIGH
value, the LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of
resolution (i.e. 1024 different values). By default they measure from ground to 5 volts,
iii
though is it possible to change the upper end of their range using the AREF pin and the
analog Reference () function. Additionally, some pins have specialized functionality:
• TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the
Wire library.
• AREF. Reference voltage for the analog inputs. Used with analog Reference ().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset
button to shields which block the one on the board.
3.6 COMMUNICATION
Microcontrollers depend on a host computer for developing and compiling programs. The
software used on the host computer is known as an integrated development environment,
or IDE. For the Arduino, the development environment is based on the open source
Processing platform (www.processing.org) which is described by its creators as a
“programming language and environment for people who want to program images,
animation, and interactions.“ The Arduino programming language leverages an open
source project known as Wiring (wiring.org.co). The Arduino language is based on good
old- fashioned C. If you are unfamiliar with this language, don’t worry; it’s not hard to
learn, and the Arduino IDE provides some feedback when you make mistakes in your
programs.
The Arduino Uno has a number of facilities for communicating with a computer, another
Arduino, or other microcontrollers. The ATmega328 provides UART TTL (5V) serial
communication, which is available on digital pins 0 (RX) and 1 (TX). An ATmega16U2
on the board channels this serial communication over USB and appears as a virtual com
port to software on the computer. The '16U2 firmware uses the standard USB COM
drivers, and no external driver is needed. However, on Windows, a inf file is required.
The Arduino software includes a serial monitor which allows simple textual data to be
sent to and from the Arduino board. The RX and TX LEDs on the board will flash when
data is being transmitted via the USB-to-serial chip and USB connection to the computer
iii
(but not for serial communication on pins 0 and 1).
A Software Serial library allows for serial communication on any of the Uno's digital
pins. The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino
software includes a Wire library to simplify use of the I2C bus; see the documentation for
details. For SPI communication, use the SPI library.
As you go through the list of programming statements available in the Arduino IDE
(choose Help->Reference), you might think there isn’t much power for doing t hings like
running servos, operating stepper motors, reading potentiometers, or displaying text on an
LCD. Like most any language based on C, the Arduino supports the notion of “libraries”
code
Repositories that extend core programming functionality. Libraries let you re- use code
without having to physically copy and paste it into all your programs. The standard
Arduino software installation comes with several libraries you may use, and you can
download others from the Arduino support pages and from third-party websites that
publish Arduino library code. A good example of a library you’ll use with the Robot and
likely many other robot projects is
Servo. This library allows you to connect one or more hobby R/C servos to the Arduino’s
digital I/O pins. The Servo library comes with the standard Arduino installation package
Library->Servo. This adds the line
#include <Servo.h>
Which tells the Arduino IDE that you wish to include the Servo library in your sketch.
With the functionality of the library now available to you, you can use its various
functions to control one or more servos. For example, you can use the write function to
rotate a servo to a specific position, from 0 to 180 degrees. The following code
iii
myServo.write(90);
Moves a servo to its midpoint, or 90 degree position. Structurally, Arduino sketches are
very straightforward and are pretty easy to read and understand. The Arduino program
contains two main parts: setup () and loop (). These are programming functions that do
what their names suggest: setup () sets up the Arduino hardware, such as specifying
which I/O lines you plan to use, and whether
They are inputs or outputs. The loop () function is repeated endlessly when the Arduino is
operating.
Arduino IDE (Integrated development environment) is used to write the program and
dump into the Arduino board
iii
Fig : 3.7.1 Open IDE
iii
4. Write the sketch in Arduino IDE
Sketch in Arduino DE
iii
5. Compile and upload the Sketch to Arduino board upload the Sketch to Arduino board
iii
CHAPTER 4
NODE MCU
NodeMCU is an open-source Lua based firmware and development board specially targeted for IoT
based Applications. It includes firmware that runs on the ESP8266 Wi-Fi SoC from Espressif Systems,
and hardware which is based on the ESP-12 module
The NodeMCU Development Board can be easily programmed with Arduino IDE since it is easy to
use.
Programming NodeMCU with the Arduino IDE will hardly take 5-10 minutes. All you need is the
Arduino IDE, a USB cable and the NodeMCU board itself. You can check this Getting Started Tutorial
for NodeMCU to prepare your Arduino IDE for NodeMCU.
NodeMCU is an open source firmware for which open source prototyping board designs are available.
The name "NodeMCU" combines "node" and "MCU" (micro-controller unit).[8] The term "NodeMCU"
strictly speaking refers to the firmware rather than the associated development kits.[citation needed]
The firmware uses the Lua scripting language. The firmware is based on the eLua project, and built on
the Espressif Non-OS SDK for ESP8266. It uses many open source projects, such as lua-
cjson[9] and SPIFFS.[10] Due to resource constraints, users need to select the modules relevant for their
project and build a firmware tailored to their needs. Support for the 32-bit ESP32 has also been
implemented.
The prototyping hardware typically used is a circuit board functioning as a dual in-line package (DIP)
which integrates a USB controller with a smaller surface-mounted board containing the MCU and
antenna. The choice of the DIP format allows for easy prototyping on breadboards. The design was
initially based on the ESP-12 module of the ESP8266, which is a Wi-Fi SoC integrated with
a Tensilica Xtensa LX106 core, widely used in IoT applications (see related projects).
iii
4.2 HISTROY OF NODE MCU
NodeMCU was created shortly after the ESP8266 came out. On December 30, 2013, Espressif
Systems[6] began production of the ESP8266.[11] NodeMCU started on 13 Oct 2015, when Hong
committed the first file of nodemcu-firmware to GitHub.[12] Two months later, the project expanded to
include an open-hardware platform when developer Huang R committed the gerber file of an ESP8266
board, named devkit v0.9.[13] Later that month, Tuan PM ported MQTT client library from Contiki to
the ESP8266 SoC platform,[14] and committed to NodeMCU project, then NodeMCU was able to
support the MQTT IoT protocol, using Lua to access the MQTT broker. Another important update was
made on 30 Jan 2015, when Devsaurus ported the u8glib [15] to the NodeMCU project,[16] enabling
NodeMCU to easily drive LCD, Screen, OLED, even VGA displays.
In the summer of 2015 the original creators abandoned the firmware project and a group of
independent contributors took over. By the summer of 2016 the NodeMCU included more than 40
different modules.
As Arduino.cc began developing new MCU boards based on non-AVR processors like the ARM/SAM
MCU and used in the Arduino Due, they needed to modify the Arduino IDE so that it would be
relatively easy to change the IDE to support alternate toolchains to allow Arduino C/C++ to be
compiled for these new processors. They did this with the introduction of the Board Manager and the
SAM Core. A "core" is the collection of software components required by the Board Manager and the
Arduino IDE to compile an Arduino C/C++ source file for the target MCU's machine language. Some
ESP8266 enthusiasts developed an Arduino core for the ESP8266 WiFi SoC, popularly called the
"ESP8266 Core for the Arduino IDE".[17] This has become a leading software development platform
for the various ESP8266-based modules and development boards, including NodeMCUs.
iii
NodeMCU is an open-source LUA based firmware developed for the ESP8266 wifi chip. By exploring
functionality with the ESP8266 chip, NodeMCU firmware comes with the ESP8266 Development
board/kit i.e. NodeMCU Development board.
Since NodeMCU is an open-source platform, its hardware design is open for edit/modify/build.
NodeMCU Dev Kit/board consist of ESP8266 wifi enabled chip. The ESP8266 is a low-cost Wi-
Fi chip developed by Espressif Systems with TCP/IP protocol. For more information about ESP8266,
you can refer to the ESP8266 WiFi Module.
There is Version2 (V2) available for NodeMCU Dev Kit i.e. NodeMCU Development Board v1.0
(Version2), which usually comes in black colored PCB.
iii
Fig 4.2 black colored PCB
For more information about NodeMCU Boards available in the market refer to NodeMCU
Development Boards
NodeMCU Dev Kit has Arduino like Analog (i.e. A0) and Digital (D0-D8) pins on its board.
Using such serial protocols we can connect it with serial devices like I2C enabled LCD display,
Magnetometer HMC5883, MPU-6050 Gyro meter + Accelerometer, RTC chips, GPS modules, touch
screen displays, SD cards, etc.
NodeMCU Development board is featured with wifi capability, analog pin, digital pins, and
serial communication protocols.
To get started with using NodeMCU for IoT applications first we need to know about how to
write/download NodeMCU firmware in NodeMCU Development Boards. And before that
where this NodeMCU firmware will get as per our requirement.
There are online NodeMCU custom builds available using which we can easily get our custom
NodeMCU firmware as per our requirement.
To know more about how to build custom NodeMCU firmware online and download it refer
to Getting started with NodeMCU
After setting up ESP8266 with Node-MCU firmware, let’s see the IDE (Integrated
Development Environment) required for the development of NodeMCU.
Lua scripts are generally used to code the NodeMCU. Lua is an open-source, lightweight,
embeddable scripting language built on top of C programming language.
For more information about how to write Lua script for NodeMCU refer to Getting started with
NodeMCU using ESPlorerIDE
iii
Here is another way of developing NodeMCU with a well-known IDE i.e. Arduino IDE. We can
also develop applications on NodeMCU using the Arduino development environment. This
makes it easy for Arduino developers than learning a new language and IDE for NodeMCU.
For more information about how to write Arduino sketch for NodeMCU refer to Getting started
with NodeMCU using Arduino IDE
Well, there is a programming language difference we can say while developing an application for
NodeMCU using ESPlorer IDE and Arduino IDE.
We need to code in C\C++ programming language if we are using Arduino IDE for developing
NodeMCU applications and Lua language if we are using ESPlorer IDE.
Basically, NodeMCU is Lua Interpreter, so it can understand Lua script easily. When we write Lua
scripts for NodeMCU and send/upload it to NodeMCU, then they will get executes sequentially. It will
not build a binary firmware file of code for NodeMCU to write. It will send Lua script as it is to
NodeMCU to get executed.
In Arduino IDE when we write and compile code, the ESP8266 toolchain in the background creates a
binary firmware file of code we wrote. And when we upload it to NodeMCU then it will flash all
NodeMCU firmware with newly generated binary firmware code. In fact, it writes the complete
firmware.
That’s the reason why NodeMCU not accept further Lua scripts/code after it is getting flashed by
Arduino IDE. After getting flashed by Arduino sketch/code it will be no more Lua interpreter and we
got an error if we try to upload Lua scripts. To again start with Lua script, we need to flash it with
NodeMCU firmware.
Since Arduino IDE compiles and upload/writes complete firmware, it takes more time than ESPlorer
IDE.
iii
Operating Voltage: 3.3V
Input Voltage: 7-12V
Digital I/O Pins (DIO): 16
Analog Input Pins (ADC): 1
UARTs: 1
SPIs: 1
I2Cs: 1
Flash Memory: 4 MB
SRAM: 64 KB
Clock Speed: 80 MHz
USB-TTL based on CP2102 is included onboard, Enabling Plug n Play
PCB Antenna
Small Sized module to fit smartly inside your IoT projects
Webcams typically include a lens, an image sensor, support electronics, and may also
include a microphone for sound. Various lenses are available, the most common in consumer-
grade webcams being a plastic lens that can be screwed in and out to focus the camera. Fixed
focus lenses, which have no provision for adjustment, are also available. As a camera
system's depth of field is greater for small image formats and is greater for lenses with a large
f-number (small aperture), the systems used in webcams have a sufficiently large depth of
field that the use of a fixed focus lens does not impact image sharpness to a great extent.
Image sensors can be CMOS or CCD, the former being dominant for low-cost cameras, but
CCD cameras do not necessarily outperform CMOS-based cameras in the low cost price
range. Most consumer webcams are capable of providing VGA resolution video at a frame
rate of 30 frames per second. Many newer devices can produce video in multi-megapixel
resolutions, and a few can run at high frame rates such as the PlayStation Eye, which can
produce 320×240 video at 120 frames per second.
Support electronics read the image from the sensor and transmit it to the host computer. The
camera pictured to the right, for example, uses a Sonix SN9C101 to transmit its image over
iii
USB. Typically, each frame is transmitted uncompressed in RGB or YUV or compressed as
JPEG. Some cameras, such as mobile phone cameras, use a CMOS sensor with supporting
electronics "on die", i.e. the sensor and the support electronics are built on a single silicochip
to save space and manufacturing costs.
4.8 PORTABILITY
· Fixed focus
iii
Fig 4.3 web cam
CHAPTER 5
iii
Figure 5.3.2 An RFID Reader
Active RFID system: These are systems where the tag has its own power
source like any external power supply unit or a battery. The only constraint
being the life time of the power devices. These systems can be used for larger
distances and to track high value goods like vehicles.
Passive RFID system: These are systems where the tag gets power through
the transfer of power from a reader antenna to the tag antenna. They are used
for short range transmission.
Here we are mostly concerned with the passive RFID system as it is most
widely used in regular applications like in retail market organizations.
5.3.4 A brief idea about How the Passive RFID System Works:
The tag can be powered either using inducting coupling method or through EM
wave capture method. Lets us have a brief knowledge about the system using
these two methods.
iii
The reader consists of a coil connected to an AC supply such that a magnetic
field is formed around it. The tag coil is placed in the vicinity of the reader coil
and an electromotive force is induced it by the virtue of Faraday’s law of
induction. The EMF causes a flow of current in the coil, thus producing a
magnetic field around it. By the virtue of Lenz law, the magnetic field of the tag
coil opposes the reader’s magnetic field and there will be a subsequent increase
in the current through the reader coil. The reader intercepts this as the load
information. This system is suitable for very short distance communication. The
AC voltage appearing across the tag coil is converted to DC using rectifier and
filter arrangement.
iii
part of the received signal. This reflected signal is received by the reader and
monitored accordingly.
In the active RFID system, the reader sends signal to the tag using an antenna.
The tag receives this information and resends this information along with the
information in its memory. The reader receives this signal and transmits to the
processor for further processing.
iii
Figure 5.3.5An Active RFID system
Smart labels differ from RFID tags in that they incorporate both RFID and
barcode technologies. They’re made of an adhesive label embedded with an
RFID tag inlay, and they may also feature a barcode and/or other printed
information. Smart labels can be encoded and printed on-demand using desktop
iii
label printers, whereas programming RFID tags are more time consuming and
requires more advanced equipment.
Although RFID technology has been in use since World War II, the demand for
RFID equipment is increasing rapidly, in part due to mandates issued by the
U.S. Department of Defense (DoD) and Wal-Mart requiring their suppliers to
enable products to be traceable by RFID. Whether or not RFID compliance is
required, applications that currently use barcode technology are good candidates
for upgrading to a system that uses RFID or some combination of the two.
RFID offers many advantages over the barcode, particularly the fact that an
RFID tag can hold much more data about an item than a barcode can. In
addition, RFID tags are not susceptible to the damages that may be incurred by
barcode labels, like ripping and smearing. From the read distance to the types of
tags available, RFID has come a long way since World War II and there is a
bright future ahead. Review the evolution of RFID. For more information about
how RFID works and how to integrate this technology into your business
processes, read our RFID Basics.
iii
5.7 AURDINO SOFTWARE
Arduino is a tool for making computers that can sense and control more of the physical world
than your desktop computer. It's an open-source physical computing platform based on a
simple microcontroller board, and a development environment for writing software for the
board.
Arduino can be used to develop interactive objects, taking inputs from a variety of switches
or sensors, and controlling a variety of lights, motors, and other physical outputs. Arduino
projects can be stand-alone, or they can be communicate with software running on your
computer (e.g. Flash, Processing, MaxMSP.) The boards can be assembled by hand or
purchased preassembled; the open-source IDE can be downloaded for free.
iii
easy-to-use for beginners, yet flexible enough for advanced users to take advantage of
as well. For teachers, it's conveniently based on the Processing programming
environment, so students learning to program in that environment will be familiar
with the look and feel of Arduino
Open source and extensible software- The Arduino software and is published as open source
tools, available for extension by experienced programmers. The language can be expanded
through C++ libraries, and people wanting to understand the technical details can make the
leap from Arduino to the AVR C programming language on which it's based.
Can be used over different operating systems or platforms i.e. Windows, macOS,
Linux.
IDE is used for writing and uploading the code of the hardware for programming
the microcontroller accordingly.
The IDE consists of the different software libraries from the previous wiring
project.
5.9.1 Feautures
iii
5.9.2 Working
Step 1. Connecting the Arduino device with the computer using a USB.
iii
Step 2. Writing the code in the preferred language.
iii
Step 3. Selecting the port from the list of ports.
iii
Step 4. Uploading the code over to the Arduino UNO microcontroller.
iii
5.10.1 PYTHON
Addition, subtraction, and multiplication are the same, but the behavior of division
iii
Python uses the words and , or , not for its Boolean operators rather than the
Python has a type of expression termed a list comprehension. Python 2.4 extended list
comprehensions into a more general expression termed a generator expression.
Anonymous functions are implemented using lambda expressions; however, these are
limited in that the body can only be a single expression.
Conditional expressions in Python are written as x if c else y [54] (different in order of
Python makes a distinction between lists and tuples. Lists are written as [1, 2, 3] , are
mutable, and cannot be used as the keys of dictionaries (dictionary keys must
be immutable in Python). Tuples are written as (1, 2, 3) , are immutable and thus can
be used as the keys of dictionaries, provided all elements of the tuple are immutable.
The parentheses around the tuple are optional in some contexts. Tuples can appear on
the left side of an equal sign; hence a statement like x, y = y, x can be used to swap
two variables.
Python has a "string format" operator % . This functions analogous to printf format
Python 3 and 2.6+, this was supplemented by the format() method of the str class,
as "$foo" .
o Triple-quoted strings, which begin and end with a series of three single or
double quotation marks. They may span multiple lines and function like here
documents in shells, Perl and Ruby.
iii
o Raw string varieties, denoted by prefixing the string literal with an r . No
escape sequences are interpreted; hence raw strings are useful where literal
backslashes are common, such as regular expressions and Windows-style
example a[:] returns a copy of the entire list. Each element of a slice is a shallow
copy.
The eval() vs. exec() built-in functions (in Python 2, exec is a statement); the former
is for expressions, the latter is for statements.
Python uses duck typing and has typed objects but untyped variable names. Type
constraints are not checked at compile time; rather, operations on an object may fail,
signifying that the given object is not of a suitable type. Despite being dynamically
typed, Python is strongly typed, forbidding operations that are not well-defined (for
iii
example, adding a number to a string) rather than silently attempting to make sense of
them.
Python allows programmers to define their own types using classes, which are most
often used for object-oriented programming. New instances of classes are constructed
by calling the class (for example, SpamClass() or EggsClass() ), and the classes
themselves are instances of the metaclass type (itself an instance of itself),
allowing metaprogramming and reflection.
The Internet of Things, or IoT, refers to the billions of physical devices around the
world that are now connected to the internet, all collecting and sharing data.
Connecting up all these different objects and adding sensors to them adds a level of
digital intelligence to devices that would be otherwise dumb, enabling them to
communicate real-time data without involving a human being. The Internet of Things
is making the fabric of the world around us more smarter and more responsive,
merging the digital and physical universes
OpenCV is the huge open-source library for the computer vision, machine learning,
and image processing and now it plays a major role in real-time operation which is
very important in today’s systems. By using it, one can process images and videos to
identify objects, faces, or even handwriting of a human. When it integrated with
various libraries, such as NumPy, python is capable of processing the OpenCV array
structure for analysis. To Identify image pattern and its various features we use vector
space and perform mathematical operations on these features.
The first OpenCV version was 1.0. OpenCV is released under a BSD license and
hence it’s free for both academic and commercial use.
It has C++, C, Python and Java interfaces and supports Windows, Linux, Mac OS,
iOS and Android.
When OpenCV was designed the main focus was real-time applications for
computational efficiency.
All things are written in optimized C/C++ to take advantage of multi-core processing
The library has more than 2500 optimized algorithms, which includes a comprehensive set of
both classic and state-of-the-art computer vision and machine learning algorithms. These
iii
algorithms can be used to detect and recognize faces, identify objects, classify human actions
in videos, track camera movements, track moving objects, extract 3D models of objects,
produce 3D point clouds from stereo cameras, stitch images together to produce a high
resolution image of an entire scene, find similar images from an image database, remove red
eyes from images taken using flash, follow eye movements, recognize scenery and establish
markers to overlay it with augmented reality, etc.
OpenCV has more than 47 thousand people of user community and estimated number of
downloads exceeding 18 million. The library is used extensively in companies, research
groups and by governmental bodies.
Watermarks could be really annoying and there comes a time in everyone’s life where we
search down the whole internet to remove that little piece of text..
When dealing with images, background noise is very common. By using this function of
OpenCV, you can extract only useful information from the image and discard anything
present in the background. A good thing is that it allows you to enter the output shape of your
final image so that you don’t have to guess, what will be the size of your image. For this task,
I will be using the given image.
5.13 CODING OF C
import cv2
import numpy as np
pts2 = np.float32([[0,0],[img.shape[0],0],[img.shape[0],img.shape[1]],[0,img.shape[1]]])
matrix = cv2.getPerspectiveTransform(pts1,pts2)
cv2.imshow("result",result)
iii
cv2.waitKey(0)
Fig 5.13
In this task, we will be going to simply blur an image using convolutions. We will use
the below filter (kernel) for our task. This kernel is also called an averaging filter. As
the name suggests, it averages the surrounding pixels and assigns the value to the
central pixel. You can even choose a different set of values as you like, just make sure
that all the values sum up to 1.
iii
After reading the image, we will create our kernel and make a NumPy array of it.
Then we will call cv2.filter2d() function, which will take in the input image, depth,
and the kernel. And that’s all.
We can simply show our results.
import cv2
import numpy as np
kernel = np.array([[1,1,1],
[1,1,1],
[1,1,1]])
kernel = kernel/9
cv2.imshow("img",res)
cv2.waitKey(0)
We start by reading our image and converting it to grayscale. We can use this grayscale
version of the image and feed it to the cv2.adaptiveThreshold function to get the edges of the
image. You can even use the previous application to extract edges from the image. Then we
have to apply smoothing to our image. Smoothing of an image refers to making a less
pixelated version of the image. In simpler words, we are just reducing the number of distinct
iii
pixels in our image. This can be achieved by using the bilateral filter function present in
OpenCV.
smoothened image and the edges using the ‘bitwise_and’ operator in OpenCV to get our
cartoon image.
import cv2
import numpy as np
img = cv2.imread("images/lena.jpg")
gray = cv2.GaussianBlur(gray,(5,5),-1)
cv2.imshow("cartoon",cartoon)
cv2.waitKey(0)
iii
You can add more steps in between to enhance the results like changing the color space, use
different filters, etc.
5.2 Conclusion
OpenCV is an essential part of the computer vision community and using it we can build
thousands of amazing applications. You might have thought that some of these applications
are used by us in day-to-day life. What was the last time when you used Cam Scanner to scan
a copy of your assignments? Do you think the 2nd application might have played a role in it?
Isn’t the cartooned image we created somewhat look like a Snapchat version of the image.
Through these applications, the purpose was to encourage you to explore the solutions to
real-life problems using easy and efficient tools like OpenCV.
iii
5.3 EMBEDDED C LANGUAGE
Embedded C is a set of language extensions for the C programming language by the C
Standards Committee to address commonality issues that exist between C extensions for
different embedded systems.
Earlier, many embedded applications were developed using assembly level programming.
However, they did not provide portability. This disadvantage was overcome by the advent of
various high-level languages like C, Pascal, and COBOL. However, it was the C language
that got extensive acceptance for embedded systems, and it continues to do so. The C code
written is more reliable, scalable, and portable; and in fact, much easier to understand.
Embedded C Programming is the soul of the processor functioning inside each and
every embedded system we come across in our daily life, such as mobile phones, washing
machines, and digital cameras. Each processor is associated with embedded software. The
first and foremost thing is the embedded software that decides to function of the embedded
system. Embedded C language is most frequently used to program the microcontroller.
iii
C language is software designed with different keywords, data types, variables, constants,
etc.
Embedded C is a generic term given to a programming language written in C, which is
associated with a particular hardware architecture.
Embedded C is an extension to the C language with some additional header files. These
header files may change from controller to controller.
The microcontroller 8051 #include<reg51.h> is used.
What is an Embedded C Programming
In every embedded system based projects, Embedded C programming plays a key role to
make the microcontroller run & perform the preferred actions. At present, we normally utilize
several electronic devices like mobile phones, washing machines, security systems,
refrigerators, digital cameras, etc. The controlling of these embedded devices can be done
with the help of an embedded C program. For example in a digital camera, if we press a
camera button to capture a photo then the microcontroller will execute the required function
to click the image as well as to store it.
Embedded C programming builds with a set of functions where every function is a set of
statements that are utilized to execute some particular tasks. Both the embedded C and C
languages are the same and implemented through some fundamental elements like a variable,
character set, keywords, data types, declaration of variables, expressions, statements. All
these elements play a key role while writing an embedded C program.
The embedded system designers must know about the hardware architecture to write
programs. These programs play a prominent role in monitoring and controlling external
devices. They also directly operate and use the internal architecture of the microcontroller,
such as interrupt handling, timers, serial communication, and other available features.
As we discussed earlier, the designing of an embedded system can be done using Hardware &
Software. For instance, in a simple embedded system, the processor is the main module that
works like the heart of the system. Here a processor is nothing but a microprocessor, DSP,
microcontroller, CPLD & FPGA. All these processors are programmable so that it defines the
working of the device.
iii
An Embedded system program allows the hardware to check the inputs & control outputs
accordingly. In this procedure, the embedded program may have to control the internal
architecture of the processor directly like Timers, Interrupt Handling, I/O Ports, serial
communications interface, etc.
So embedded system programming is very important to the processor. There are different
programming languages are available for embedded systems such as C, C++, assembly
language, JAVA, JAVA script, visual basic, etc. So this programming language plays a key
role while making an embedded system but choosing the language is very essential.
Comments
Directives of Processor
Configuration of Port
Global variables
Core Function/Main Function
Declaration of Variable
The logic of the Program
Comments
In programming languages, comments are very essential to describe the program’s function.
The code of the comments is non-executable but used to provide program documentation. To
understand the function of the program, this will make a simple method to understand the
function of the program. In embedded C, comments are available in two types namely single
line and mainline comment.
In an embedded C programming language, we can place comments in our code which helps
the reader to understand the code easily.
C=a+b; /* add two variables whose value is stored in another variable C*/
Generally, for the programming languages, single-line comments are very useful to clarify a
fraction of the program. These comments begin with a double slash (//) and it can be located
iii
anywhere within the programming language. By using this, the whole line can be ignored
within a program.
Multi-Line Comment
Multi-line comments begin with a single slash (/) & an asterisk (/*) in the programming
languages which explains a block of code. These types of comments can be arranged
anywhere within the programming language and mainly used to ignore a whole block of code
within a program.
Directives of Processor
The lines included within the program code are called preprocessor directives which can be
followed through a hash symbol (#). These lines are the preprocessor directives but not
programmed statements.
The code can be examined through a preprocessor before real code compilation starts &
resolves these directives before generating a code through regular statements. There are
several special preprocessor directives are available although two directives are extremely
helpful within the programming language
#include
#include<reg51.h>
Sbit LED = P2^3;
Main();
{
LED = 0x0ff
Delay();
LED=0x00;
}
#define
#include<reg51.h>
#define LED P0
Main();
iii
{
LED = 0x0ff
Delay();
LED=0x00;
}
In the above program, the #include directive is generally used to comprise standard libraries
like study and. h is used to allow I/O functions using the library of ‘C’. The #define directive
usually used to describe the series of variables & allocates the values by executing the
process within a particular instruction like macros.
Configuration of Port
The microcontroller includes several ports where every port has different pins. These pins can
be used for controlling the interfacing devices. The declaration of these pins can be done
within a program with the help of keywords. The keywords in the embedded c program are
standard as well as predefined like a bit, sbit, SFR which are used to state the bits & single
pin within a program.
There are certain words that are reserved for doing specific tasks. These words are known as
keywords. They are standard and predefined in the Embedded C. Keywords are always
written in lowercase. These keywords must be defined before writing the main program. The
main functions of the keywords include the following.
#include< >
Sbit a = P 2^2;
SFR 0x00 = PoRT0;
Bit C;
main()
{
……………..
……………..
}
iii
sbit
This is one kind of data type, used to access a single bit within an SFR register.
The syntax for this data type is : sbit variable name = SFR bit ;
If we assign p2.1 as ‘a’ variable, then we can use ‘a’ instead of p2.1 anywhere in the
program, which reduces the complexity of the program.
Bit
This type of data type is mainly used for allowing the bit addressable memory of random
access memory like 20h to 2fh.
Example: bit c;
It is a bit series setting within a small data region that is mainly used with the help of a
program to memorize something.
SFR
This kind of data type is used to obtain the peripheral ports of the SFR register through an
additional name. So, the declaration of all the SFR registers can be done in capital letters.
The syntax of this data type is: SFR variable name = SFR address for SFR register;
If we allocate 0×80 like ‘port0’, after that we can utilize 0×80 in place of port0 wherever in
the programming language to decrease the difficulty of the program.
iii
SFR Register
The SFR stands for Special Function Register. In 8051 microcontroller, it includes the RAM
memory with 256 bytes, which is divided into two main elements: the first element of 128
bytes is mainly utilized for storing the data whereas the other element of 128 bytes is mainly
utilized to SFR registers. All the peripheral devices such as timers, counters & I/O ports are
stored within the SFR register & every element includes a single address.
Global Variables
When the variable is declared before the key function is known as the global variable. This
variable can be allowed on any function within the program. The global variable’s life span
mainly depends on the programming until it reaches an end.
#include<reg51.h>
Unsigned int a, c =10;
Main()
{
……………
…………..
}
The main function is a central part while executing any program and it begins with the main
function simply. Each program utilizes simply one major function since if the program
includes above one major function, next the compiler will be confused in begin the execution
of the program.
#include<reg51.h>
Main()
{
……………
…………..
}
iii
Declaration of Variable
The name like the variable is used for storing the values but this variable should be first
declared before utilized within the program. The variable declaration states its name as well
as a data type. Here, the data type is nothing but the representation of storage data. In
embedded C programming, it uses four fundamental data types like integer, float, character
for storing the data within the memory. The data type size, as well as range, can be defined
depending on the compiler.
The data type refers to an extensive system for declaring variables of different types like
integer, character, float, etc. The embedded C software uses four data types that are used to
store data in memory.
The ‘char’ is used to store any single character; ‘int’ is used to store integer value, and ‘float’
is used to store any precision floating-point value. The size and range of different data types
on a 32-bit machine are given in the following table. The size and range may vary on
machines with different word sizes.
The char/signed char data type size is 1 byte and its range is from -128 to +128
The unsigned char data type size is 1 byte and its range is from 0 to 255
Int/signed int data type size is 2 byte and its range is from -32768 to 32767
Unsigned int data type size is 2 byte and its range is from 0 to 65535
Main();
{
Unsigned int a,b,c;
}
comments
preprocessor directives
global variables
main() function
{
iii
local variables
statements
…………..
…………..
}
fun(1)
{
local variables
statements
…………..
…………..
}
The logic of the program is a plan of the lane that appears in the theory behind & predictable
outputs of actions of the program. It explains the statement otherwise theory regarding why
the embedded program will work and shows the recognized effects of actions otherwise
resources.
Main
{
LED = 0x0f;
delay(100);
LED = 0x00;
delay(100);
}
The main factors to be considered while choosing the programming language for developing
an embedded system include the following.
iii
Program Size
Every programming language occupies some memory where embedded processor like
microcontroller includes an extremely less amount of random access memory.
The programming language should be very fast, so should run as quickly as possible. The
speed of embedded hardware should not be reduced because of the slow-running software.
Portability
For the different embedded processors, the compilation of similar programs can be done.
Simple Implementation
Simple Maintenance
Readability
Differences between C Program and Embedded C Program
The difference between embedded C and C programming is not much actually apart from the
operating environment and some extensions. These programming languages are ISO
Standards and also have approximately similar syntax, functions, data types, etc. The main
differences between C programming and embedded c programming include the following.
Advantages
iii
5.4 Disadvantages
iii
RESULT
As we see that existing voting system has many defects such as lengthy process, time taking,
not secure, bogus voting, no security level but now we can say that our approach is more
useful and secure from the existing system. Highly secured because in this project we have to
use face recognition and face comparison so false user can’t give votes. We can access result
(counting) faster than existing system. Because ballet system takes much more time in
counting process. But this computerized voting system increases the trust in voting system as
well as Election Commission. Still there remains some limitations and drawbacks in this
voting System.
iii
REFERENCES
[1] Edy Winarno, Wiwien Hadikurniawati, Imam Husni Al Amin, Muji Sukur"Anti-Cheating
Presence System Based on 3WPCADual Vision Face Recognition:Proc. EECSI 2017,
Yogyakarta, Indonesia, 19-21 September 2017", Issue:September 2017, Pages:121-124.
[2] Amish Basal, Utkarsh Raina, Vaibhavi Pujari, Roushan Kumar "E-Smart Voting System
with Secure Data Identification using Cryptography:2018 3rd International Conference for
Convergence in Technology (I2CT) The Gateway Hotel, XION Complex, Wakad Road,
Pune, India. Issue:Apr 06-08, 2018,Pages:1-4.
[3] Swetha M S, Thungamani M, Shreejwol Disti, Raman Shah “Smart Voting System
Support through Face Recognition” IJIRST –International Journal for Innovative Research in
Science & Technology| Volume 5 | Issue 11 | April 2019.
[4] Vikas Kumar, MS Swetha, MS Muneshwara, S Prakash, “Cloud computing: towards case
study of data security mechanism,” vol-2 issue-4 page no-1-8 2011.
iii