You are on page 1of 93

2|Page

Copyright © 2017 by Authors.

No part of this book may be reproduced or distributed in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise or stored in a database or retrieval system without
the prior written permission of the authors. The project may be stored or build, but they may not be
reproduced for publication.

Information contained in this work has been obtained by authors, from the source believed to be
reliable. However, neither authors nor publisher guarantee the accuracy or completeness of any
information published herein, and neither authors nor its publisher shall be responsible for any
error, omissions, or damage arising out of use of this information. This work is published with the
understanding that publisher and its authors are supplying information but are not attempting to
render engineering or other professional services. If such services are required, the assistance of
an appropriate professional should be sought.

3|Page
Contents
Copyright
Mostly used resistor and its color code
Components symbols
Soldering: How to solder

1. Earthquake Detector Using Arduino ......................................................................................... 10


2. Arduino Fingerprint Sensor Lock ............................................................................................. 16
3. Arduino FM Receiver Circuit ................................................................................................... 23
4. Arduino FM Transmitter ........................................................................................................... 30
5. Temperature Controlled Fan using Arduino ............................................................................. 33
6. Arduino VU Meter .................................................................................................................... 36
7. Soil Moisture Meter using Arduino .......................................................................................... 44
8. RGB Colour Generator using Arduino ...................................................................................... 47
9. Dark Sensor using Arduino ....................................................................................................... 52
10. DIY Breathalyzer using Arduino and MQ-3 Sensor Module .................................................... 55
11. Arduino and RFID Based Attendance System .......................................................................... 58
12. Accident Detection and Alert System using Arduino ............................................................... 62
13. Arduino and RFID based Door Access System ........................................................................ 66
14. Arduino Based Automatic Call Answering Machine ................................................................ 70
15. Fingerprint Attendance System using Arduino ......................................................................... 74
16. Arduino Based Data Logger ...................................................................................................... 89

4|Page
5|Page
Mostly used Resistors and its Color Code
Resistor Color Code Resistor Color Code
Value Value
1Ω Brown Black Golden 4.7 KΩ Yellow Violet Red
2.2Ω Red Red Golden 5.6 KΩ Green Blue Red
4.7Ω Yellow Violet Golden 6.8 KΩ Blue Grey Red
10Ω Brown Black Black 8.2 KΩ Grey Red Red
12Ω Brown Red Black 10 KΩ Brown Black Orange
15Ω Brown Green Black 12 KΩ Brown Red Orange
18Ω Brown Grey Black 15 KΩ Brown Green Orange
22Ω Red Red Black 18 KΩ Brown Grey Orange
27Ω Red Violet Black 22 KΩ Red Red Orange
33Ω Orange Orange Black 33 KΩ Orange Orange Orange
39Ω Orange White Black 39 KΩ Orange White Orange
47Ω Yellow Violet Black 43 KΩ Yellow Orange Orange
56Ω Green Blue Black 47 KΩ Yellow Violet Orange
68Ω Blue Grey Black 56 KΩ Green Blue Orange
82Ω Grey Red Black 68 KΩ Blue Grey Orange
100Ω Brown Black Brown 82 KΩ Grey Red Orange
120Ω Brown Red Brown 100 KΩ Brown Black Yellow
150Ω Brown Green Brown 120 KΩ Brown Red Yellow
180Ω Brown Grey Brown 150 KΩ Brown Green Yellow
220Ω Red Red Brown 180 KΩ Brown Grey Yellow
270Ω Red Violet Brown 220 KΩ Red Red Yellow
330Ω Orange Orange Brown 270 KΩ Violet Violet Yellow
390Ω Orange White Brown 330 KΩ Orange Orange Yellow
470Ω Yellow Violet Brown 390 KΩ Orange White Yellow
560Ω Green Blue Brown 470 KΩ Yellow Violet Yellow
680Ω Blue Grey Brown 560 KΩ Green Blue Yellow
820Ω Grey Red Brown 680 KΩ Blue Grey Yellow
1 KΩ Brown Black Red 820 KΩ Grey Red Yellow
1.2 KΩ Brown Red Red 1 MΩ Brown Black Green
1.5 KΩ Brown Green Red 1.2 MΩ Brown Red Green
1.8 KΩ Brown Grey Red 2.2 MΩ Red Red Green
2.2KΩ Red Red Red 2.7 MΩ Red Violet Green
2.7 KΩ Red Violet Red 3.3 MΩ Orange Orange Green
3.3 KΩ Orange Orange Red 4.7 MΩ Yellow Violet Green
3.9 KΩ Orange White Red 10 MΩ Brown Black Blue

6|Page
Component Symbols
Figure shown below shows the circuit symbols for some common electronics. Various standards exist for

Piezo-buzzer 7-segment Diode Ceramic


Electrolytic
Bulb display capacitor
capacitor

Ground
Zener Diode LED Speaker Meter Microphone

NPN transistor PNP ON-OFF Push-to-on Uni-junction Transformer


transistor switch switch transistor
(UJT)

LDR

Resistor AND gate NOT gate


OR gate NOR gate

NAND gate NAND gate Exclusive OR Exclusive


schmitt gate Amplifier
NOR gate
trigger

circuit diagrams, but the basic symbols are all recognizable between standards. The set used in this book does
not closely follow any particular standard. I have just chosen what I consider to be the most easy-to-read
approach to the diagrams.

7|Page
Soldering: How to Solder
Soldering in electronics is analogous to fixing of a component using glue. It is actually a general phenomenon
in the field of electronics which involves fixing of electronic components into a special board called PCB with
the help of instruments like soldering iron and electrical solder commonly called as ‘Solder wire’. Like glue,
soldering establishes a secure connection between PCB and components. One must be careful enough to follow
the correct procedure to perform soldering to avoid possible consequences due to failure. You should not heat
the solder wire directly with the soldering iron as it fuses only to the component lead, copper pad of PCB if they
are hot as well and doesn’t establish connection required. The central idea to perform soldering is to get the
component lead and the copper PCB pad hot enough that the solder will melt right away as it touches them.

Multiple types of solder wire are available at the market varying on


dimensions and quality. Different wires are assigned for different uses.
For example, in electrical connections, it is highly recommended to
use a rosin-core electrical soldier as shown in figure. The less is the
diameter of the soldier wire, the circuit becomes simpler since less
heat is enough to melt the solder and thus fusing component to PCB
becomes easier.

Only the heated iron melts the wire so it is a must to let the iron heat
up completely before following the soldering procedure. With
soldering process, the gaps around the lead are completely filled by
the melted solder. However, soldering takes time and can be an
annoying process if not followed properly. If the iron is not heated
enough, then the solder will not melt and if the solder melts
excessively, it gets messy and spreads around the copper board. Also,
the excessive amount of melted solder forms bubbles and can possibly
touch another component lead or copper trace resulting short circuit
or component damage. So, measures for extra precautions need to be
taken before implementing this process.

In context of Nepal, soldering iron is available under budget of Rs. 400 at most hardware stores or Radio Shack.
Though it works for most projects, this type of iron takes a while to heat up (around 10 minutes) and is difficult
to solder in tight spots since it constitutes typically a large tip.

Another type of soldering iron can be found which has adjustable range of temperatures with multiple heating
elements and heats up in around 1minute. It is provided with typically a smaller tip for soldering on small
projects or tight spaces as shown in figure. For the extended features and flexibility during application, this type
of iron is highly recommendable. The estimated cost is Rs. 1500 to Rs. 5000.

Lately I was obsessed with a soldering iron worth of


Rs. 4500 until Hakko 936 came on my hands. Hakko
936 is not the best iron available but it is comparably
better than others in context of heating time. It heats
up in few minutes and on top of it, gets much hotter
than a typical iron, making soldering quicker and
smooth.

Like mathematics, soldering requires long time


practice to excel at this particular process. Rather
than spoiling the expensive designs, we would love
to advise you to practice soldering on perforated
prototyping board before making attempts to build
your own PCBs. Also, you can buy an electronic kits
from various suppliers that come with all needed
parts, PCB, and instructions– only thing they require

8|Page
is you to have a soldering iron and an hour or two of assembly time. I too bought several kits in early days to
make my soldering skill clean and the interesting thing about doing this is that they provided both an entertaining
project and valuable hands-on learning experience on the other side.

Soldering Shortcuts
When soldering is performed on a board, sometimes we have a clear path on the copper-side of the board from
one electrical lead to another. To simplify the overall soldering process and to prevent the cluttered wires in the
circuit, some soldering shortcuts can be followed to make the connections easier as shown in figure.

Option 1—Pooling solder: During soldering, heat the adjacent (but separated) copper pads and apply solder,
then you will notice the solder will tend toward both pads while avoiding the gap between them. This is because
the solder cannot stick to the fiberglass PCB without any copper coating. If you add “too much” solder to these
two pads, you will notice that the molten solder will try to jump the gap over to the other pool of molten solder
on the other pad. If you are careful, you can let the solder solidify between the two pads creating a simple solder
connection. This can be a helpful method of creating a jumper-wire between two or three adjacent pads. For
high-power connections, this is not a suitable option because the solder is not capable of transferring large
amounts of current.

Option 2—Wire traces: If you find soldering tiresome or you cannot perform clean soldering then as alternative
to this you can replace solder wire with a piece of solid bare copper wire (16-20awg) and placed directly on the
copper pads that you would like to connect as shown in figure (see A, B, and D in Figure 1-27). If the connection
will span several pads, it is desirable to apply a small amount of solder to each pad that the wire touches to
ensure that it will not move after the circuit is complete. The plus point of this method is that you can bend the
wire around other components to make a curved or angled line. This method yields results similar to a
homemade PCB trace. Because each wire is connected directly from one lead to another, there can be no
crossing wires from other components on the underside of the PCB. This method is acceptable for higher-current
applications.

Let’s take few examples of different kinds of soldering process; Trace A is a bare wire with no insulation, but is
soldered only at each end. Trace B is bare wire, but is soldered at each copper pad, making it far more secure
than trace A. Trace C does not even have a wire–it is just solder that is pooled across all six pads. Trace D is a
wire that has its insulation intact, but soldered only at each end. Among these traces, Trace C is difficult to
accomplish across more than two or three pads and is not acceptable for high-power applications.

9|Page
1. Earthquake Detector Using Arduino
They say, 'Prevention is better than cure'. This statement goes perfect with the events whose probability of
occurrence is highly possible. Earthquake is one of such disaster that comes as an evil fate and sweeps away
precious human lives and civilization, it is that unpredictable phenomenon whose occurrence cannot be avoided,
but at least we can take measures to minimize the adverse effect of its consequences. In doing so, recent
technology play a vital role. A similar circuit is presented here which acts an earthquake indicator and prevents
further damage. Arduino and a highly-sensitive ADXL335 accelerometer are used to accomplish our goals.
ADXL335 works like a critical sensor in detecting vibrations and predict earthquake. The device "Earthquake
Detector using Arduino" can sense vibrations and knocks along the three physical dimensions or axes, which
make it more sensitive. Once it identifies vibration, it is applied with acceleration and ADXL335 produces an
analogue voltage equivalent to acceleration imposed on it by the vibration. The device "Earthquake Detector
using Arduino" supplies three outputs along three axes- X-, Y- and Z- axes. These output pins are connected
to ADC pins of Arduino Uno. For any acceleration production or vibrations detected, analog outputs are
produced by the accelerometer and then the ADC detects it.

In the arduino uno, voltage levels are compared. In cases of earthquake, where the movement is
excessive enough to cross a value beyond defined threshold value and create a large impact, some
preventive actions are
followed. Firstly, a LED
glows and a buzzer alarm
sounds high enough to alert
all the people about the
scenario and relay energizes.
Out of these three devices,
LED and buzzer fit perfectly
for earthquake indication at
home where as relay is a must
for industrial applications.
Relay is wired to a PLC to
ensure safe interlocking of
any operating machinery part
and furnace control to shut
them down to avoid accidents
due to earthquake. To
implement this concept,
threshold adjustment buttons are fitted next to machines to initiate necessary task when needed. LCD
works as an informer by displaying the threshold adjustments information. It adds next pile to
flexibility of the project.
Circuit and Working of Earthquake Detector using Arduino
The construction of the project "Earthquake Detector using Arduino" is so simple, that it looks like
assembling of few common electronics components. The fact that the project "Earthquake Detector
using Arduino" uses Arduino Uno, which is itself a complete circuit, makes this project easier to
implement. The arduino board and ADXL335 accelerometer module are interfaced (connected across
CON2) properly.

10 | P a g e
The ADC inputs of the accelerometer are connected to arduino pins in the given pattern: X-axis to A0,
Y-axis to A1 and Z-axis to A2. In order to externally adjust the threshold value for vibration detection,
we have added two extra pushbuttons to the circuit. These buttons are connected across 5V supply and
then connected to the interrupt pins 2 and 3 of arduino uno, which are further grounded through
resistors R2 and R1. For displaying the information, a 16x2 LCD (LCD1) is employed. The LCD is
set in 4-wired mode with its default state enabled (i.e. backlight and contrast pin). Both the
components; LED and buzzer connected across CON4 needs switching and for this transistor T2
(BC548) is connected at the pin 5 terminal of Arduino. There are cases when we need to de-energize
the relay (RL1) when alarms are triggered during industrial PLC interfacing for safety interlocks. And,
so an extra transistor (BC548) T1 is connected across pin 10. All arduino pins from 6-9 and 11-12 are
configured for LCD control operations and data lines. Under steady conditions, when the supply is
continuously fed to the circuit, the status of accelerometer is monitored at every instant and then each
value is stored in Arduino internal EEPROM regardless of its orientation.
To use 10-bit ADC, different header file is tagged along for programming in the code. Since the ADC
is 10-bit, special header file has been provided with the code. Stability is a must in the project
"Earthquake Detector using Arduino" to ensure precise reading and therefore approximately five-
second delay is fixed so that all voltage levels and the system could maintain a stable state before initial
values are read and collected.

11 | P a g e
These values are gathered around
the three respective axes of the
accelerometer, which are then fed
to the arduino. The microcontroller
fixed in the arduino board accepts
those readings and then store it in
the EEPROM as stated earlier. The
threshold value of reading is also
stored in the same location i.e.
EEPROM which makes it easy to
fetch data for comparison. In this
project, the default threshold value
is set to 25.
LCD performs information
displaying function. Since it
illustrates multiple data, its
working can be sectioned into three
distinct categories: initializing
mode, monitoring mode and
indicating mode which are further
discussed in points below:
Initializing mode: Multiple
parameters are to be considered in
this project i.e. Temperature, soil
moisture etc. All considered parameters are initialized in this mode. It is shown in fig. 3
Monitoring mode: In this mode, values of the parameters are continuously monitored at every interval
and the fixed threshold value is displayed on the second row of LCD foe comparison.
Indicating mode: This is the main part where the values are continuously read and then the necessary
comparison is done in between the standard threshold set in the EEPROM and field values read by the
accelerometer. If variations are observed in the values under comparison i.e. stored value by the
accelerometer is either greater (along the positive side) or less (along negative side) than the preset
threshold, the alarm is triggered. And, the relay gets de-energized. The program code also supports the
negative values in all three axes along with the positive values.
As we can see, push buttons also serve as interrupts being connected to pin 2 and 3 of arduino so that
necessary sensitivity adjustments can be made to increase or decrease threshold values by pressing
those buttons. Being earthquake based project, 10-15 value is claimed to be optimum threshold value
here. By setting this value up to 5 to 8, we can modify this project to be used in detection of knocks
and vibrations.
The project "Earthquake Detector using Arduino" is highly sensitive and so it must be carefully
fabricated. We can also set this project within a protective hard enclosure and then fix it in any place
of the industry or home. Further the project "Earthquake Detector using Arduino" can also be
operated in terms of acceleration. Firstly, determine resultant acceleration by using formula of square
root of X2+Y2+Z2, where X, Y and Z are corresponding co-ordinates outputs obtained from
ADXL335. Now, compare the result calculated with the preset threshold. And, the same process

12 | P a g e
follows on-wards. If desired, user can use the same project to perform this change and evaluate the
differences in using two methods.

Software Code: The software code is divided into two section i.e. earthquake.ino and
EEPROMAnything.h
Save the below code in earthquake.ino
#include <EEPROM.h>
#include "EEPROMAnything.h"
#include <LiquidCrystal.h>

const int alarmPin = 5;


const int relayPin = 10;
int Xacc, Yacc, Zacc, threshold = 0, thresholdSET = 25;
long debouncing_time = 15; //Debouncing Time in Milliseconds
volatile unsigned long last_micros;
LiquidCrystal lcd(12, 11, 9, 8, 7, 6);
struct sensorValue
{
int X;
int Y;
int Z;
};

sensorValue acceleration;

void debounceInterrupt_Increment()
{
if ((long)(micros() - last_micros) >= debouncing_time * 1000) {
IncrementThreshold();
last_micros = micros();
}
}

void debounceInterrupt_Decrement()
{
if ((long)(micros() - last_micros) >= debouncing_time * 1000) {
DecrementThreshold();
last_micros = micros();
}
}
void IncrementThreshold() {
thresholdSET = EEPROM.read(500);
thresholdSET++;
EEPROM.write(500, thresholdSET);
}

void DecrementThreshold() {
thresholdSET = EEPROM.read(500);
thresholdSET--;
EEPROM.write(500, thresholdSET);
}

13 | P a g e
void setup() {
lcd.begin(16, 2);
attachInterrupt(0, debounceInterrupt_Increment, RISING);
attachInterrupt(1, debounceInterrupt_Decrement, RISING);
pinMode(alarmPin, OUTPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, HIGH);
EEPROM.write(500, thresholdSET);
digitalWrite(alarmPin, LOW);
lcd.setCursor(0, 0);
lcd.print("Initializing....");
delay(5000);
sensorValue acceleration = { analogRead(A0) , analogRead(A1) , analogRead(A2) };
EEPROM_writeAnything(0, acceleration);
EEPROM_readAnything(0, acceleration);
lcd.clear();
}

void loop() {
EEPROM_readAnything(0, acceleration);
threshold = EEPROM.read(500);
lcd.setCursor(0, 0);
lcd.print("Monitoring Mode");
lcd.setCursor(0,1);
lcd.print("Threshold = ");
lcd.print(threshold);
Xacc = analogRead(A0);
Yacc = analogRead(A1);
Zacc = analogRead(A2);

if ((Xacc >= (acceleration.X + threshold)) || (Xacc <= (acceleration.X - threshold))||(Yacc >=


(acceleration.Y + threshold)) || (Yacc <= (acceleration.Y - threshold))||(Zacc >= (acceleration.Z +
threshold)) || (Zacc <= (acceleration.Z - threshold))) {
digitalWrite(relayPin, LOW);
digitalWrite(alarmPin, HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("ALARM !!!!!");
lcd.setCursor(0,1);
lcd.print("PLEASE EVACUATE");
delay(5000);
digitalWrite(relayPin, HIGH);
digitalWrite(alarmPin, LOW);
lcd.clear();
}

14 | P a g e
The Header file is given below must be saved as EEPROMAnything.h and should be kept in Library
folder of arduino.
#include <EEPROM.h>
#include <Arduino.h> // for type definitions

template <class T> int EEPROM_writeAnything(int ee, const T& value)


{
const byte* p = (const byte*)(const void*)&value;
unsigned int i;
for (i = 0; i < sizeof(value); i++)
EEPROM.write(ee++, *p++);
return i;
}

template <class T> int EEPROM_readAnything(int ee, T& value)


{
byte* p = (byte*)(void*)&value;
unsigned int i;
for (i = 0; i < sizeof(value); i++)
*p++ = EEPROM.read(ee++);
return i;
}

PARTS LIST OF EARTHQUAKE DETECTOR USING ARDUINO


Resistor (all ¼-watt, ± 5%
Carbon)
R1, R2 = 10 KΩ
R3, R6 = 1 KΩ
R4, R5 = 330 Ω
VR1 = 10 KΩ
Semiconductors
Arduino Uno
T1, T2 = BC548
ADXL335 Accelerometer
Miscellaneous
SW1, SW2 = Push-to-On Switch
PZ1 = Buzzer
LCD1 = 16*2 LCD
RL1 = 5V 1C/O Relay
LED1 = Any color LED

15 | P a g e
2. Arduino Fingerprint Sensor Lock
Recently, there has been recorded tremendous increase in the crime rate everywhere in the world. This
issue is turning more severe every day. To get away with this problem, we decided to take help from
technology and there this project "Arduino Fingerprint Sensor Lock" developed. We know the saying
very well- 'Prevention is better than cure', rather than to face the loss it is much better to take necessary
actions to eradicate that issue before it happens. The project helps us to implement the fact.
The reason behind the fact that project has gained so much popularity in a short interval is mostly
because of its simplicity and attractive feature. Today, fingerprint project is linked with security and
major task, later it may be employed as fingerprint based driving license, bank accounts operation and
so on. 'Matching Algorithm' is the main principle of this project where specified templates of
fingerprints are initially stored. Then, the fingerprint of user is compared with the pre-stored templates
of fingerprints. It verifies authentication process.

The old practice of using a simple key to unlock a door is time consuming as well as less secure.
Replacing those methods with fingerprints, we get access inside a house/room just by placing the
correct finger on the sensor. However, only authorized people can open the door because of the special
fingerprint technique. If the fingerprint matches with any one of the image from database, the door
unlocks and the LCD displays a welcome message along with that person's name.

16 | P a g e
Circuit and Working of Arduino
Fingerprint Sensor Lock
12V power is the main source of energy
supply required for this system, which is
given to the VIN pin of arduino board. The
solenoid electric lock itself consumes 12V
supply, however Arduino microcontroller (MCU) requires only 5V which can be easily supplied from
the inbuilt 5V regulator from the Arduino Uno Board. And, the other common 12V supply is externally
supplied to the system.
The components used are explained in brief below:
(a). Arduino Uno MCU board
Arduino Uno MCU board is based on ATmega328/ATmega328P acts like a CPU of the system
"Arduino Fingerprint Sensor Lock" the figure of which is shown in figure 1. This board comprises
multiple features. There are 14 digital input/output (I/O) pins, six analogue inputs, 32k flash memory,
16MHz crystal oscillator, a USB connection, power jack, ICSP header and reset button. We can use
any of its features through Arduino IDE software through proper programming.
(b). Fingerprint sensor module
The RX and TX pin of fingerprint sensor module R305 is connected across D3 an D2 pin of arduino
board respectively as shown in circuit diagram (figure 1). Since this module is constructed using
UART technology, it is easy to interface sensor directly with the MCU or also to the PC using
max232/USB serial adaptor. The information collected from the fingerprint can be collected in the
module. During the process of identification, the data can be configured in either 1:1 or 1:N module.
In order to ensure serial communication, two pins of R305 sensor; TX and RX are connected across
digital pins 2 and 3 of Arduino Uno.
(c). LCD (Liquid Crystal Display)
The 16*2 LCD1 acts as a display media to distribute corresponding messages when the system is
executed. In this type of particular IC, each character is made of 5×7 dot-matrix. The connection
between LCD and Arduino Uno is done in following pattern:
LCD pins 3, 4, 5 and 6 are configured in control mode and are linked to preset pin (VR1) as output,
pin 12, GND and pin 11 of Arduino Uno.
The four data pins of LCD; pins 11, 12, 13 and 14 are coupled to pins 7, 6, 5 and 4 of Arduino,
respectively.
The Preset VR1 is used to adjust the contrast of the LCD display.
(d). Electronic door-lock Solenoid
It is nothing new but almost similar to an electromagnet. A slug of metal i.e. armature surrounded by
a big coil of copper wire forms a solenoid. It is connected to the output of relay as show in circuit
diagram. The working of solenoid is much simpler than its construction, as soon as the coil gets
energized; the armature is pulled into the center of the coil that permits the solenoid to move to one
end.
Since the supply current required to operate the solenoid lock is higher than the supply form Arduino
Uno board, we need to employ an extra 5V relay (RL1). In order to establish connection between

17 | P a g e
normally open relay contacts and GND, solenoid is implemented in the middle. The figure illustrated
in output (Fig: 2) depict the view on sequence of messages to be displayed on the LCD from author's
prototype.

Software of Arduino Fingerprint Sensor Lock


The core section of the project; software part utilizes two different programs-enroll and fingerprint.
getFingerprintEnroll(int,id), Adafruit_Fingerprint(&mySerial) and getFingerprintEnroll(id) are some
of the different functions syntax used in those programs. These are in-built functions found in library
and they pass arguments when these functions are called at different locations of programs.
Once the enroll part of the program has been uploaded in the Arduino Uno, go through the Arduino
IDE and then open the serial monitor by opening tabs like tools and then select serial monitor options.
It is necessary to set the baud rate to a value lower than the serial monitor window to 38400. At the
same time choose Newline option. And now, one by one execute the instructions given on the serial
monitor. Once you place a finger on the fingerprint module, type an ID number. It can be any whole
number. Then when send key is entered, the corresponding ID number is transmitted to the main
portion i.e. Arduino Uno form the serial monitor section. Thus sent information (fingerprint) is
digitized and converted into storable form which is piled up in R305 module database.
This system can withstand a total of 200+ fingerprints which is remarkable. However, each fingerprint
must have unique ID number assigned since this is the prime factor to be utilized in identification of
the valid individual's name. The serial monitor assists the client in an effective way. Every real-time
information of when to place the finger on the sensing module and when it is okay to remove, is all
provided by the serial monitor which makes this project more user-friendly.
If you prefer to debug the system without implementing LCD display, initially upload the fingerprint
program and then set the same settings as mentioned above for the serial monitor configuration. Here
again the serial monitor performs the guide function. This technique of implementing circuit is
employed to make necessary comparisons between the current sensed fingerprint sample with the
samples already stored in the database. The programming flexibility feature permits customer to amend
necessary changes in names and ID number by changing the code to a slight extent as per the
requirement.
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins


LiquidCrystal lcd(12, 11, 7, 6, 5, 4);

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

int getFingerprintIDez();
SoftwareSerial mySerial(2, 3);// tx, rx

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void doorOpen()
{
lcd.clear();

18 | P a g e
lcd.print("WELOME");
if(finger.fingerID==0)
{
Serial.println("Welcome BEP");//i enroled ID no 1 as BEP'sfingerprint, so used this line to display
corresponding name

lcd.setCursor(0, 1);
lcd.print("BEP");
digitalWrite(8,HIGH);
delay(3000);
lcd.clear();
}
if(finger.fingerID==1)
{
Serial.println("Welcome DLT");// i enroled ID no 1 as DLT's fingerprint, so used this line to
display corresponding name

lcd.setCursor(0, 1);
lcd.print("DLT");
digitalWrite(8,HIGH);
delay(3000);
lcd.clear();
// more number of user can be add hear
}

void doorClose()
{
digitalWrite(8,LOW);
lcd.print("No valid finger");
lcd.setCursor(0, 1);
lcd.print("on the sensor");

void setup()
{
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
digitalWrite(9,HIGH);
digitalWrite(10,LOW);
lcd.begin(16, 2);
Serial.begin(38400);
Serial.println("fingertest");
finger.begin(57600);
pinMode(8,OUTPUT);//Pin connectet to relay

if (finger.verifyPassword())
{
Serial.println("Found fingerprint sensor!");
} else {

19 | P a g e
Serial.println("Did not find fingerprint sensor :(");
lcd.print("Sensor not Found");
while (1);
}
Serial.println("No valid finger found,waiting for valid finger...");
lcd.print("No valid finger");
lcd.setCursor(0, 1);
lcd.print("on the sensor");
}
void loop() // run over and over again
{

if(getFingerprintIDez()>=0)
{
doorOpen();
delay(1000);
doorClose();
}

}
uint8_t getFingerprintID()
{
uint8_t p = finger.getImage();
switch (p)
{
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println("No finger detected");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
return p;
default:
Serial.println("Unknown error");
return p;
}

// OK success!

p = finger.image2Tz();
switch (p)
{
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");

20 | P a g e
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return p;
default:
Serial.println("Unknown error");
return p;
}

// OK converted!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK)
{
Serial.println("Found a print match!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println("Did not find a match");
return p;
} else {
Serial.println("Unknown error");
return p;
}

// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
}
// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK) return -1;

p = finger.image2Tz();
if (p != FINGERPRINT_OK) return -1;

p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK) return -1;

// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}

21 | P a g e
Construction and testing of Arduino Fingerprint Sensor Lock: -
One must be careful to ensure that the baud rate value listed in the program must be accurate. It's value
does not affect the serial monitor but for sensitive device like R305 sensor, it must be precisely the
value listed in the datasheet. However, this value may depend on the type of sensor used in the project.
In the main code, this values are fed in the system as Serial.begin(38400) which represents the baud
rate for serial monitor and finger.begin(57600) which represent the baud rate for sensor. The Arduino
board must be reset beforehand to avoid any possible errors during validation of fingerprint.
PARTS LIST OF ARDUINO FINGERPRINT SCANNER LOCK

Resistor (all ¼-watt, ± 5% Carbon)

R1 = 330Ω
R2 = 1 KΩ
VR1 = 10 KΩ

Semiconductors

Arduino Uno Board


T1 = BC458
R305 Fingerprint Sensor module

Miscellaneous

LCD1 = 16*2 Alphanumeric LCD


RL1 = 5V 1C/O relay

22 | P a g e
3. Arduino FM Receiver Circuit
The circuit posted here is of Arduino FM Receiver using digital radio—receiver module TEA5657 by
Philips. Additional of components like audio power amplifier, arduino uno board and LCD module to
display station number and frequency. However, for the receiving system to function flawlessly,
external components like capacitor, resistor etc. included in the circuit which is obvious necessity.

Circuit Description Arduino FM Receiver Circuit:


The circuit of project Arduino FM Receiver is shown in figure 1. The main or controlling part of the
system is arduino uno board which is basically a prototyping platform consisting ATmega 328
microcontroller.

Now talking about receiver module, TEA5767. TEA5767 is a low-voltage fully integrated intermediate
frequency (IF) FM stereo radio module. It includes features like stereo and mono output, station
scanning, indicating signal strength, adjustment free etc. TEA5767 receiver module operates either in
I2C protocol or in 3-wire BUS protocol which can be selected using BUSMODE pin (pin 3). Here, in
this project Arduino FM Receiver BUSMODE is grounded because we had used I2C protocol.
Data pin (pin 2) and clock pin (pin 3)
of FM receiver module is connected to
analog pin (A4 and A5) of arduino uno
board respectively where pin 3 and 6 is
grounded as shown in circuit diagram.
Output is taken from pin 7 and pin 8 of
receiver module for left and right
channel respectively.
The output from FM receiver module
is given to low power audio amplifier
IC (LM386) because the output of
radio receiver module is very low and

23 | P a g e
inaudible. Here, in the circuit we
had used only left channel
output. If you need stereo output
you must use another LM386 for
right channel output. Variable
resistor VR2 is used control the
volume in the speaker.
Two resistor R1 and R2 with two
Push-to-on switches is used to
change the frequency (up and
down) respectively in order to
change the channel. These two
resistors are Pull-up resistor used
to control the switch bounce
condition.
We all know that the length of
antenna must be the size of
wavelength. For the project
posted here we had used 75cm
antenna connected to pin 10 of
radio receiver module.
Software:
Now let’s talk about software.
The software is written and
compiled in Arduino IDE environment. You can directly download the software package and uploads
in arduino uno board. The package contains the software code with auto scan function and without
auto scan function.
For better understanding of code, we had already used comment, but still we had listed some syntax.
BeginTransmission(0x60); “Starts communication with TEA5767 module where 0x60 is for write and
0x61 is for reading”
Write(0x00); “For sending data bit by bit in I2C protocol”
Mode;
Before dealing with this syntax at first, we must know about write mode data sequence.
When station is found it set the RF flag 1 i.e. RF = 1 which is stored at bit 3 where bit 4 is used to store
stereo or mono signal strength.

The sentence used to update value is “Buffer[i] = Wire.read();”


read(); “Read data of write mode data sequence in read mode”
OUTPUT OF LCD

24 | P a g e
Shows the frequency stored in buffer (0);
Display scanning in search mode;
Shows signal strength stored in buffer (3);
/// Arduino FM receiver with TEA5767
#include <Wire.h> /// Header file for I2C
#include <LiquidCrystal.h> ///Header file for LCD Display

unsigned char search_mode=0; ///For Search Operation

int b=0; ///For Search Operation Bit for Button_next


int c=0; ///For Search Operation Bit for Button_prev

#define Button_next 7 ///Digital Pin 7 used for freq next Pull Up configuration
#define Button_prev 8 ///Digital Pin 8 used for freq next Pull Up configuration

unsigned char frequencyH=0; ///Freq for writing data to TEA5767


unsigned char frequencyL=0; ///Freq for writing data to TEA5767

unsigned int frequencyB;


double frequency=0; ///Freq Immediate or start freq

double freq_available=0; ///Used in auto search operation

LiquidCrystal lcd(12, 11,10, 5, 4, 3, 2); ///LCD PINS Define

void setup() {

Wire.begin();
lcd.begin(16, 2);

/// buttons

pinMode(Button_next, INPUT);
digitalWrite(Button_next, HIGH); //pull up resistor by a 10k ohm

pinMode(Button_prev, INPUT);
digitalWrite(Button_prev, HIGH); //pull up resistor by a 10k ohm

frequency=87.5; //starting frequency

frequencyB=4*(frequency*1000000+225000)/32768; //calculating PLL word for sending freq


data to the TEA5767 module

frequencyH=frequencyB>>8;

frequencyL=frequencyB&0XFF;

delay(100);

Wire.beginTransmission(0x60); //writing TEA5767

25 | P a g e
Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(0xB0);
Wire.write(0x10);
Wire.write(0x00);
Wire.endTransmission();

delay(100);

void loop()
{

unsigned char buffer[5];

lcd.setCursor(0, 0);

Wire.requestFrom(0x60,5); //reading TEA5767

if (Wire.available())

{
for (int i=0; i<5; i++) {

buffer[i]= Wire.read();
}

freq_available=(((buffer[0]&0x3F)<<8)+buffer[1])*32768/4-225000;

lcd.print("FM ");

lcd.print((freq_available/1000000));

frequencyH=((buffer[0]&0x3F));

frequencyL=buffer[1];

if (search_mode) {

if(buffer[0]&0x80) search_mode=0;

if (search_mode==1) lcd.print(" SCAN");


else {
lcd.print(" ");
}

lcd.setCursor(0, 1);

26 | P a g e
lcd.print("Level: ");
lcd.print((buffer[3]>>4));
lcd.print("/16 ");

if (buffer[2]&0x80) lcd.print("STEREO ");


else lcd.print("MONO ");

///// buttons read

//////////// button_next//////////
if (!digitalRead(Button_next)&&!b) {

frequency=(freq_available/1000000)+0.05; /////////////// increasing by 0.05

frequencyB=4*(frequency*1000000+225000)/32768+1;

frequencyH=frequencyB>>8;
frequencyL=frequencyB&0XFF;

Wire.beginTransmission(0x60);

Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(0xB0);
Wire.write(0x1F);
Wire.write(0x00);

Wire.endTransmission();

//////////////////////

b=100;

};

if (!digitalRead(Button_next)&&b==1) {

///scannnn UP

search_mode=1; ////search in increasing freq direction

Wire.beginTransmission(0x60);

Wire.write(frequencyH+0x40);
Wire.write(frequencyL);
Wire.write(0xD0); ///providing values to search ====== details on pg 14,15,16
of datasheet of TEA5767
Wire.write(0x1F);
Wire.write(0x00);

27 | P a g e
Wire.endTransmission();

/////////////////

b=100;

};

if (!b==0) b--;

//////////// button_prev//////////
if (!digitalRead(Button_prev)&&!c) {

frequency=(freq_available/1000000)-0.05; /////////////// decreasing by 0.05

frequencyB=4*(frequency*1000000+225000)/32768+1;

frequencyH=frequencyB>>8;
frequencyL=frequencyB&0XFF;

Wire.beginTransmission(0x60);

Wire.write(frequencyH);
Wire.write(frequencyL);
Wire.write(0xB0);
Wire.write(0x1F);
Wire.write(0x00);

Wire.endTransmission();

c=100;

};

if (!digitalRead(Button_prev)&&c==1) {

///scannnn DOWN

search_mode=1; ////search in decreasing freq direction

Wire.beginTransmission(0x60);

Wire.write(frequencyH+0x40);
Wire.write(frequencyL);

Wire.write(0x50);
Wire.write(0x1F); ///providing values to search ==== details on pg 14,15,16 of datasheet of
TEA5767
Wire.write(0x00);
Wire.endTransmission();

c=100;

28 | P a g e
};

if (!c==0) c--;

////////////////////

PARTS LIST OF ARDUINO FM RECEIVER CIRCUIT USING TEA5767


Resistors (all ¼-watt, ± 5% Carbon)
R1, R2 = 10 KΩ
R3 = 330 KΩ
R4 = 10 Ω
VR1, VR2 = 10 KΩ preset
Capacitors
C1 = 22 µF/25V (Electrolytic Capacitor)
C2 = 10 µF/25V (Electrolytic Capacitor)
C3 = 100 µF/25V (Electrolytic Capacitor)
Semiconductors
BOARD1 = Arduino Uno Board
IC1 = LM386 Low-Power Amplifier
FM1 = TEA5767 Digital Radio Receiver Module
LCD1 = 16x2 LCD
Miscellaneous
SW1, SW2 = Tactile Switch
BATT.1 = 9V Battery
LS1 = 8-ohm, 0.5W speaker
ANT. = 75cm Hookup Wire Antenna

29 | P a g e
4. Arduino FM Transmitter
The project “Arduino FM Transmitter” is basically a radio station with transmit either voice or music
nearby area, within the range of 50 meters range.
The transmitted FM signal is received by any FM receiver. The project uses very few components i.e
arduino uno board (MCU) and a FM transmitter V2.0 module. This project has various application like
it can be implemented in college hospital etc.
where announcements have to done.
The bock diagram of arduino FM transmitter is
shown in figure 1 and circuit diagram is shown in
figure 2.
The main parts of the project “Arduino FM
Transmitter” is FM transmitter V2.0 module which
is easily available in electronics store. FM
transmitter V2.0 contains microphone as well as
headphone jack. The microphone change sound
signal to electrical signal which is to be modulated.
As the module also consist of headphone jack so
one can directly connect mobile or computer or
mp3 with the help of 3.5mm male to male audio
connector. FM transmitter V2.0 module uses I2C
interface technology to communicate with
arduino. It contents four pins +5V, GND, SDA
(serial data I2C pin) and SCK (Serial cock I2C
pin).
Software: - The software of arduino FM
transmitter is written in arduino programming and
burn the program in arduino uno using arduino IDE. Download library from here. The complete
arduino code is shown below.

#include "arduino_fm_trans.h"

float fm_freq = 90.1; // Here set the default FM frequency


void setup(void)

30 | P a g e
{

Serial.begin(9600);
Serial.print("FM-TX Demo\r\n");
/**
Initial, set FM channel and select your area:
USA
EUROPE
JAPAN
AUSTRALIA
CHINA
*/
fmtx_init(fm_freq,AUSTRALIA);
Serial.print("Channel:");
Serial.print(fm_freq, 1);
Serial.println("MHz");
}

void loop(void)
{
/** check for data setting new frequency. Users could input data from Serial monitor. Data
must start with '&' and followed by 4 numbers, such as &8000. The first two is the integer part
of new frequency (Unit: MHz), and the last one is the decimal part. And the channel must between
70MHz
and 108Mhz. For example, &756 is 75.6MHz, and &666 is out of range.
*/
if(Serial.available()){
switch(Serial.read()){
case '&':
u8 i,buf[4];
float ch;
i=0;
delay(30);
while(Serial.available()&&i<4){
buf[i]=Serial.read();
if (buf[i]<= '9' && buf[i]>= '0') {
i++;}
else{
i=0;
break;
}
}
if (i==4){
ch = (buf[0]-'0')*100+(buf[1]-'0')*10+(buf[2]-'0')*1+0.1*(buf[3]-'0');
if(ch>=70&&ch<=108){
Serial.print("New Channel:");
Serial.print(ch, 1);
Serial.println("MHz");
fmtx_set_freq(ch);
}else{
Serial.println("ERROR:Channel must be range from 70Mhz to 108Mhz.");
}

31 | P a g e
}else{
Serial.println("ERROR:Input Format Error.");
}

while(Serial.available()){
Serial.read();
}
break;
}
}
}

PARTS LIST OF ARDUINO FM TRANSMITTER


Arduino uno board
FM transmitter V2.0 module

32 | P a g e
5. Temperature Controlled Fan using Arduino
The project ‘Temperature Controlled Fan using arduino’ is simply fabricated around arduino uno board
and temperature sensor LM35. The projects are good example of embedded system basically designed
using closed-looped feedback control system. For proper user interface visual indication, we had also
used LCD which indicate temperature as well as speed of fan.

Circuit Description of Temperature Controlled Fan using Arduino


The entire circuit of ‘Temperature Controlled Fan using Arduino’ utilize very few components, a MCU
(Arduino Uno), a temperature sensor (LM35), a LCD, a motor (Fan), a transistor and few other passive
components etc.
Basically IC1 (LM35) is a transducer which convert temperature to electrical signal. As the output is
analog in nature so the output is connected to analog input pin (A1) as shown in figure. The temperature
sensed is displayed in LCD and control the output of fan as per command in source code. The output
is taken from pin D11 which is further given to base of NPN transistor (T1) through resistor R2.

Transistor T1 is basically a switching circuit which switch motor (Fan) o and off as per command. A
diode is connected across the motor which is also called an fly-back diode used to eliminate voltage
spike generate across inductive load.

33 | P a g e
Operation of Temperature Controlled Fan using Arduino: -
The circuit designed here is used to control the speed of fan by method of pulse-width modulation
(PWM) signa. The signal generates here is of low-frequency generally in the range of 30 Hz. As the
circuit posted here used a general-purpose transistor for switches which may generate noise because
the signal is of pulsed nature.
Software: -
The core section of the project; software part is written in arduino programming language which is
very much as C. The program is compile and burned to arduino uno using arduino IDE. You can
directly download the code and use it without any modification.
#include <LiquidCrystal.h>
LiquidCrystal lcd(7,6,5,4,3,2);
int tempPin = A1; // the output pin of LM35
int fan = 11; // the pin where fan is
int led = 8; // led pin
int temp;
int tempMin = 30; // the temperature to start the fan 0%
int tempMax = 60; // the maximum temperature when fan is at 100%
int fanSpeed;
int fanLCD;

void setup() {
pinMode(fan, OUTPUT);
pinMode(led, OUTPUT);
pinMode(tempPin, INPUT);
lcd.begin(16,2);
Serial.begin(9600);
}

void loop()
{
temp = readTemp(); // get the temperature
Serial.print( temp );
if(temp < tempMin) // if temp is lower than minimum temp
{
fanSpeed = 0; // fan is not spinning
analogWrite(fan, fanSpeed);
fanLCD=0;
digitalWrite(fan, LOW);
}
if((temp >= tempMin) && (temp <= tempMax)) // if temperature is higher than minimum temp
{
fanSpeed = temp;//map(temp, tempMin, tempMax, 0, 100); // the actual speed of
fan//map(temp, tempMin, tempMax, 32, 255);
fanSpeed=1.5*fanSpeed;
fanLCD = map(temp, tempMin, tempMax, 0, 100); // speed of fan to display on LCD100
analogWrite(fan, fanSpeed); // spin the fan at the fanSpeed speed
}

if(temp > tempMax) // if temp is higher than tempMax

34 | P a g e
{
digitalWrite(led, HIGH); // turn on led
}
else // else turn of led
{
digitalWrite(led, LOW);
}

lcd.print("TEMP: ");
lcd.print(temp); // display the temperature
lcd.print("C ");
lcd.setCursor(0,1); // move cursor to next line
lcd.print("FANS: ");
lcd.print(fanLCD); // display the fan speed
lcd.print("%");
delay(200);
lcd.clear();
}

int readTemp() { // get the temperature and convert it to celsius


temp = analogRead(tempPin);
return temp * 0.48828125;
}

PARTS LIST OF TEMPERATURE CONTROLLED FAN USING ARDUINO


Resistors (all ¼-watt, ± 5% Carbon)
R1, R2 = 1 KΩ
R3 = 470 Ω
VR1 = 10 KΩ
Capacitor
C1 = 10 µF, 16 µF (Electrolytic Capacitor)
Semiconductor
IC1 = LM35 (Temperature Sensor)
T1 = BD139 (NPN Transistor)
D1 = 1N4007 (Rectifier Diode)
LED1 = 5mm LED
LCD1 = 16x2 LCD
Arduino Uno Board
Miscellaneous
M1 = 12V DC Operated Fan
12V Battery for Fan

35 | P a g e
6. Arduino VU Meter
The project ‘Arduino VU Meter’ uses 16x2 alphanumeric LCD to display signal level of audio.
Basically, VU Meter is used to represent volume of audio equipment. Previously we had posted a
project Sound VU Meter using Arduino which uses LEDs to represent the level of volume where audio
is taken from microphone. Unlike sound VU meter using arduino the project Arduino VU meter take
input audio from two different channels i.e. left channel and right channel.

Circuit Description of Arduino VU Meter


The circuit of Arduino VU Meter is shown in figure 1 build around Arduino Uno (MCU) and LCD.
Basically, in hardware section we all have to know how to interface arduino and LCD. The data pin of

LCD is connected to digital pin of arduino as shown in circuit diagram. The audio input is given to
analog pin. Left channel audio is given to pin A2 and right channel audio is given to pin A4.

36 | P a g e
Resistor R1 is current limiting resistor connected to anode pin of LCD for backlight. Similarly, wiper
of variable resistor is connected to pin 3 of LED in order to adjust the contrast of display.
Software: - The software code of arduino VU meter is written in arduino programming language and
compiled and burned using arduino IDE.

The program is straight forward except some special character. Here we had used some array of special
character which is used to display height of bar of both rows.
byte p3[8] = { };
B10000, byte p4[8] = {
B10000, B11000, byte p5[8] = {
B10000, B11000, B11100,
B10000, B11000, B11100,
B10000, B11000, B11100,
B10000, B11000, B11100,
B10000, B11000, B11100,
B10000 B11000, B11100,
}; B11000 B11100,

37 | P a g e
B11100 B11110, B11111,
}; B11110, B11111,
B11110 B11111,
byte p6[8] = { }; B11111,
B11110, B11111
B11110, byte p7[8] = { };
B11110, B11111,
B11110, B11111,
B11110, B11111,
Similarly array L[8] and R[8] are used to display L and R in LCD.
byte L[8] = { B00000, B11111,
B00000, B00000 B00101,
B00000, }; B00101,
B11111, B11010,
B10000, byte R[8] = { B00000,
B10000, B00000, B00000
B10000, B00000, };

Array K[8] and LEEG[8] combinedly display bar shape special character at the end of both rows a
shown in figure 2.
byte K[8] = { B10101, B00000,
B10101, B01010 B00000,
B01010, }; B00000,
B10101, B00000,
B01010, byte LEEG[8] = { B00000,
B10101, B00000, B00000
B01010, B00000, };

Complete Software Code:


/*VU METER
AUDIO INPUT AT A2 AND A4 ARDUINO UNO BOARD*/

#include <LiquidCrystal.h>

//SPECIAL CHARACTERS
byte p3[8] = {
B10000,
B10000,
B10000,
B10000,
B10000,
B10000,
B10000,
B10000
};

byte p4[8] = {
B11000,
B11000,

38 | P a g e
B11000,
B11000,
B11000,
B11000,
B11000,
B11000
};

byte p5[8] = {
B11100,
B11100,
B11100,
B11100,
B11100,
B11100,
B11100,
B11100
};

byte p6[8] = {
B11110,
B11110,
B11110,
B11110,
B11110,
B11110,
B11110,
B11110
};

byte p7[8] = {
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111
};

byte L[8] = {
B00000,
B00000,
B11111,
B10000,
B10000,
B10000,
B00000,
B00000
};

39 | P a g e
byte R[8] = {
B00000,
B00000,
B11111,
B00101,
B00101,
B11010,
B00000,
B00000
};

byte K[8] = {
B10101,
B01010,
B10101,
B01010,
B10101,
B01010,
B10101,
B01010
};

byte LEEG[8] = {
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000,
B00000
};

int leftChannel = 0; // left channel input


int rightChannel = 0; // right channel input

int left,left2,right,right2; //variables


const int numReadings = 3; //5 readings for data

int readings[numReadings]; //
int index = 0; // index of the instantaneous reading
int total= 0; //total set at zero
int maxi=0;
int index2 = 0; // index of the current reading (2)
int total2= 0; // highest number in the readings
int maxi2=0;
int inputPin = A2; //INPUT LEFT
int inputPin2 = A4; //INPUT RIGHT
int volL=0;
int volR=0;
int carL=0;
int carR=0;

40 | P a g e
int vul;
int vul2;
int laad;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //LCD configuration

void setup() {

Serial.begin(9600);
lcd.begin(16, 2); //size of the LCD
for (int thisReading = 0; thisReading < numReadings; thisReading++)
readings[thisReading] = 0;

lcd.createChar(1, p3);
lcd.createChar(2, p4);
lcd.createChar(3, p5);
lcd.createChar(4, p6);
lcd.createChar(5, p7);
lcd.createChar(6, L);
lcd.createChar(7, R);
lcd.createChar(8, K);
lcd.createChar(9, LEEG);

for(vul=0;vul<80;vul++)
{
for(laad=0;laad<vul/5;laad++)
{
lcd.setCursor(laad, 1);
lcd.write(5);
}
if(laad<1)
{
lcd.setCursor(0, 1);
lcd.write(5);
}

lcd.setCursor(laad+1, 1);
lcd.write((vul-vul/5*5)+1);
for(laad=laad+2;laad<16;laad++)
{
lcd.setCursor(laad, 1);
lcd.write(9);
}
lcd.setCursor(0, 0);
lcd.print("VU METER");
delay(50);
}
lcd.clear();
delay(500);
}

void loop()
{

41 | P a g e
lcd.setCursor(0, 0); //L and R are put on the screen
lcd.write(6);
lcd.setCursor(0, 1);
lcd.write(7);
lcd.setCursor(15, 0); //caps are put on the screen BOX LIKE DESIGN AT END
lcd.write(8);
lcd.setCursor(15, 1);
lcd.write(8);
total=analogRead(inputPin);
if(total > maxi)
{
maxi=total;
}

index++;

if (index >= numReadings) //


{
index = 0;
left=maxi;
maxi=0;
}
total2=analogRead(inputPin2);
if(total2 > maxi2)
{
maxi2=total2;
}

index2++;

if (index2 >= numReadings) //


{
index2 = 0;
right=maxi2;
maxi2=0;
}
volR=right/3;

if(volR>14)
{
volR=14;
}
for(vul = 0 ; vul < volR ; vul++)
{
lcd.setCursor(vul+1, 1);
lcd.write(5);
}

for(vul = volR+1 ; vul < 15 ; vul++)


{
lcd.setCursor(vul, 1);
lcd.write(9);

42 | P a g e
}

volL=left/3;

if(volL>14)
{
volL=14;
}
for(vul2 = 0 ; vul2 < volL ; vul2++)
{
lcd.setCursor(vul2+1, 0);
lcd.write(5);
}

for(vul2 = volL+1 ; vul2 < 15 ; vul2++)


{
lcd.setCursor(vul2, 0);
lcd.write(9);
}
Serial.println(left);
}

PARTS LIST OF ARDUINO VU METER


R1 = 470Ω
VR1 = 10 KΩ
Arduino Uno Board
16x2 Alphanumeric LCD

43 | P a g e
7. Soil Moisture Meter using Arduino
The project ‘Soil Moisture Meter using Arduino’ uses arduino board, a 16x2 LCD module and soil
moisture sensor in order to display the humidity (moisture) of soil.

This project is very useful for farmer, floriculture, researchers etc. in order to know the moisture of
soil at different stage. The working principle and circuit description is very simple that anymore can
understand who have little knowledge of arduino board. The project is basically an interfacing circuit
between arduino board with LCD and sensor.
Circuit Description of Soil Moisture using Arduino

44 | P a g e
The circuit of soil moisture meter using
arduino consist of arduino uno board
(MCU), LCD (to display data), soil
moisture sensor.
Soil moisture sensor I basically a
transducer which convert soil moisture
to electrical signal. The sensor has
various element i.e. probe, wire and
body. The two-metallic probe made
from galvanized steel dipped into soil
which measure the flow of electrical
current between these two probes. The
electric current between these two
probes is further process and changed
into possible electrical value and
display on LCD.
Variable resistor VR1 is used to
calibrate the moisture of soil, where wiper is connecting to pin A2 of arduino board. Variable resistor
VR2 is used to control the contrast of LCD where resistor R2 is used to limit the current of backlight
of LCD.

Software Code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,4,5,6,7); // lcd hardware interface
int levelUp = 600; // see calibration notes
int levelDown = 300; // see calibration notes

int probeIn = 1; // sensor head input to A1

void setup(){
Serial.begin(9600);
lcd.begin(16, 2); //size of the LCD
lcd.setCursor(0,1);
lcd.print("Welcome To Soil");
lcd.setCursor(1,0);
lcd.print("Moisture Meter");
delay(1000);
lcd.clear();
}

void loop(){

45 | P a g e
String DisplayNote;

int probeValue;
probeValue = analogRead(probeIn);
lcd.setCursor(0,1);
lcd.print("Soil Meter"); // custom message

if (probeValue < levelDown){


String DisplayNote = "Dry, Water Me!";
lcd.setCursor(1,0);
lcd.print(DisplayNote);

}
else if (probeValue > levelUp){
String DisplayNote = "Wet, Leave Me!";
lcd.setCursor(1,0);
lcd.print(DisplayNote);

}
else {
lcd.setCursor(1,0);
lcd.print(DisplayNote);
}
}

Procedure for calibration of Soil Moisture Meter using Arduino


Burn the software code in arduino uno board using arduino IDE.
Connect the entire circuit elements as shown in circuit diagram and after that connect power supply to
the circuit.
Dip two metallic probe into soil which is wet enough.
Adjust the variable resistor VR1 in order to get 3V at pin A1.
The calibration should be done for various sample of soil ranging from dry to wet.
PARTS LIST OF SOIL MOISTURE METER USING ARDUINO
Resistors (all ¼-watt, ± 5% Carbon)
R1 = 120 Ω
R2 = 100 Ω
VR1, VR2 = 10 KΩ
Semiconductors
T1 = BC547
16x2 LCD
Arduino uno board
Miscellaneous
Soil Sensor Probes
Connectors

46 | P a g e
8. RGB Colour Generator using Arduino
Basically, RGB represent three basic colour RED GREEN and BLUE which is used in our digital
system for generation various other colour.
The project ‘RGB Colour Generator using Arduino’ is basically a tutorial on how to generate colour
code and hex code of that color.

Circuit Description of RGB Colour Generator using Arduino


The circuit of RGB colour generating using arduino is basically designed using a microcontroller unit
(Arduino uno), a 16x2 alpha numeric LCD, a RGB LED and few resistor and variable resistor. The
circuit diagram is shown in figure 1.

The 100Ω resistor is connected across anode at RGB1 as shown in circuit diagram these three resistors
are basically current limiting resistor which control the flow of electron and save the RGB LED from
burning. Variable resistor VR1 to VR3 is used to control the intensity of RGB LED. The wiper of VR1
is connected to analog pin A0 of arduino uno. Similarly, wiper of VR2 and VR3 is connected to pin A1
and A2 respectively. These variable resistor is used to control the intensity of RGB LED.

47 | P a g e
Resistor R4 is use to limit the
current flowing to the backlight
of LCD where variable resistor
VR4 is used to adjust the contrast
of LCD.
LCD is used here in order to
display the value of color and
hex value of colour code. The
colour code value is displayed in
1st row of LCD where Hex code is displayed in 2nd row of LCD.
As the arduino board is of 8-bit thus it need to convert 10-bit digital value to 8-bit which is used to
controlled the PWM duty cycle.
The colour value is showed in 1st row in the form of Rxxx Gxxx Bxxx where xxx represent the
numerical value. The second row shows the HEX value in the form of HEXxxxxxx.
Software Code: The complete code of RGB Colour generating using arduino is written in arduino
programming language and burned using Arduino IDE. The code is given below you can directly
download and used in your projects.
#include <LiquidCrystal.h> // LCD library
LiquidCrystal lcd(7, 6, 5, 4, 3, 2); //LCD diplay pins on Arduino
int Radj;
int Gadj;
int Badj;
int Rval=0;
int Gval=0;
int Bval=0;
int R = 9;
int G = 10;
int B = 11;
void setup() {
pinMode(R, OUTPUT); // Pin 9 declared as output
pinMode(G, OUTPUT); // Pin 10 declared as output
pinMode(B, OUTPUT); // Pin 11 declared as output
lcd.begin(16,2); // Initialise LCD
delay(1);
lcd.setCursor(0,0);
lcd.print("RGB COLOUR");
lcd.setCursor(4,1);
lcd.print("GENERATOR");
delay(2000);
lcd.setCursor(0, 0);
lcd.print(" R G B ");
lcd.setCursor(3,1);
lcd.print("HEX= ");
}

void loop() {
Radj = analogRead(0);
Gadj = analogRead(1);

48 | P a g e
Badj = analogRead(2);
Rval=Radj/4; // Convert the range from (0-1023) to (0-255)
Gval=Gadj/4; // Convert the range from (0-1023) to (0-255)
Bval=Badj/4; // Convert the range from (0-1023) to (0-255)
lcd.setCursor(2,0);
if (Rval<10)
{
lcd.setCursor(2,0);
lcd.print("00");
lcd.print(Rval);
}
else if(Rval<100)
{
lcd.setCursor(2,0);
lcd.print("0");
lcd.print(Rval);
}
else
{
lcd.setCursor(2,0);
lcd.print(Rval);
}
lcd.setCursor(8,1);
if (Rval<16)
{
lcd.print("0");
lcd.print(Rval, 16);
}
else
{
lcd.print(Rval, 16);
}
lcd.setCursor(7,0);
if (Gval<10)
{
lcd.setCursor(7,0);
lcd.print("00");
lcd.print(Gval);
}
else if(Gval<100)
{
lcd.setCursor(7,0);
lcd.print("0");
lcd.print(Gval);
}
else
{
lcd.setCursor(7,0);
lcd.print(Gval);
}
lcd.setCursor(10,1);
if (Gval<16)

49 | P a g e
{
lcd.print("0");
lcd.print(Gval, 16);
}
else
{
lcd.print(Gval, 16);
}
lcd.setCursor(12,0);
if (Bval<10)
{
lcd.setCursor(12,0);
lcd.print("00");
lcd.print(Bval);
}
else if(Bval<100)
{
lcd.setCursor(12,0);
lcd.print("0");
lcd.print(Bval);
}
else
{
lcd.setCursor(12,0);
lcd.print(Bval);
}
lcd.setCursor(12,1);
if (Bval<16)
{
lcd.print("0");
lcd.print(Bval, 16);
}
else
{
lcd.print(Bval, 16);
}
analogWrite(R, Rval); // PWM for Red colour
analogWrite(G, Gval); // PWM for Green colour
analogWrite(B, Bval); // PWM for Blue colour
}

50 | P a g e
PARTS LIST OF RGB COLOUR GENERATING USING ARDUINO
Resistors (all ¼-watt, ± 5% Carbon)
R1, R4 = 100 Ω
R2 = 270 Ω
R3 = 330 Ω
VR1 – VR3 = 10 KΩ Potmeter
VR4 = 10 k Ω Preset
Semiconductors
RBG1 = Common Cathode RGB LED
Board1 = Arduino Uno Board
Miscellaneous
LCD1 = 16x2 Alphanumeric Display

51 | P a g e
9. Dark Sensor using Arduino
The project ‘Dark Sensor using Arduino’ uses an arduino board, a LDR and switching circuit. The
circuit is basically a light operated circuit which operates when dark is detected on LDR.

Circuit Diagram of Dark Sensor using Arduino.


Circuit diagram of the projects ‘Dark Sensor using Arduino’ is shown in figure 1, build around a
arduino uno board, a LDR, three transistors and few other electronics components. The LDR is
basically a transducer which change one form of energy to another form (change in light intensity to
change in resistance). The resistance of LDR is changed according to intensity of light falling on it,
more the light on the LDR, the less the resistance and vice-versa.

The change of intensity of light on LDR is given to one of the digital pin of arduino uno (D2) through
the emitter of transistor T1. Variable resistor VR1 is used to set the sensitivity of LDR1. Capacitor C2
provides a small delay in order to interpret the change in resistance according to intensity of light. As
digital input (pin 2) is configured in logic-low level where resistor R2 is used as pull-down resistor.
When the shadow (dark) is detected at LDR1 is trigger the transistor T2 which further switch on the
piezo buzzer (PZ1). One can also connect the high power external alarm to the relay RL1. One digital

52 | P a g e
output (D12) is used to control
the switching the relay RL1
through transistor T3. LED1 is
used to indicate that the alarm
went off.
Software:
The code of dark sensor using
arduino is written in arduino
programming language and burned in arduino uno board using arduino IDE shown below.
/* DARK SENSOR USING ARDUINO */
int relayPin = 12; // Relay Output Pin
int sensorPin = 2; // Sensor Input Pin
int ledPin = 8; // Reminder LED Output Pin
int piexoPin = 10; //Piezo-speaker Output Pin
int val = 0; // variable for reading the Input Pin status

void setup() {
pinMode(relayPin, OUTPUT); // Set Relay as output
pinMode(sensorPin, INPUT); // Set Shadow Sensor as input
pinMode(ledPin, OUTPUT); // Set LED as output
pinMode(piexoPin, OUTPUT); // Set Piezo-Speaker as output

void loop(){
val = digitalRead(sensorPin); // read input value
if (val == HIGH) { // check if the input is HIGH
digitalWrite(relayPin, HIGH); // turn Relay ON

digitalWrite(ledPin,HIGH); // turn LED ON

playTone(500, 600);
delay(100);
playTone(500, 800);
delay(100);

}
else {
digitalWrite(relayPin, LOW); // turn Relay OFF
playTone(0, 0);
delay(300);

}
}
// duration in mSecs, frequency in hertz
void playTone(long duration, int freq) {
duration *= 1000;
int period = (1.0 / freq) * 1000000;
long elapsed_time = 0;
while (elapsed_time < duration) {

53 | P a g e
digitalWrite(piexoPin,HIGH);
delayMicroseconds(period / 2);
digitalWrite(piexoPin, LOW);
delayMicroseconds(period / 2);
elapsed_time += (period);
}
}

PARTS LIST OF DARK SENSORS USING ARDUINO


Resistors (all ¼-watt, ± 5% Carbon)
R1, R2 = 470 Ω
R3, R4 = 1 KΩ
VR1 = 4.7 KΩ
Capacitors
C1 = 100 µF/ 16V
Semiconductors
T1 – T3 = BC547 (NPN transistor)
D1 = 1N4007 (General purpose Rectifier Diode)
Arduino Uno Board
LED1 = 5mm any color LED
Miscellaneous
RL1 = 9V, 1C/O relay
PZ1 = Piezo Buzzer
LDR1 = LDR

54 | P a g e
10. DIY Breathalyzer using Arduino and MQ-
3 Sensor Module
Few day ago, I got an email from one of reader of bestengineeringprojects.com asking about how does
the traffic police know the concentration of alcohol present in our breadth.
For that purpose, I had designed a project called DIY Breathalyzer using various easily available
electronics components. Before starting about description of project I would like to describe what
breathalyzer is.
The breathalyzer or breathalyzer is an electronic device which is used to estimate the concentration of
alcohol available in breath sample. This device is usually carried by traffic police, medical person etc.
in order to check the blood alcohol content for either legal or medical purpose.

Circuit Description of DIY Breathalyzer using Arduino and MQ-3 Sensor Module
The circuit of DIY breathalyzer is shown in figure 1. It is designed using arduino uno board, MQ-3
sensor (alcohol sensor), few LEDs (indication of concentration of alcohol) and few other electronic
components for working flawlessly. The working is quite straightforward, any one with little
knowledge in arduino can understand easily.

55 | P a g e
MQ-3 is an alcohol sensor shown in
figure 2, is used to estimate the
concentration of alcohol present in
breadth. The sensor is designed to detect
alcohol thus it is very sensitivity and fast
response to alcohol. This sensor can also
detect benzine but its sensitivity to
benzene is very small. MQ-3 has 6 pins
where two are of heater and 4 pins for
signal. The heater provides necessary
work condition.
The AD0 pin of MQ-3 sensor module is
connected to one of the analog pin (A0)
from which we are going to read the
information of alcohol. For sensitivity of
sensor is adjusted using variable resistor
attached to the board of MQ-3 sensor
module.
The 10 LEDs is connected to the digital
output of arduino (pin D0 through D9)
through current limiting resistor which is connected in series as shown in circuit diagram (figure 1).
Software code: The
software of DIY
Breathalyzer using
Arduino and MQ-3
Sensor Module is
written in arduino
programming
language and
compiled using
arduino IDE. You
can directly
download the code
and use it without
any modification.

//DIY Breathalyzer using Arduino and MQ-3 Sensor Module

const int analogPin = 0; // pin that read the output of MQ-3 sensor
const int totalLed = 10; // total number of leds use to see concentration

int ledPins[] = {11,10,9,8,7,6,5,4,3,2};// pin assigned for LEDs

56 | P a g e
void setup() {

for (int currentLed = 0; currentLed < totalLed; currentLed++) {


pinMode(ledPins[currentLed], OUTPUT);//make ledPins for output
}}

void loop() {

int sensorReading = analogRead(analogPin);//read the value of sensor at analog pin A0

int ledLevel = map(sensorReading, 500, 1023, 0, totalLed);

for (int currentLed = 0; currentLed < totalLed; currentLed++) {

if (currentLed < ledLevel) {


digitalWrite(ledPins[currentLed], HIGH);
}

else {
digitalWrite(ledPins[currentLed], LOW);
}
}
}

PARTS LIST OF DIY BREATHALYZER USING ARDUINO AND MQ-3 SENSOR MODULE
Resistors (all ¼-watt, ± 5% Carbon)
R1 – R10 = 270 Ω
Semiconductors
Arduino Uno Board
MQ-3 Sensor Module
Miscellaneous
LED1 – LED5 = 5mm Green color LED
LED6 – LED8 = 5mm Yellow color LED
LED9, Led10 = 5mm Red color LED
Connector as per required

57 | P a g e
11. Arduino and RFID Based Attendance
System
The project Arduino and RFID Based Attendance System is a simple and is used at any place where
attendance is taken for maintaining register.
RFID (Radio Frequency Identification) use an electromagnetic field to detect unique tag assigned to
object in the vicinity. RFID tag is more secure and conventional because RFID traces tags hidden
inside objects unlike bar codes. It distinguishes authorize and un-authorize user in order to maintain
monthly weekly or monthly log.

Working of Arduino and RFID Based Attendance System


The company or institution
provides RFID card to their
employees, say there are 10
employees and each one gets
their own RFID card, before
giving that card to their
employees the system must be
updated with their RFID tag
corresponding to user name.
When any of the user swipes
his/her RFID card to RDID
modules, the initial time is
stored in the EEPROM of the
arduino. Similarly, when that
used again swipes his/her
RFID card, the system records
the end time and add to his/her
working time. In the system
Arduino and RFID Based
Attendance System admin can
delete log and change various
aspect as per code. In software code admin must be defined before use of the system.

Circuit Description of Arduino and RFID Based Attendance System


The circuit diagram of Arduino and RFID Based Attendance System is shown in figure 1. This circuit
basically consist of Arduino Uno (Central Control Unit), RFID Module (RFID Tag Receiver), RTC
Module (for showing real date and time), LCD Module (for displaying Output), Push-to-on Switch
(for selecting menu) and few other electronics components like resistors, LED, buzzer etc.
LCD interface with arduino in 4-bit mode by connecting higher data line of LCD (pin 11, 12, 13 and
14) to digital pin (pin 8, 9, 10 and 11) of arduino respectively as shown in figure 1. Similarly, pin 12
and 13 of arduino is connected to RS and E pin of LCD, where RW pin of LCD is grounded to perform
write operation on LCD. The data from arduino uno is sent in ASCII format to LCD. When data signal
is sent RS pin become high and when command signal is sent RS pin become null. The variable resistor

58 | P a g e
VR1 is used to adjust the contrast of LCD. The LCD module (20x4) is used to display various aspect
like real date and time, Menu, total staff, worked hour etc.
Pin D0 (RXD) of the arduino is used to interface with RFID module pin Tx of RFID module is
connected to RXD pin of arduino as shown in figure.

The four switches (SW1 through SW4) is used to select the menu as displayed in LCD module like
attendance, view all, clear all, Go Back, Total Staff etc. These four switches are connected to analog
pin A0 to A3 respectively as shown in figure 1. Here, in this circuit we are not using pull up resistor
because we are using “INPUT_PULLUP” in our program which eliminate the use of pull up resistor.
Glowing LED1 is used to indicate un-authorize user where glowing LED2 is used to indicate authorize
users. Buzzer BZ1 shows audio indication whether it accept the user or not according to program.
The circuit of Arduino and RFID Based Attendance System utilize a RTC (Real Time Clock) module
DS1307 for indicating real date and time. RTC module DS1307 is a serial real-time clock IC with
function like calendar, 12-hour and 24-hour time format with AM and PM indication. The two-line
SDA and SCL of DS1307 module is connect to arduino pin A4 and A5 respectively. For
communication between RTC and arduino. This module is responsive for calculation of days, weekly,
monthly etc.

The Software:
The software of Arduino and RFID Based Attendance System is written in arduino programming
language and compiled using arduino IDE. You can directly download the code from below link and
use it in your system. Before using code, you must first add RFID tag code and its corresponding name
(name of person to whom that RFID card is assigned). You have to edit line number 18 and 19 of
software code with RFID code and corresponding user name respectively. The code given below is

59 | P a g e
designed for 10 users and can be increased and decreased as per our required by changing software
code.
//Main_Program.ino

#define Ready 8
#define Relay 10
#define Warning 9
char tag[] ="4A00C7865B95"; // Replace with your Tag ID
char input[12];
int count = 0;
boolean match = 0; // A variable to store the Tag match status
void setup()
{
Serial.begin(9600);
pinMode(Ready,OUTPUT);
pinMode(Relay,OUTPUT);
pinMode(Warning,OUTPUT);
}
void loop()
{
digitalWrite(Ready,HIGH);

if(Serial.available())// check serial data ( RFID reader)


{
digitalWrite(Ready,LOW);
count = 0; // Reset the counter to zero
/* Keep reading Byte by Byte from the Buffer till the RFID Reader Buffer is
empty
or till 12 Bytes (the ID size of our Tag) is read */
while(Serial.available() && count < 12)
{
input[count] = Serial.read(); // Read 1 Byte of data and store it in the input[]
variable
count++; // increment counter
delay(5);
}
/* When the counter reaches 12 (the size of the ID) we stop and compare each value
of the input[] to the corresponding stored value */
if(count == 12) //
{
count =0; // reset counter varibale to 0
match = 1;
/* Iterate through each value and compare till either the 12 values are
all matching or till the first mistmatch occurs */
while(count<12 && match !=0)
{
if(input[count]==tag[count])
match = 1; // everytime the values match, we set the match variable to
1
else
match= 0;
/* if the ID values don't match, set match variable to 0 and

60 | P a g e
stop comparing by exiting the while loop */
count++; // increment i
}
}
if(match == 1) // If match variable is 1, then it means the tags match
{
Serial.println("Congratulation Access Allowed");
digitalWrite(Relay,HIGH);
delay (5000); // Relay on for 5 sec
digitalWrite (Relay,LOW);
}
else
{
Serial.println("Access Denied"); // Incorrect Tag Message
digitalWrite(Warning,HIGH);
delay(500);
digitalWrite(Warning,LOW);
}
/* Fill the input variable array with a fixed value 'F' to overwrite
all values getting it empty for the next read cycle */
for(count=0; count<12; count++)
{
input[count]= 'F';
}
count = 0; // Reset counter variable
}
}

PARTS LIST OF ARDUINO AND RFID BASED ATTENDANCE SYSTEM


Resistors (all ¼-watt, ± 5% Carbon)
R1, R2 = 330 Ω
VR1 = 10 KΩ
Semiconductors
Arduino Uno Board
RTC1 = DS1307
RFID Module = EM-18 RFID Reader Module
LED1 = 5mm RED color LED
LED2 = 5mm GREEN color LED
Miscellaneous
BZ1 = Buzzer
SW1 – SW4 = Push-to-on switch

61 | P a g e
12. Accident Detection and Alert System
using Arduino
Today in this article we are going to build a project called Accident Detection and Alert System using
Arduino UNO, GSM module, GPS module and Vibration Sensor Module. The vibration sensor module
used in this project is used to detect the change in linear velocity, displacement or acceleration. GPS
module detect the exact location (longitude and latitude) and GSM module is used to send the all
information to the mobile number assigned in the software code.
The Accident Detection and Alert System using Arduino is very sufficient and worthy to be
implemented in the vehicle specially in developing country like Nepal, India, Bangladesh etc. Accident
is increasing due to increase in number of vehicles as a result every year the number of death is
increasing. The Accident Detection and Alert System using Arduino prevent the uncertain death after
accident because this system send the message alert to the hospital or police station. The message alert
include longitude, latitude (location of accident), in the form of google map link.

Working of the Accident Detection and Alert System using Arduino


The working of the project Accident Detection and Alert System using Arduino can be summarized in
3 points below:
When accident is occurred, the location details of vehicle/object collected by the GPS module from
the satellite, this information is in the form of latitude and longitude scale.
Thus, collected information is then fed to arduino uno. Necessary processing is done and the
information is passed to the LCD and GSM modem.

The GSM modem collects the information for arduino uno and then transfer it to the mobile phone
through the SMS which is in text format.
PARTS LIST USED
Arduino Uno

62 | P a g e
GSM Module (SIM900a)
GPS Module (SIM28ML)
Vibration Sensor Module (SW-18010P)
16x2 LCD Module
10K Variable Resistor

Circuit Description of Accident Detection and Alert System using Arduino


The circuit of accident detection and alert system is shown in figure 1. This circuit basically consist of
arduino uno, GSM module, GPS module, vibration sensor module and LDC module. Now, let’s talk
about the component used in this system and circuit connection.
Arduino UNO: It is the central control unit for the project Accident detector and alert system. It
basically gathers information from vibration sensor module and GPS sensor module, process it and
display output to LCD and send message alert to the mobile.
GSM Module: SIM900 GSM module is preferred for this project for communication between accident
detector and alert system and mobile phone. It is basically tri-band work on various frequency range
(EGSM 900 MHz, DSC 1800 MHz and PCS 1900 MHz). In order to make communication between
GSM mobile and arduino uno we had only used Rx pin of GSM module and Tx pin of arduino pin.
GPS Module: SIM28ML GPS
module is preferred for this project.
The main function of this module is to
transmit location data to the arduino
uno. The connection between arduino
uno and GPS module is set by
connection transmit pin Tx of GPS to
arduino uno Rx pin. This module
operates in L1 frequency (1575.42
MHz) and up to a fix territory of
about 10 meters in sky, it generates
accurate information. The output of
GPS module is in NMEA format
which includes data like location in
real time.
Vibration Sensor Module: SW-
18010P vibration sensor module is
preferred for this project. As we have
already listed that vibration sensor
module is designed to analyze linear
velocity, displacement and
acceleration. It is basically a spring
type vibration sensor module thus it
detects vibration in any direction.
LCD module: LCD module used in this project is of 16x2 alphanumeric type which is used to display
alphabet, number and special character. LCD interface with a arduino in 4-bit mode by connecting

63 | P a g e
higher bit data line of LCD (pin 11, 12, 13 and 14) to digital pin (pin 8, 9 10 and 11) of arduino as
shown in circuit diagram. Similarly, pin 12 and pin 13 of arduino is connected to RS and E pin of LCD.
The RW pin of LCD is grounded to perform write operating on LCD to perform write operation on
LCD.
Software of Accident Detection and Alert System using Arduino: The software is written in arduino
programming language and compiled in arduino IDK. You can directly download the software code
from the link given below. Before using the code change the mobile number.
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,11,10,9,8);
#define vibrate_sense 7

char str[70];
char *test="$GPGGA";
char logitude[10];
char latitude[10];

int i,j,k;
int temp;
//int Ctrl+z=26; //for sending msg
int led=13;

void setup()
{
lcd.begin(16,2);
Serial.begin(4800);
pinMode(vibrate_sense, INPUT);
pinMode(led, OUTPUT);
lcd.setCursor(0,0);
lcd.print("Accident Detect");
lcd.setCursor(0,1);
lcd.print("Alert System");
delay(3000);
}

void loop()
{
if (digitalRead(vibrate_sense)==0)
{
for(i=18;i<27;i++) //extract latitude from string
{
latitude[j]=str[i];
j++;
}

for(i=30;i<40;i++) //extract longitude from string


{
logitude[k]=str[i];
k++;
}

lcd.setCursor(0,0); //display latitude and longitude on 16X2 lcd display

64 | P a g e
lcd.print("Lat(N)");
lcd.print(latitude);
lcd.setCursor(0,1);
lcd.print("Lon(E)");
lcd.print(logitude);
delay(100);
lcd.clear();
lcd.print("Sending SMS");
Serial.begin(9600);
Serial.println("AT+CMGF=1"); //select text mode
delay(10);
Serial.println("AT+CMGS=\"0123456789\""); // enter receipent number
Serial.println("Vehicle Accident occured:");
Serial.print("Latitude(N): "); //enter latitude in msg
Serial.println(latitude); //enter latitude value in msg
Serial.print("Longitude(E): "); //enter Longitude in Msg
Serial.println(logitude); //enter longitude value in msg
Serial.print("http://maps.google.com/maps?&z=15&mrt=yp&t=k&q=");
Serial.println(latitude);
Serial.println("+");
Serial.println(logitude);
Serial.write(26); //send msg Ctrl+z=26
lcd.print("SMS Sent");
temp=0;
i=0;
j=0;
k=0;
delay(20000); // next reading within 20 seconds
Serial.begin(4800);
}
}
void serialEvent()
{
while (Serial.available()) //Serial incomming data from GPS
{
char inChar = (char)Serial.read();
str[i]= inChar; //store incomming data from GPS to temparary string str[]
i++;
if (i < 7)
{
if(str[i-1] != test[i-1]) //check for right string
{
i=0;
}
}
if(i >=60)
{
break;
}
}
}

65 | P a g e
13. Arduino and RFID based Door Access
System
The project Arduino and RFID based Door Access System is basically an access control system and
can be placed where authorize entry is compulsion like office, school etc.
Working of RFID Module:
RFID (Radio Frequency identification) basically use an electromagnetic field to detect unique tag
assigned to object in the vicinity. A RFID receiver module radiate electromagnetic radiation of about
125KHz through its internally designed coil. When a RFID tag is of 125KHz is placed near to receiver
module it will get energized as a result high signal is generated which is connected to arduino for
further processing.
Reason of using RFID system:
RFID detect unique tags assigned to object in the vicinity. It is due to the fact that RFID traces tags
hidden inside objects unlike bar codes. That is why people opt out for RFID based security system.
Considering this fact, we developed a security system using RFID techniques which permits entry of
authorized individual in the area where this system is installed.
Circuit Description of Arduino and RFID based Door Access System
The circuit diagram of Arduino and RFID based Door Access System is shown in figure 1. The circuit
basically consist of Arduino uno (Central control unit), RFID receiver module, RFID tag, Solenoid
lock and few other electronics components like resistor, capacitors, diodes, transistors etc. for working
flawlessly. The RFID module works as sensor.

The RFID field is set up by the RFID reader such that whenever a certified person enters in that field
along with the unique tag assigned to him/her, RFID reader produces a signal. We call that signal a RF
signal and energy travels to the tag and extract details from the tag.

66 | P a g e
As per the communication medium, TXD pin of RFID module is connected to RXD (pin 0) of an
arduino uno as shown in circuit diagram. When this system clarifies the authorized access, pin 10 of
arduino uno reaches high state. As a result of which, a transistor T1 falls into saturation. Then
consequently, solenoid get energized and the door get unlocked indicating authorize access by glowing
LED LED3
In case where the attempts are unauthorized, the door remain closed. Additional LED2 start to glow
indicating the warning message.
Software: The software of Arduino and RFID based Door Access System is written is arduino
programming language and compiled using arduino IDE. Before using this project, the user must first
note the RFID tag which is after used in Main_Program.ino.
//Main_Program.ino

#define Ready 8
#define Relay 10
#define Warning 9
char tag[] ="4A00C7865B95"; // Replace with your Tag ID
char input[12];
int count = 0;
boolean match = 0; // A variable to store the Tag match status
void setup()
{
Serial.begin(9600);
pinMode(Ready,OUTPUT);
pinMode(Relay,OUTPUT);
pinMode(Warning,OUTPUT);
}
void loop()
{
digitalWrite(Ready,HIGH);

67 | P a g e
if(Serial.available())// check serial data ( RFID reader)
{
digitalWrite(Ready,LOW);
count = 0; // Reset the counter to zero
/* Keep reading Byte by Byte from the Buffer till the RFID Reader Buffer is
empty
or till 12 Bytes (the ID size of our Tag) is read */
while(Serial.available() && count < 12)
{
input[count] = Serial.read(); // Read 1 Byte of data and store it in the input[]
variable
count++; // increment counter
delay(5);
}
/* When the counter reaches 12 (the size of the ID) we stop and compare each value
of the input[] to the corresponding stored value */
if(count == 12) //
{
count =0; // reset counter varibale to 0
match = 1;
/* Iterate through each value and compare till either the 12 values are
all matching or till the first mistmatch occurs */
while(count<12 && match !=0)
{
if(input[count]==tag[count])
match = 1; // everytime the values match, we set the match variable to
1
else
match= 0;
/* if the ID values don't match, set match variable to 0 and
stop comparing by exiting the while loop */
count++; // increment i
}
}
if(match == 1) // If match variable is 1, then it means the tags match
{
Serial.println("Congratulation Access Allowed");
digitalWrite(Relay,HIGH);
delay (5000); // Relay on for 5 sec
digitalWrite (Relay,LOW);
}
else
{
Serial.println("Access Denied"); // Incorrect Tag Message
digitalWrite(Warning,HIGH);
delay(500);
digitalWrite(Warning,LOW);
}
/* Fill the input variable array with a fixed value 'F' to overwrite
all values getting it empty for the next read cycle */
for(count=0; count<12; count++)
{

68 | P a g e
input[count]= 'F';
}
count = 0; // Reset counter variable
}
}

Procedure for reading RFID tag.


1. Connect all the circuit as per circuit diagram shown in figure 1.
2. Brought RFID tag near to RFID module and note down the Tag ID and used in
Main_Program.ino
3. Replace your noted RFID tag ID with the already one and burn to arduino board. Now your
system will be ready to be installed in any door.

PARTS LIST OF ARDUINO AND RFID BASED DOOR ACCESS SYSTEM


Resistors (all ¼-watt, ± 5% Carbon)
R1, R4 = 1 KΩ
R2, R3 = 680Ω
Capacitors
C1 = 100 µF, 25V
C2 = 0.1 µF
Semiconductors
Arduino Uno Board
T1 = BC548
D1 = 1N4007
Miscellaneous
LED1 – LED3 = 5mm, any color LED
Solenoid Lock
RFID Receiver Module EM-18

69 | P a g e
14. Arduino Based Automatic Call
Answering Machine
The project “Arduino and GSM Based Automatic Answering Machine” is designed to answer the
phone call with prerecorded message when we are unable to attain call.

Sometime in this busy world we might not be able to attain the phone call due to several reasons
(generally when we are in bathroom or watching movie in cinema or forget mobile in home). These
calls might be important i.e. call might be from office or business call which cannot be ignored. Thus,
the project posted here receive the call after three rings and play the pre-recoded message which you
had already recoded and saved in ISD1820 voice module.

Circuit Description of Arduino and GSM Based Automatic Answering Machine


The circuit of Arduino and GSM Based Automatic Answering Machine is shown in figure 1. This
project is built around easily available electronic components like Arduino Uno, GSM module and
ISD1820 Voice module. The main or controlling part of this system is Arduino Uno Board. Arduino
Uno board is basically a prototype platform consisting ATmega328 microcontroller. The working of
the project Arduino and GSM Based Automatic Answering Machine is quite straight forward, and on
with little knowledge in arduino can understand easily.

70 | P a g e
ISD1820 is a voice module which is designed for audio message record and play back. The module
has on board non-volatile memory for storing voice recording, Recoding time depends upon the quality
of voice and is of 8 second to 20 second. Here we had listed some specification of ISD1820 voice
module.
On board non-volatile memory for storing massage for long time without supplying power supply
continuously.
In built microphone for
recording audio message.
Three individual push
buttons switch for recording,
edge trigger play and level
trigger play.
Single as well as loop play
option.
Loudspeaker can be directly
connected to board thus no
further need of amplifier and
driver circuit.
Operating voltage: 3V – 5V.
GSM Module: SIM900 GSM
module is preferred for this
project for communication between accident detector and alert system and mobile phone. It is basically
tri-band work on various frequency range (EGSM 900 MHz, DSC 1800 MHz and PCS 1900 MHz).
In order to make communication between GSM mobile and arduino uno we had used Tx pin and Rx
pin of GSM module and digital pin 9 and 10 of arduino pin. Tx pin and Rx pin of GSM module is
connected digital pin 9 and pin 10 or arduino respectively as shown in circuit diagram. GSM module
is powered with 12V dc supply.

71 | P a g e
The speaker pin of ISD1820 is connected to microphone pin of GSM module to send the recorded
message to GSM module when GSM module detect incoming call. Similarly, P-E (E-play) pin
connected to digital pin 8 of arduino for communication.
The working of the project Arduino and GSM Based Automatic Answering Machine can be
summarized in 3 points below:
1. Connect the component as shown in circuit diagram and give the power supply (12 volt to GSM
module, 9V to arduino and 5V to ISD1820 voice module).
2. Wait for approx. 1 minute after inserting SIM card to GSM module for establish connection
between network provider and GSM module. The LED flashing in every 3 second mounted on
GSM module indicates GSM module established the connection with network.
3. Record the message (max. length of 10 seconds) by pressing REC. button on ISD1820 and
program the arduino with the code given below.
Now your device “Arduino and GSM Based Automatic Answering Machine” is ready to use.
Software: The software of Arduino and GSM Based Automatic Answering Machine is written in
arduino programming language and compiled using arduino IDE. You can directly download use the
code. Before proceeding to burning code in arduino you have to download GSM library for arduino
and put it into arduino library folder. The folder of software contains complete software code for
Arduino and GSM Based Automatic Answering Machine and GSM library.
/*
Arduino and GSM Based Automatic Call Answering Machine
Created by: BestEngineeringProjects
Coded on: 12-06-2017
Website: bestengineeringprojects.com
*/
#include <sim900.h>
#include <SoftwareSerial.h>
#include <Wire.h>
int Incomingch;
String data,Fdata;

SoftwareSerial gprs(9,10);
void setup(){
Serial.begin(9600);
sim900_init(&gprs, 9600);
pinMode(8, OUTPUT);
Serial.println("Arduino and GSM Based Automatic Call Answering Machine");
}

void check_Incoming()
{
if(gprs.available())
{
Incomingch = gprs.read();

if (Incomingch == 10 || Incomingch ==13)


{Serial.println(data); Fdata =data; data = ""; }
else
{

72 | P a g e
String newchar = String (char(Incomingch));
data = data +newchar;
}
}
}
\
void loop(){

check_Incoming();

if(Serial.available()){
gprs.write(Serial.read());
} //Used for debugging
if (Fdata == "RING")
{
delay(5000);
gprs.write ("ATA\r\n");
Serial.println ("Call Received");
while(Fdata != "OK")
{check_Incoming();
Serial.println ("Recorded message Playing");

delay(500);
digitalWrite(8, HIGH);
delay(200);
digitalWrite(8, LOW);
}
}
}

PARTS LIST USED IN THE PROJECT ARE LISTED BELOW


Arduino Uno Board
GSM Module – Flyscale SIM900A
ISD 1820 Voice Module
Connecting Wires
Power Supply for modules

73 | P a g e
15. Fingerprint Attendance System using
Arduino
The project posted here is a simple Fingerprint Attendance System using Arduino and can be very
useful for any place where attendance is taken for maintaining register like office, school etc.

The project posted here utilize thumb impression for taking attendance. The Fingerprint Attendance
System using Arduino is based on simple algorithm called matching algorithm and compare with
previously stored templets of fingerprint against user’s fingerprint for authentication.
Maintaining a register for attendance is normally used for traditional attendance system, but it is much
more tedious. In this attendance system, user places a finger on the sensor, the attendance is taken and
message is displayed in LCD along with person name.
Circuit description of Fingerprint Attendance System using Arduino
The circuit shown in figure 1 utilize 5V power supply which can be taken out from arduino board. The
brain or processing component of the project Fingerprint Attendance System using Arduino is an
Arduino board. As we all know, Arduino board is based on a ATmega328/ATmega328P
microcontroller. It is equipped with 14 digital Input or output pin multiplexed together, 6 analogue
inputs with inbuilt 32k flash memory. It also has 16MHz crystal oscillator, a USB connection power
jack, ICSP header and reset button. Arduino uno board can be programmed using Arduino IDE
software.
Fingerprint sensor module R305 (connected across CON1) has UART interface with direct connection
with Arduino UNO board. The user can store finger print sample in the module and can be configured
in 1:1 or 1:N mode for identification for right user. The fingerprint sensor module R305 is power with
+5V power supply which is connected to 5V pin of arduino board. Tx and Rx pin of fingerprint sensor
module is connected to arduino digital pins 2 and 3 as shown in circuit diagram. This connection is

74 | P a g e
used for serial communication because only one individual pin is used for transmitter and receiver thus
parallel communication is not possible.
A 16x2 alphanumeric LCD is used to display message during operation like name, authentication etc.
The higher order data pin of LCD (pin 11, 12, 13 and 14) are connected to digital pin 8, 9, 10 and 11
of Arduino uno board. The RS and E pin of LCD is connected to pin 12 and 13 of arduino uno board.
RW pin of LCD is grounded because we only perform write operation in LCD. Preset VR1 is used to
adjust contrast of LCD. Pin no 15 and 16 of LCD not shown in circuit diagram is used to glow backlight
LED.
The circuit Fingerprint Attendance System using Arduino also utilize a RTC (Real Time Clock)
module for storing date and time of attendance. In this project we had used DS1307 RTC, it is a serial
real-time clock IC with inbuilt various types of functions like calendar, 24-hour and 12-hour time
format with AM and PM indication. Two-line SDA and SCL of DS1307 module is connected to analog
pin A4 and A5 of arduino uno board as shown in figure 1. The module has inbuilt 3V button cell which
help RTC module to run internally for few days (approx. 10 days) even external power supply is not
connected.
The four switch SW1 to SW4 connected to four analog pin A0 to A3 of arduino uno board respectively.
Switch SW1 and SW2 is multiplexed i.e. various operation is perform by single switch. Table show
below explain the operation of switches uses in circuit diagram.

Table 1: Operation of Switch

S.N. Switch Operations

75 | P a g e
1. SW1 ENROLL/BACK/DOWNLOAD

2. SW2 DELETE/OK/RESET

3. SW3 UP

4. SW4 DOWN

To Enroll new user.


1. Power on the circuit.
2. Press the Enroll switch
(SW1), and follow the message
displayed in LCD.
3. User input the ID by using
UP and Down switch (SW3 and
SW3).
4. Press the OK switch
(SW2)
5. A message on LCD screen
displayed and ask user to put
finger on fingerprint module.
And follow the message as shown
in LDC i.e. remove finger and
again put finger on module.
6. System store the
fingerprint image in memory i.e.
user is registered and can take
attendance.
To Delete Existing User
1. Press DELETE switch
(SW2).
2. LCD ask for user ID to
delete.
3. User ID is selected by
sculling UP and DOWN using
switch SW3 and SW4.
4. If ID is selected press OK
switch (SW2).
5. Confirmation message is
displayed on LCD.
6. Glowing LED1 is used to
indicating either system is ready
or not where piezo buzzer is used
for sound alert.
Software: Software of Fingerprint Attendance System Arduino is written in Arduino Programming
language and is compiled using Arduino IDE.
#include<EEPROM.h>
#include<LiquidCrystal.h>

76 | P a g e
LiquidCrystal lcd(13,12,11,10,9,8);
#include <SoftwareSerial.h>
SoftwareSerial fingerPrint(2, 3);
#include <Wire.h>
#include "RTClib.h"
RTC_DS1307 rtc;
#include "Adafruit_Fingerprint.h"
uint8_t id;
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&fingerPrint);
#define enroll 14
#define del 15
#define up 16
#define down 17
#define match 5
#define indFinger 7
#define buzzer 5
#define records 4 // replace number (4) with number of user in system
//put 5 for 5 user
int user1,user2,user3,user4,user5;
DateTime now;
void setup()
{
delay(1000);
lcd.begin(16,2);
Serial.begin(9600);
pinMode(enroll, INPUT_PULLUP);
pinMode(up, INPUT_PULLUP);
pinMode(down, INPUT_PULLUP);
pinMode(del, INPUT_PULLUP);
pinMode(match, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
pinMode(indFinger, OUTPUT);
digitalWrite(buzzer, LOW);
if(digitalRead(enroll) == 0)
{
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.print("Waiting...");
lcd.setCursor(0,1);
lcd.print("Data Downloading");
Serial.println("Waiting...");
Serial.println("Data Downloading");
Serial.println();
Serial.print("S.N. ");
for(int i=0;i<records;i++)
{
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
Serial.print(" User ID");
Serial.print(i+1);
Serial.print(" ");
}

77 | P a g e
Serial.println();
int eepIndex=0;
for(int i=0;i<30;i++)
{
if(i+1<10)
Serial.print('0');
Serial.print(i+1);
Serial.print(" ");
eepIndex=(i*7);
download(eepIndex);
eepIndex=(i*7)+210;
download(eepIndex);
eepIndex=(i*7)+420;
download(eepIndex);
eepIndex=(i*7)+630;
download(eepIndex);
//if 5th uer is added
// eepIndex=(i*7)+840;
// download(eepIndex);
Serial.println();
}
}
if(digitalRead(del) == 0)
{
lcd.clear();
lcd.print("Waiting...");
lcd.setCursor(0,1);
lcd.print("Reseting.....");
for(int i=1000;i<1005;i++)
EEPROM.write(i,0);
for(int i=0;i<841;i++)
EEPROM.write(i, 0xff);
lcd.clear();
lcd.print("System Reset");
delay(1000);
}

lcd.clear();
lcd.print(" Attendance ");
lcd.setCursor(0,1);
lcd.print(" System ");
delay(2000);
lcd.clear();
lcd.print("Best Eng Project");
lcd.setCursor(0,1);
lcd.print("Krishna Keshav");
delay(2000);
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
for(int i=1000;i<1000+records;i++)
{
if(EEPROM.read(i) == 0xff)
EEPROM.write(i,0);
}

78 | P a g e
finger.begin(57600);
Serial.begin(9600);
lcd.clear();
lcd.print("Finding Module");
lcd.setCursor(0,1);
delay(1000);
if (finger.verifyPassword())
{
Serial.println("Found fingerprint sensor!");
lcd.clear();
lcd.print("Module Found");
delay(1000);
}
else
{
Serial.println("Did not find fingerprint sensor :(");
lcd.clear();
lcd.print("module not Found");
lcd.setCursor(0,1);
lcd.print("Check Connections");
while (1);
}
if (! rtc.begin())
Serial.println("Couldn't find RTC");
// rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
if (! rtc.isrunning())
{
Serial.println("RTC is NOT running!");
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
lcd.setCursor(0,0);
lcd.print("Press Match to ");
lcd.setCursor(0,1);
lcd.print("Start System");
delay(2000);
user1=EEPROM.read(1000);
user2=EEPROM.read(1001);
user3=EEPROM.read(1002);
user4=EEPROM.read(1003);
user5=EEPROM.read(1004);
lcd.clear();
digitalWrite(indFinger, HIGH);

}
void loop()
{
now = rtc.now();
lcd.setCursor(0,0);
lcd.print("Time->");
lcd.print(now.hour(), DEC);
lcd.print(':');

79 | P a g e
lcd.print(now.minute(), DEC);
lcd.print(':');
lcd.print(now.second(), DEC);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print("Date->");
lcd.print(now.day(), DEC);
lcd.print('/');
lcd.print(now.month(), DEC);
lcd.print('/');
lcd.print(now.year(), DEC);
lcd.print(" ");
delay(500);
int result=getFingerprintIDez();
if(result>0)
{
digitalWrite(indFinger, LOW);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
lcd.clear();
lcd.print("ID:");
lcd.print(result);
lcd.setCursor(0,1);
lcd.print("Waiting...");
delay(1000);
attendance(result);
lcd.clear();
lcd.print("Attendance ");
lcd.setCursor(0,1);
lcd.print("Registed");
delay(1000);
digitalWrite(indFinger, HIGH);
return;
}
checkKeys();
delay(300);
}
// dmyyhms - 7 bytes
void attendance(int id)
{
int user=0,eepLoc=0;
if(id == 1)
{
eepLoc=0;
user=user1++;
}
else if(id == 2)
{
eepLoc=210;
user=user2++;
}
else if(id == 3)
{
eepLoc=420;

80 | P a g e
user=user3++;
}
else if(id == 4)
{
eepLoc=630;
user=user4++;
}
/*else if(id == 5) // if 5th user is used
{
eepLoc=840;
user=user5++;
}*/
else
return;

int eepIndex=(user*7)+eepLoc;
EEPROM.write(eepIndex++, now.hour());
EEPROM.write(eepIndex++, now.minute());
EEPROM.write(eepIndex++, now.second());
EEPROM.write(eepIndex++, now.day());
EEPROM.write(eepIndex++, now.month());
EEPROM.write(eepIndex++, now.year()>>8 );
EEPROM.write(eepIndex++, now.year());
EEPROM.write(1000,user1);
EEPROM.write(1001,user2);
EEPROM.write(1002,user3);
EEPROM.write(1003,user4);
// EEPROM.write(4,user5); // figth user
}
void checkKeys()
{
if(digitalRead(enroll) == 0)
{
lcd.clear();
lcd.print("Waiting...");
delay(1000);
while(digitalRead(enroll) == 0);
Enroll();
}
else if(digitalRead(del) == 0)
{
lcd.clear();
lcd.print("Waiting...");
delay(1000);
delet();
}
}
void Enroll()
{
int count=1;
lcd.clear();
lcd.print("Enter Finger ID:");
while(1)
{
lcd.setCursor(0,1);

81 | P a g e
lcd.print(count);
if(digitalRead(up) == 0)
{
count++;
if(count>records)
count=1;
delay(500);
}
else if(digitalRead(down) == 0)
{
count--;
if(count<1)
count=records;
delay(500);
}
else if(digitalRead(del) == 0)
{
id=count;
getFingerprintEnroll();
for(int i=0;i<records;i++)
{
if(EEPROM.read(i) != 0xff)
{
EEPROM.write(i, id);
break;
}
}
return;
}
else if(digitalRead(enroll) == 0)
{
return;
}
}
}
//Function To delete Existing User
void delet()
{
int count=1;
lcd.clear();
lcd.print("Enter Finger ID");
while(1)
{
lcd.setCursor(0,1);
lcd.print(count);
if(digitalRead(up) == 0)
{
count++;
if(count>records)
count=1;
delay(500);
}
else if(digitalRead(down) == 0)
{
count--;

82 | P a g e
if(count<1)
count=records;
delay(500);
}
else if(digitalRead(del) == 0)
{
id=count;
deleteFingerprint(id);
for(int i=0;i<records;i++)
{
if(EEPROM.read(i) == id)
{
EEPROM.write(i, 0xff);
break;
}
}
return;
}
else if(digitalRead(enroll) == 0)
{
return;
}
}
}
//Funbction to convert finger print image to templete
uint8_t getFingerprintEnroll()
{
int p = -1;
lcd.clear();
lcd.print("finger ID:");
lcd.print(id);
lcd.setCursor(0,1);
lcd.print("Place Finger");
delay(2000);
while (p != FINGERPRINT_OK)
{
p = finger.getImage();
switch (p)
{
case FINGERPRINT_OK:
Serial.println("Image taken");
lcd.clear();
lcd.print("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println("No Finger");
lcd.clear();
lcd.print("No Finger");
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
lcd.clear();
lcd.print("Comm Error");
break;
case FINGERPRINT_IMAGEFAIL:

83 | P a g e
Serial.println("Imaging error");
lcd.clear();
lcd.print("Imaging Error");
break;
default:
Serial.println("Unknown error");
lcd.clear();
lcd.print("Unknown Error");
break;
}
}
// OK success!
p = finger.image2Tz(1);
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
lcd.clear();
lcd.print("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
lcd.clear();
lcd.print("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
lcd.clear();
lcd.print("Comm Error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
lcd.clear();
lcd.print("Feature Not Found");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
lcd.clear();
lcd.print("Feature Not Found");
return p;
default:
Serial.println("Unknown error");
lcd.clear();
lcd.print("Unknown Error");
return p;
}
Serial.println("Remove finger");
lcd.clear();
lcd.print("Remove Finger");
delay(2000);
p = 0;
while (p != FINGERPRINT_NOFINGER) {
p = finger.getImage();
}
Serial.print("ID "); Serial.println(id);
p = -1;

84 | P a g e
Serial.println("Place same finger again");
lcd.clear();
lcd.print("Place Finger");
lcd.setCursor(0,1);
lcd.print(" Again");
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.print(".");
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
break;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
break;
default:
Serial.println("Unknown error");
return;
}
}
// OK success!
p = finger.image2Tz(2);
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return p;
default:
Serial.println("Unknown error");
return p;
}
// OK converted!
Serial.print("Creating model for #"); Serial.println(id);
p = finger.createModel();
if (p == FINGERPRINT_OK) {
Serial.println("Prints matched!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;

85 | P a g e
} else if (p == FINGERPRINT_ENROLLMISMATCH) {
Serial.println("Fingerprints did not match");
return p;
} else {
Serial.println("Unknown error");
return p;
}
Serial.print("ID "); Serial.println(id);
p = finger.storeModel(id);
if (p == FINGERPRINT_OK) {
Serial.println("Stored!");
lcd.clear();
lcd.print("Stored!");
delay(2000);
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;
} else if (p == FINGERPRINT_BADLOCATION) {
Serial.println("Could not store in that location");
return p;
} else if (p == FINGERPRINT_FLASHERR) {
Serial.println("Error writing to flash");
return p;
}
else {
Serial.println("Unknown error");
return p;
}
}
//Function to compare finger print image with stored IDs for matching
int getFingerprintIDez()
{
uint8_t p = finger.getImage();
if (p != FINGERPRINT_OK)
return -1;
p = finger.image2Tz();
if (p != FINGERPRINT_OK)
return -1;
p = finger.fingerFastSearch();
if (p != FINGERPRINT_OK)
{
lcd.clear();
lcd.print("Finger Not Found");
lcd.setCursor(0,1);
lcd.print("Try Later");
delay(2000);
return -1;
}
// found a match!
Serial.print("Found ID #");
Serial.print(finger.fingerID);
return finger.fingerID;
}
uint8_t deleteFingerprint(uint8_t id)
{

86 | P a g e
uint8_t p = -1;
lcd.clear();
lcd.print("Please wait");
p = finger.deleteModel(id);
if (p == FINGERPRINT_OK)
{
Serial.println("Deleted!");
lcd.clear();
lcd.print("Figer Deleted");
lcd.setCursor(0,1);
lcd.print("Successfully");
delay(1000);
}
else
{
Serial.print("Something Wrong");
lcd.clear();
lcd.print("Something Wrong");
lcd.setCursor(0,1);
lcd.print("Try Again Later");
delay(2000);
return p;
}
}
//Function for Download the Data fro EEPROM to Serial Monitor
void download(int eepIndex)
{

if(EEPROM.read(eepIndex) != 0xff)
{
Serial.print("T->");
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print(':');
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print(':');
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print(" D->");
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print('/');
if(EEPROM.read(eepIndex)<10)
Serial.print('0');
Serial.print(EEPROM.read(eepIndex++));
Serial.print('/');
Serial.print(EEPROM.read(eepIndex++)<<8 | EEPROM.read(eepIndex++));
}
else
{

87 | P a g e
Serial.print("---------------------------");
}
Serial.print(" ");
}
PARTS LIST OF FINGERPRINT ATTENDANCE SYSTEM USING ARDUINO
R1 = 1 KΩ, Resistor
VR1 = 10 KΩ, Preset
ARD1 = Arduino UNO Board
RTC Module = DS1307
Fingerprint Sensor Module = R305
LCD1 = 16x2 LCD
SW1 – SW4 = Push-to-on Switch
LED1 = 5mm any color LED
BUZ1 = Piezo Buzzer

88 | P a g e
16. Arduino Based Data Logger
(Temperature)
The project described here is a simple Arduino Based Data Logger which can be used at any place
where data is need to be stored for further processing and monitoring.
The project posted here basically store temperature, humidity with date and time in regular interval on
a SD card or on a computer or on both. The wide range of operation and data rate of 12 samples per
minutes make this circuit more versatile and attractive at the same time. The data logging can be
adjusted as per desire by changing the delay function in the program.

Circuit Description of Arduino Based Data Logger


The circuit of Arduino Based Data Logger shown in figure 1, employs four main particular electronics
components i.e. Arduino Uno Board, Real Time Clock Module (RTC DS3231), SDcard Module and
Temperature and humidity sensor module (DHT-11). An Arduino Uno Board is the heart of this
project. Arduino Uno Board have 14 digital pins and 6 analog pins out of which all the pin can be used
for input and output.

For date and time, we had utilized a RTC (Real Time Clock) module. The module we had used here is
DS3231. This module is equipped with real-time clock IC. The various functions of RTC module
DS3231 are calendar, 24-hour and 12-hour time format with AM and PM indication. The two pins
SDA and SCL of DS3231 module is connected to analog pin A4 and A5 of arduino uno board
respectively as shown in circuit diagram. This module is equipped with 3-volt CMOS bottom cell thus
no need of external power supply to run RTC module internally.
For storing data (date, time, temperature and humidity) we had used MicroSD card. For interfacing
MicroSD card with Arduino UNO we had used a MicroSD card module. The four lines CS, MOSI,
MISO and SCK of MicroSD card is connected to digital pin 4, 11, 12 and 13 of arduino uno board
respectively as shown in figure 1.

89 | P a g e
A temperature and humidity sensor module DHT-11 is used here to monitor temperature and humidity
of environment. The output of this sensor is digital in nature thus DOUT pin of DHT-11 is connected to
digital pin 7 of arduino uno board.
All the module used in this project (RCT Module, SD card Module and Temperature and humidity
sensor module DHT-11) is powered using arduino board. The arduino uno board gets its input voltage
from 9V power supply through DC jack line.
PARTS LIST OF ARDUINO BASED DATA LOGGER
Arduino Uno Board
RTC Module – DS3231
Temperature and Humidity Sensor – DHT-11
MicroSD Card Module
MicroSD Card

Software Code: The software code for Arduino Based Data Logger is written in Arduino
Programming Language and is burn in Arduino Uno Board using Arduino IDE. You can directly
download software code folder from the link given below. The folder contains DHT-11 Sensor Library
and software code.
//Application Name: Arduino Based Data Logger
//Author: Bestengineeringprojects.com
//Date: 23/10/2017
#include <DS3231.h> //RTC DS3231 Library
(http://www.rinkydinkelectronics.com/download.php?f=DS3231.zip)
#include <SPI.h> //SPI Library
#include <SD.h> //SD card Library
#include <dht.h> //Temperature Sensor Library (Available in Software folder)
#define DHT11_PIN 7
dht DHT;

90 | P a g e
const int chipSelect = 4;
// Init the DS3231 using the hardware interface
DS3231 rtc(SDA, SCL);
void setup()
{
// Setup Serial connection
Serial.begin(9600);
Initialize_SDcard();
Initialize_RTC();
Initialize_PlxDaq();
}
void loop()
{
Read_DHT11();
Write_SDcard();
Write_PlxDaq();
delay(5000); //Wait for 5 seconds before writing the next data
}
void Write_PlxDaq()
{
Serial.print("DATA"); //always write "DATA" to Indicate the following as Data
Serial.print(","); //Move to next column using a ","
Serial.print("DATE"); //Store date on Excel
Serial.print(","); //Move to next column using a ","
Serial.print("TIME"); //Store date on Excel
Serial.print(","); //Move to next column using a ","
Serial.print(DHT.temperature); //Store date on Excel
Serial.print(","); //Move to next column using a ","
Serial.print(DHT.humidity); //Store date on Excel
Serial.print(","); //Move to next column using a ","
Serial.println(); //End of Row move to next row
}
void Initialize_PlxDaq()
{
Serial.println("CLEARDATA"); //clears up any data left from previous projects
Serial.println("LABEL,Date,Time,Temperature,Humidity"); //always write LABEL, to indicate it
as first line
}
void Write_SDcard()
{
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("Log.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.print(rtc.getDateStr()); //Store date on SD card
dataFile.print(","); //Move to next column using a ","
dataFile.print(rtc.getTimeStr()); //Store date on SD card
dataFile.print(","); //Move to next column using a ","
dataFile.print(DHT.temperature); //Store date on SD card
dataFile.print(","); //Move to next column using a ","
dataFile.print(DHT.humidity); //Store date on SD card
dataFile.print(","); //Move to next column using a ","
dataFile.println(); //End of Row move to next row
dataFile.close(); //Close the file

91 | P a g e
}
else
Serial.println("OOPS!! SD card writing failed");
}
void Initialize_SDcard()
{
// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
// open the file. note that only one file can be open at a time,
// so you have to close this one before opening another.
File dataFile = SD.open("Log.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.println("Date,Time,Temperature,Humidity"); //Write the first row of the excel file
dataFile.close();
}
}
void Initialize_RTC()
{
// Initialize the rtc object
rtc.begin();
//#### The following lines can be uncommented to set the date and time for the first time###
/*
rtc.setDOW(FRIDAY); // Set Day-of-Week to SUNDAY
rtc.setTime(18, 46, 45); // Set the time to 12:00:00 (24hr format)
rtc.setDate(6, 30, 2017); // Set the date to January 1st, 2014
*/
}
void Read_DHT11()
{
int chk = DHT.read11(DHT11_PIN);
}
/*void Read_DateTime()
{
// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
// Send time
Serial.println(rtc.getTimeStr());
}*/
/*void Read_TempHum()
{
Serial.print("Temperature = ");
Serial.println(DHT.temperature);
Serial.print("Humidity = ");
Serial.println(DHT.humidity);
// delay(1000);
}*/

Working of the project Arduino Based Data Logger:

92 | P a g e
The working procedure of the project is summarizing in few points shown below:
1. Connect all the circuit as shown in circuit diagram.
2. Burn the program on arduino uno board using arduino IDE
3. Wait few seconds for initialization of sensor module.
4. Temperature, humidity with date and time is stored on SD card in .txt format. (log.txt)
5. Connect the SD card module to computer and open Log.txt. The Log.txt file looks like below
image when opened.

93 | P a g e

You might also like