Report
Report
Submitted by
HEMA G 1712113
ROJA E 1712131
SHALINI S 1712139
DECEMBER 2020
BONAFIDE CERTIFICATE
Certificated that this project report “Smart Trolley using RFID and
NodeMCU” is the Bonafide work done by the following students under my
supervision.
HEMA 1712113
ROJA E 1712131
SHALINI S 1712139
SIGNATURE SIGNATURE
Dr.M. KAVITHA, M.E., Ph.D., Prof.R. MANIKUMAR, ME.,
HEAD OF THE DEPARTMENT SUPERVISOR,
Department of ECE, Assistant Professor,
Government College of Engineering, Department of ECE,
Bargur – 635 104. Government College of Engineering,
Bargur – 635 104.
Finally, we thank our parents, teaching, non-teaching staff and friends who
helped us in completing this project successfully.
ABSTRACT
CHAPTER 2
LITERATURE SURVEY
2.1RFID&Barcode Processing………..............................................................................5
2.2RFID&Barcode Approaches………….......................................................................6
CHAPTER 3
INTRODUCTION TO EMBEDDED SYSTEMS
3.1Introduction……………….…………………………………………………..5
3.2 Application Areas…………………..………………………………………….14
3.3Overview of embedded architecture……………………………...…………….15
CHAPTER 4
HARDWARE IMPLEMENTATION
4.1 Block diagram……………………….……………………..………………………16
4.2 RFID Reader……………………..……………..…………………...……………16
4.3 Liquid Crystal Display………….............................................................................16
4.4 NodeMCU……..……………………..………..……………………..…………18
4.5 …………………………..………………...…..…………………………..18
4.6 ……………………….…………...…..………………………………19
CHAPTER 5
CHAPTER 6
NodeMCU ESP8266
6.1 Introduction……………………………………...…………………………………25
6.2 About NodeMCU……..............................................................................................25
6.3 Pin Descriptions…………………..………………………...…………………...…26
6.4 USB to Serial Converter……….……………..……………...……….…….……...28
6.5 Programming NodeMCU ESP8266 with Arduino IDE…...………..…...…….…...29
6.6 Features & Specifications……………..……………………..…………………….29
6.7 Applications…………………………...……….…………………………………..30
CHAPTER 7
Arduino IDE
7.1 Introduction………………….……………………………………………………..35
7.2 Definition…………………………………………...…….………………………..35
7.3How to get Arduino IDE…………………………...………..……………………...36
7.4Programming………………………………………..…..……………………….…38
CHAPTER 9
9.1 Coding…………..………………………………..…...……………………………40
CHAPTER 10
10.1 Circuit diagram..…………...………………………...…….…………………….46
10.2 Design and implementation..……………...…………....………………………..46
10.3 Structural analysis and working principle……..…...…………………………….47
CHAPTER 11
11.1 Observations and Results ….……………………………….…………………….49
11.2 Advantages of the proposed system…………………….…...……………………51
CHAPTER 12
12.1Conclusion……………………………………………...…..………………….….53
12.2 Limitations………………………………………………………………………..53
12.3Future Scope………………………………….……………………………….…..53
LIST OF FIGURES
6.2 1 NodeMCU 25
CHAPTER 1
INTRODUCTION
1.1 Introduction
1. NodeMCU Architecture.
2. Microcontroller programming in C language.
3. Interfacing LCD with the microcontroller.
4. Interfacing RFID reader with microcontroller.
5. The circuitry and the devices that are needed to build the device
and establish necessary connection between the devices.
CHAPTER 2
LITERATURE SURVEY
2.1. RFID & Barcode Processing
RFID and barcodes are similar in that they are both data collection
technologies, which means they automate the process of data
collection. However, they also differ significantly in many areas. If
compared, RFID technology is found to be more simple than the
barcode technology. Barcode scanner requires line of sight whereas
RFID can be read without the line of sight. It is possible to scan RFID
tags from a larger distance. An RFID reader can gain the information
of the tag from a distance of about 300 feet, whereas barcode
technology cannot be scanned from a distance of more than 15 feet.
Barcode coded items can only be read individually whereas multiple
tags can be read by RFID reader simultaneously.
CHAPTER 3
INTRODUCTION TO EMBEDDED SYSTEMS
3.1 EMBEDDED SYSTEM:
An embedded system can be defined as a computing device that will
do a specific focused job. Examples of Embedded systems are
appliances such as air-conditioner, printer, DVD player, fax machine,
mobile phone etc. These appliances have a processor and a different
hardware to meet specific requirement of the application along with
embedded software that is executed by the processor for meeting that
specific requirement. The embedded software is also called “firm
ware”. For a variety of applications such as playing games,
wordprocessing, accounting, software development and so on,
embedded systems can be used. The software in the embedded
systems is always fixed.
Consumer appliances
Office automation
Medical electronics
Computer networking:
Telecommunications
Wireless technologies
Layered Architecture
The operating system runs above hardware and application software
runs above operating system. Same architecture is applicable to any
computer including a desktop computer. However, there will be
significant differences. To have an operating system in every
embedded system is not compulsory. There is no need for an
operating system for small applications such as toys, remote control
units, air conditioners, etc., and only software specific can be written
to that application. It is advisable to have an operating system for
applications that involve complex processing. You will also need to
integrate the application software with the operating system and then
transfer entire software onto the memory chip in such a case. Once the
software is transferred to the memory chip, it will continue to run for
a long time and one doesn’t need to reload new software. The various
building blocks of the hardware of an embedded system are given
below.
I2C
POWER MODULE
SUPPLY
16*2
NODEMCU LCD
EM-18
READER BUZZER
LED
2. An RFID tag reader, or transceiver, that reads and writes tag data.
RFID TAGS
What is RFID?
a) An antenna or a coil
Communication
When the RFID Card Reader is active and a valid RFID transponder
tag is placed within range of the activated reader, the unique ID will
be transmitted as a 12-byte printable ASCII string serially to the host.
When powered on, the RFID reader will activate an RF field waiting
for the tag to come into its range. Once the tag is detected, its unique
ID number is read and the data is sent via a serial interface. The valid
tag detecting is indicated by an LED blink and the Buzzer beep. Face
of the RFID tag must be held parallel to the front of the antenna.
The Advantages of RFID Over Bar Coding:
Pins Functions Pins are there along one side of the small printed
board that are used for connection to the microcontroller. There are a
total of 14 pins marked with numbers (16 in case the background light
is built in). Their function is described in the table given below.
Pin Function Name
No
4 Selects command register when low, and the register when Register
high select
5 Low to write to the register, high to read from the register Read /Write
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8- BIT DATA PINS
11 DB4
12 DB5
13 DB6
14 DB7
NodeMCU ESP8266
Introduction
NodeMCU is an open-source firmware and development
kit that helps you to prototype or build IoT products. It includes
firmware that runs on the ESP8266 Wi-Fi SoC from Espressif
Systems, and hardware which is based on the ESP-12 module. The
firmware uses the Lua scripting language. It is based on the eLua
project and built on the Espressif Non-OS SDK for ESP8266.
About NodeMCU
The NodeMCU (NodeMicrocontroller Unit) is an open-source
software and hardware development environment built around an
inexpensive System-on-a-Chip (SoC) called the ESP8266. The ESP8266,
designed and manufactured by Espressif Systems, contains the crucial
elements of a computer: CPU, RAM, networking (WIFI), and even a
modern operating system and SDK. That makes it an excellent choice for
the Internet of Things (IoT) projects of all kinds.
I2C Pins: are used to connect I2C sensors and peripherals. Both I2C
Master and I2C Slave are supported. I2C interface functionality can be
realized programmatically, and the clock frequency is 100 kHz at a
maximum. It should be noted that I2C clock frequency should be higher
than the slowest clock frequency of the slave device.
SPI Pins: NodeMCU/ESP8266 features two SPIs (SPI and HSPI) in slave
and master modes. These SPIs also support the following general-purpose
SPI features:
4 timing modes of the SPI format transfer
Up to 80 MHz and the divided clocks of 80 MHz
Up to 64-Byte FIFO
SDIO Pins: NodeMCU/ESP8266 features Secure Digital Input/Output
Interface (SDIO) which is used to directly interface SD cards. 4-bit 25
MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are supported.
PWM Pins: The board has 4 channels of Pulse Width Modulation (PWM).
The PWM output can be implemented programmatically and used for
driving digital motors and LEDs. PWM frequency range is adjustable from
1000 μs to 10000 μs (100 Hz and 1 kHz).
2.Type https://arduino.esp8266.com/stable/package_esp8266com_index.json
in the ‘Additional Board Manager URL’ field and click ‘Ok’.
3. Now go to Tools > Board > Boards Manager. In the Boards
Manager window, Type ESP8266 in the search box, select the latest
version of the board and click on install.
After successfully uploading the code, open the serial monitor and set
the baud rate to 9600. Then swipe the card near the Reader and you
can now see the 12 digit code on the serial monitor as shown in the
snapshot below. Do this process for all the used RFID tags and note it
down for future references.
int count = 0;
char card_no[12];
void setup()
{
Serial.begin(9600);
}
void loop()
{
if(Serial.available())
{
count = 0;
while(Serial.available() && count < 12)
{
card_no[count] = Serial.read();
count++;
delay(5);
}
Serial.print(card_no);
}
}
Code Explanation
After the successful completion of the hardware setup, now it's time
to program NodeMCU. Complete code for this RFID based smart
trolley project along with the video is given at the end of this
tutorial. The stepwise description of the code is given below.
Start the code by including all the required library files in the code
like ESP8266WiFi.h for ESP8266 board, LiquidCrystal_I2C.h for
LCD, Wire.h for SPI communication, etc.
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <LiquidCrystal_I2C.h>
#include<Wire.h>
Then create the ESP8266WebServer class object with the name server
and default port number 80.
For using the I2C module for 16*2 Alphanumeric LCD, configure it
using the LiquidCrystal_I2C class. Here we have to pass the
address, row, and column number which are 0x27, 16, and 2
respectively in our case.
Inside setup (), declare all the input pins and output pins. Then print a
welcome message on the LCD which will be displayed during the
initialization of the project.
pinMode(D3,INPUT_PULLUP);
pinMode(D4,OUTPUT);
Serial.begin(9600);
WiFi.begin(ssid, password);
Wire.begin(D2, D1);
lcd.begin(16, 2);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" WELCOME TO ");
lcd.setCursor(0, 1);
lcd.print(" SMART CART ");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
lcd.setCursor(0, 0);
lcd.print("WiFi connecting... ");
}
lcd.setCursor(0, 0);
lcd.print("WiFi connected ");
lcd.setCursor(0, 1);
lcd.print(WiFi.localIP());
delay(1500);
Inside loop(), the digital pin where the push button is connected is
read using digitalRead() and stored in an integer variable. Here we
are using a button to remove a product from the cart.
int a=digitalRead(D3);
Now in the below code, the unique 12 digit codes of the RFID tags
are decoded and stored in an array. Then the elements of the array
will be matched with the Stored Tag numbers in the memory, to get
the product details.
count = 0;
while (Serial.available() && count < 12)
{
input[count] = Serial.read();
count++;
delay(5);
}
Here, we compare the received array with the stored tag codes, if the
button is not pressed and the code matches, then the below condition
is executed and the product is added in the shopping cart. The same
information will be displayed on LCD. The below code increase the
product numbers in the cart and add the price in total cart value.
Now the below condition will be executed when the button is pressed,
and the RFID tag codes are matched with the stored array. This means
we have to remove this product from the cart and subtract the product
price from the total cart value.
c1=p1*35.00;
c2=p2*38.00;
c3=p3*55.00;
c4=p4*45.00;
server.handleClient();
Code
#include<ESP8266WiFi.h>
#include<WiFiClient.h>
#include<ESP8266WebServer.h>
#include<LiquidCrystal_I2C.h>
#include<Wire.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const char* ssid = "admin";//Replace with your network SSID
const char* password = "12345678";//Replace with your network
password
ESP8266WebServer server(80);
String page = "";
char input[12];
int count = 0;
int a;
int p1=0,p2=0,p3=0,p4=0;
int c1=0,c2=0,c3=0,c4=0;
double total = 0;
int count_prod = 0;
void setup()
{
pinMode(D3,INPUT_PULLUP);
pinMode(D4,OUTPUT);
Serial.begin(9600);
WiFi.begin(ssid, password);
Wire.begin(D2, D1);
lcd.begin(16, 2);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" WELCOME TO ");
lcd.setCursor(0, 1);
lcd.print(" SMART CART ");
delay(2000);
lcd.clear();
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
lcd.setCursor(0, 0);
lcd.print("WiFi Connecting... ");
}
Serial.print(WiFi.localIP());
lcd.setCursor(0, 0);
lcd.print("WiFi Connected");
lcd.setCursor(0, 1);
lcd.print(WiFi.localIP());
delay(1000);
lcd.setCursor(0, 0);
lcd.print(" PLZ ADD ITEMS ");
lcd.setCursor(0, 1);
lcd.print(" TO CART ");
}
void loop()
{
int a=digitalRead(D3);
if (Serial.available())
{
count = 0;
while (Serial.available() && count < 12)
{
input[count] = Serial.read();
count++;
delay(5);
}
if (count == 12)
{
if ((strncmp(input, "0B00291F5B66", 12) == 0) && (a == 1))
{
lcd.setCursor(0, 0);
lcd.print("Biscuit Added ");
lcd.setCursor(0, 1);
lcd.print("Price(Rs):35.00 ");
p1++;
digitalWrite(D4,HIGH);
delay(2000);
total = total + 35.00;
count_prod++;
digitalWrite(D4,LOW);
lcd.clear();
}
else if ((strncmp(input, "0B00291F5B66", 12) == 0) && (a == 0))
{
if(p1>0)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Biscuit Removed!!! ");
digitalWrite(D4,HIGH);
delay(2000);
p1--;
total = total - 35.00;
count_prod--;
lcd.clear();
digitalWrite(D4,LOW);
}
else
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Not in cart!!! ");
digitalWrite(D4,HIGH);
delay(2000);
digitalWrite(D4,LOW);
lcd.clear();
}
}
else if ((strncmp(input, "0B002920D0D2", 12) == 0) && (a ==
1))
{
lcd.setCursor(0, 0);
lcd.print("Soap Added ");
lcd.setCursor(0, 1);
lcd.print("Price(Rs):38.00 ");
total = total + 38.00;
digitalWrite(D4,HIGH);
delay(2000);
p2++;
count_prod++;
digitalWrite(D4,LOW);
lcd.clear();
}
else if ((strncmp(input, "0B002920D0D2", 12) == 0) && (a ==
0))
{
if(p2>0)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Soap Removed!!! ");
digitalWrite(D4,HIGH);
delay(2000);
p2--;
total = total - 38.00;
count_prod--;
lcd.clear();
digitalWrite(D4,LOW);
}
else
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Not in cart!!! ");
digitalWrite(D4,HIGH);
delay(2000);
lcd.clear();
digitalWrite(D4,LOW);
}
}
else if ((strncmp(input, "0B002948A8C2", 12) == 0) && (a ==
1))
{
lcd.setCursor(0, 0);
lcd.print("Rice(1KG) Added ");
lcd.setCursor(0, 1);
lcd.print("Price(Rs):55.00 ");
total = total + 55.00;
digitalWrite(D4,HIGH);
delay(2000);
count_prod++;
p3++;
lcd.clear();
digitalWrite(D4,LOW);
}
else if ((strncmp(input, "0B002948A8C2", 12) == 0) && (a==0))
{
if(p3>0)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Rice(1KG) Removed!!! ");
digitalWrite(D4,HIGH);
delay(2000);
total = total - 55.00;
p3--;
count_prod--;
lcd.clear();
digitalWrite(D4,LOW);
}
else
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Not in cart!!! ");
digitalWrite(D4,HIGH);
delay(2000);
lcd.clear();
digitalWrite(D4,LOW);
}
}
else if ((strncmp(input, "0B00283BFEE6", 12) == 0) && (a ==
1))
{
lcd.setCursor(0, 0);
lcd.print("Tea(50g) Added ");
lcd.setCursor(0, 1);
lcd.print("Price(Rs):45.00 ");
total = total + 45.00;
count_prod++;
digitalWrite(D4,HIGH);
p4++;
delay(2000);
lcd.clear();
digitalWrite(D4,LOW);
}
else if ((strncmp(input, "0B00283BFEE6", 12) == 0) && (a ==
0))
{
if(p4>0)
{
lcd.clear();
total = total - 45.00;
lcd.setCursor(0, 0);
count_prod--;
p4--;
lcd.print("Tea(50g) Removed!!! ");
digitalWrite(D4,HIGH);
delay(2000);
lcd.clear();
digitalWrite(D4,LOW);
}
else
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Not in cart!!! ");
digitalWrite(D4,HIGH);
delay(2000);
lcd.clear();
digitalWrite(D4,LOW);
}
}
else if (strncmp(input, "0B00292BADA4", 12) == 0)
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Total Prod:");
lcd.setCursor(11, 0);
lcd.print(count_prod);
lcd.setCursor(0, 1);
lcd.print("Price:");
lcd.setCursor(6, 1);
lcd.print(total);
digitalWrite(D4,HIGH);
delay(2000);
lcd.clear();
digitalWrite(D5,LOW);
lcd.setCursor(0, 0);
lcd.print(" Thank you ");
lcd.setCursor(0, 1);
lcd.print(" for Shopping ");
digitalWrite(D4,LOW);
}
}
c1=p1*35.00;
c2=p2*38.00;
c3=p3*55.00;
c4=p4*45.00;
}
server.handleClient();
}
CHAPTER 8
Arduino IDE
8.1 Introduction
IDE stands for “Integrated Development Environment”: it is
an official software introduced by Arduino.cc, that is mainly used for
editing, compiling and uploading the code in the Arduino Device. Almost
all Arduino modules are compatible with this software that is an open
source and is readily available to install and start compiling the code on the
go. In this article, we will introduce the Software, how we can install it,
and make it ready for developing applications using Arduino modules.
8.2 Definition
1. Arduino IDE is an open source software that is mainly used for
writing and compiling the code into the Arduino Module.
2. It is an official Arduino software, making code compilation too easy
that even a common person with no prior technical knowledge can
get their feet wet with the learning process.
3. It is easily available for operating systems like MAC, Windows,
Linux and runs on the Java Platform that comes with inbuilt
functions and commands that play a vital role for debugging,
editing and compiling the code in the environment.
4. A range of Arduino modules available including Arduino Uno,
Arduino Mega, Arduino Leonardo, Arduino Micro and many more.
5. Each of them contains a microcontroller on the board that is
actually programmed and accepts the information in the form of
code.
6. The main code, also known as a sketch, created on the IDE platform
will ultimately generate a Hex File which is then transferred and
uploaded in the controller on the board.
7. The IDE environment mainly contains two basic parts: Editor and
Compiler where former is used for writing the required code and
later is used for compiling and uploading the code into the given
Arduino Module.
8. This environment supports both C and C++ languages.
CHAPTER 10
10.1 Circuit Diagram
CHAPTER 12
12.1 Conclusion
REFERENCES