0% found this document useful (0 votes)
18 views

Report

Uploaded by

Kaladevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Report

Uploaded by

Kaladevi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 42

Smart Trolley using

RFID and NodeMCU


A PROJECT REPORT

Submitted by
HEMA G 1712113
ROJA E 1712131
SHALINI S 1712139

In partial fulfilment for the award of the degree


Of
BACHELOR OF ENGINEERING
IN
ELECTRONICS AND COMMUNICATION
ENGINEERING
GOVERNMENT COLLEGE OF ENGINEERING-
BARGUR
(AUTONOMOUS)
KRISHNAGIRI- 635 104, TAMILNADU
ANNA UNIVERSITY: CHENNAI – 600 025

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.

Submitted for project work viva-voce examination held on …………………at


Government College of Engineering, Bargur-635104.

INTERNAL EXAMINER EXTERNALEXAMNIER


ACKNOWLEDGEMENT

We feel glad to take this opportunity to cordially


acknowledge a number of people who provided us a great support during
our project.

We would like to express our deep sense of gratitude to our


respected Principal Dr.W.NISHATH KANVEL ,M.E., Ph.D.,who has
bestowed his kind grace and affection of us in accomplishing this project.

Sincere thanks to Dr.M.KAVITHA,M.E.,Ph.D.,Head of the


Department of Electronics and Communication Engineering, Bargur on
providing facility to do the project work and utilize all the facilities in this
college.

We would like to thank our Project Coordinator,


Dr.M.KAVITHA,M.E.,Ph.D.,Assistant Professor, Department of
Electronics and Communication Engineering, who guided us throughout
the entire phase of our projects with his esteemed presence. It is his
motivation and guidance which made us explore our project.

It is our opportunity to express gratitude and sincere thanks to our


guide Prof.R.MANIKUMAR,ME., (AP/ECE) Supervisor, who gave us
the motivation to do the project, consistently guided us in completing the
project. We are also thankful to all the faculty members and laboratory
assistants for our department for their constructive guidance and
encouragement.

Finally, we thank our parents, teaching, non-teaching staff and friends who
helped us in completing this project successfully.
ABSTRACT

Nowadays interest in shopping malls is widely increasing


among people. People get daily necessities from shopping malls. The
smart shopping trolley will help shorten the checkout lines thereby
helping the customers at retail stores. Each product in the shopping
mall will be provided with a RFID tag, to identify its type and each
shopping cart is implemented with a NodeMCU, a LCD and a RFID
reader. RFID reader will read the purchasing product information on
the shopping cart and the information about the product is displayed
on LCD which is interfaced to the microcontroller. In this project, a
NodeMCU is attached to a RFID reader. As the user puts items in the
trolley, the reader on the trolley reads the tag and sends a signal to
NodeMCU. The NodeMCU then stores it in the memory and
compares it with product ID. If it matches, it shows the name and
price of item on LCD and also total number and amount of items
purchased. There is a chance to revert back the product according to
our need and budget and deduct the same amount associated to that
product, from the net bill amount.
TABLE OF CONTENTS

S.No TITLE PAGE NO


1 ABSTRACT i
2 TABLE OF CONTENTS ii
3 LIST OF FIGURES v
4 REFERENCES 54

IoT Live Weather Monitoring


CHAPTER 1 PAGE NO
INDRODUCTION
1.1Introduction………………………………………...……………………………......1
1.2Existing Model………………...………………..…………………………….....… 3
1.3Proposed Model………………..…………………..………………………………...3
1.4Scope of Study…………………..…………...………………..……………..…….4

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

Fig no Title Page no

3.1 Embedded system layered architecture 10

3.2 Embedded Architecture 11

4.1 RFID reader 12

3.5.21 MCU Sends out Start Signal to DHT 12

3.5.31 DHT Responses to MCU 13

3.5.3 2 DHT Responses to MCU 13

4.1 1 Rain Sensor module 16

4.3 1 the rain board module circuit 17

4.4 1 Communication Process of rain sensor 18

5.1 1 Barometric Pressure Sensor BMP180 20

5.2 1 BMP180 PIN Diagram 21

5.4 1 Flow chart for Measurement of pressure and temperature 22

5.5 1 BMP180 with ESP-8266 23

6.2 1 NodeMCU 25

6.3 1 NodeMCU PIN Diagram 26

7.2.1 1 Thingspeak New Channel for help creating a new channel 32


7.2.1 2 Thingspeak Channel View 32

7.2.2 1 Thingspeak API Keys Menu View 33

8.1 1 Circuit Diagram 46

8.2 1 Block Diagram 47

8.1 1 Flow chart for overall working 47

11.1 1 Real time Circuit Diagram 49

11.1 2 COM port serial Monitor output 50

11.1 3 Thingspeak Channel Output in Analog 50

11.1 4 Thingspeak Channel Output in Digital 51

CHAPTER 1
INTRODUCTION
1.1 Introduction

Nowadays, supermarkets and shopping complexes have become


so commonplace, that they are no longer a luxury afforded only by
urban cities. They have expanded beyond the domain of big cities and
ventured into rural areas as well. Anybody can go to these stores and
buy products that they need, but they are not entirely convenient,
especially when a customer has to wait for hours in queues on busy
days. In recent times, the RFID technology has been developing
rapidly and we’re seeing its applications in a variety of industries,
from employee ID cards being scanned in the office to the issuing of
books in libraries. RFID stands for Radio-Frequency Identification,
where information is digitally encoded into tags which can be used to
uniquely identify a product. The RFID tags are generally captured
using radio waves and the captured data is stored into a database. The
RFID tags are somewhat similar to the traditional barcodes in their
purpose and functionality, as they are used for data processing.
However, there are a few key differences between the two. Barcode
usually requires a barcode reader to visually register the code in order
to obtain information, while in the case of RFID, the use of radio
waves as a means of recording data means that no line of sight is
required. RFID has automatic tracking enabled and allows new
information to be updated from time to time while the barcode
scanning requires one to manually track the data and has no provision
for updating records. RFID overcomes the drawbacks posed by
barcode system which also include durability issues. The aim here is
to create a system that combines the convenience of RFID tags and
wireless sensing with a simple and easy tracking system that allows
customers to purchase products without the hassle of waiting in
queues. The customer simply has to put a product in the trolley and let
the reader scan the product for information. By fitting the trolley with
an LCD that can display product information, it also gives us a
feasible system of providing the customer with all the information
like manufacturing date, expiry date, price, etc. which proves to be
useful when making the decision to buy an article. The system allows
a customer to scan the items and the trolley automatically updates the
total cost and bills the customer. It also has the provision of setting a
budget, which when exceeded, sounds an alarm, as well as the
removal of products and their cost from the total bill if a person
deems it unnecessary. The system is built such that billing
information is sent to a central server in real-time using the ESP8266
wifi module which tracks all the shopping trolleys and allows the
client to log into the integrated app to track purchase and make
payments digitally on the spot. The ease of functionality, versatility,
and adaptability of the RFID enabled shopping cart makes it a state of
the art system for shopping.

1.2 Existing Model


In existing system, customer will not know the amount of
total purchase, until he went to the counter for paying bill. One can
remove certain product, once he approaches to the counter, where he
decides which product should be reverted back. To avoid these type
of troubles, we develop a smart trolley, where one can know the total
number of products and the total bill of the products purchased.

1.3 Proposed Model


In the proposed system, we are using the RFID reader at the
trolley side and every product in the supermarket has its unique RFID
tag with unique ID. Once the customer drops a certain product in the
trolley, then the tag attached to that product was read by the RFID
reader and sent to the controller. The controller counts the product
value and displays its value on the LCD screen of the trolley. Like
that we can add any number of products of our need and check the
total bill on the LCD screen.
1.4. Scope of Study
The scope study which is needed for the completion of this project
involves the following listed criteria:

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.

RFID technology is better than barcode technology in terms of speed.


RFID tags can be read much faster than the barcode tags. As it
requires a direct line of sight, barcode reading is comparatively slower
than the RFID tag reading.

2.2. RFID & Barcode Approaches


A barcode reader takes about one second to successfully interpret two
tags, whereas in the same time the RFID reader can interpret around
40 tags. RFID tags are well protected and implanted inside the
product, and thus they are not subjected to too many wears and tears.
The barcode requires a direct line of sight to the printed barcode,
because of which the barcode has to be printed on the outer side of
product, thus subjected to huge amounts of wears and tears. It is also
limited to re-utilization of the barcodes. As barcode lacks with the
read and write facility, it is not possible to add to the information that
is already existing on it. The main advantage of using the RFID tags
is that rewriting on RFID tags is possible.

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.

3.2 APPLICATION AREAS:


About 99% of the processors manufactured end up in the embedded
systems. The market of Embedded systems is one of the highest
growth areas as these systems are used in many market segments such
as consumer electronics, office automation, transportation, military,
industrial automation, biomedical engineering, wireless
communication, data communication, telecommunications..

 Consumer appliances
 Office automation
 Medical electronics
 Computer networking:
 Telecommunications
 Wireless technologies

3.3OVERVIEW OF EMBEDDED ARCHITECTURE:


Every embedded system comprises of a custom-built hardware which
is constructed around a Central Processing Unit (CPU). The hardware
also contains memory chips. Onto the memory chips, the software is
loaded. The software existing on the memory chip is also called as
the ‘firmware’. The embedded system architecture can be represented
as a layered architecture as shown in the Fig.3.1

Figure 3.1 Embedded system

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.

The building blocks of an embedded system are:

· The Central Processing Unit (CPU)

· Memory (RAM and ROM)

· The Input Devices

· The Output devices

· The Communication interface

· Specific circuitry depending on the application.

Fig 3.2 Embedded Architecture


CHAPTER 4
HARDWARE IMPLEMENTATION
4.1 BLOCK DIAGRAM

I2C

POWER MODULE

SUPPLY

16*2
NODEMCU LCD

EM-18

READER BUZZER

LED

Figure 4.1 Block diagram of project

4.2 RFID READER:

Figure 4.2 RFID Reader


Radio Frequency Identification (RFID) is a reader which helps in
identification of the object/card/tag whenever matched by suitable
frequency it detects by the help of radio waves transmitted through
the tag where a particular tag comes into contact with the reader under
a particular frequency radio waves or electro magnetic spectrum is
generated which helps in transmission of the data from the tag to the
reader where the tag contains a chip when ever it is placed under
suitable frequency a unique number is generated which in turn is sent
to the reader.This unique number generated for each tag is helpful in
identifying so whenever the user places the tag under the reader it
detects the card where the data of the users must be stored
electronically in the database thereby whenever it reads it searches in
the database whether he is valid user or not and then proceeds
accordingly. This RFID reader can be placed anywhere according to
our necessity like cars, homes, offices near the entrances by this
whenever a user needs to enter/exit he need to place the card on the
reader. Some of the readers detect from meters away according to the
frequency match level but its good to detect under a less possible
distance whatever the object comes into contact with that particular
matching frequency the reader detects.

1. An RFID tag, or transponder, that carries object-identifying data.

2. An RFID tag reader, or transceiver, that reads and writes tag data.

3. A host/backend database to store the tag contents.

Each tag/card provided has a unique identification number whenever


it comes into contact with the reader under a frequency level the tag
gets energized through the radio waves generated and passes the data
to the reader which in turn is sent to the application system from the
reader to the middleware and then it checks in the host database or
backend system if there is a match with the records in the database
then it will be further proceeded for authorization of the user to be
granted or else rejected if not found.

RFID Reader and Tags:

A radio frequency identification reader (RFID reader) is a device


which is used to read data from the tag/card whenever radio wave of
particular frequency matches. Each tag is provided with unique
identification number in order to identify the user by providing
security which is similar to barcodes and this unique number is stored
in the database to verify.

RFID TAGS

What is RFID?

A basic RFID system consists of the following three components:

a) An antenna or a coil

b) A transceiver (with decoder)

c) A transponder (RF tag)

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.

Using RFID Reader:

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:

 There are no “line of sight” requirements: Bar code reads can


sometimes be limited or problematic due to the need to have a
direct “line of sight” between a scanner and a bar code but
RFID tags can be read through materials without line of sight.
 They have greater data capacity: RFID tags can be easily
encoded with the product details such as lot and batch, weight,
etc.
 It has “Write” capabilities: Because RFID tags can be rewritten
with new data as supply chain activities are completed. As they
move throughout the supply chain tagged products carry
updated information.

Common Problems with RFID: Reader collision and tag collision


are some common problems with RFID. When the signals from two
or more readers overlap reader collision occurs.

4.3 LIQUID CRYSTAL DISPLAY


LCD is the acronym for Liquid Crystal Display. LCD is finding wide
spread use replacing LEDs (seven segment LEDs or other multi
segment LEDs) because of the following reasons:

1. Reducing prices of LCDs.


2. In contrast to LEDs, LCD’s ability to display numbers,
characters and graphics which are limited to numbers and a few
characters.
3. Incorporation of a refreshing controller into the LCD, thereby
relieving the CPU of the task of refreshing the LCD. In contrast,
the LED must be refreshed by the CPU to keep displaying the
data.
4. Ease of programming for characters and graphics.
Figure 4.16 LCD display

Basics of LCD Displays:-

The main advantage of LCD display is it consumes less power that is


in terms of microwatts than the LED’s which takes milli watts power
consumption.LCD displays are of low cost, less power consumption
and other etc benefits but there are certain drawbacks like it works
under a particular temperature between 00-60 0 c, less life time
operability, poor visibility in low ,less speed and need for an ac drive.

Basic structure of an LCD

A liquid crystal consists of a thin layer when it is sandwiched between


two glass sheets with two electrodes in the inside faces when the two
glass sheets are transparent then it is called transmitive type cell. If
one is transparent and other is reflective then it is called reflective
type cell. It does not produce its own illumination infact it depends on
an another external source for the illumination.

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

1 Ground (0V) Ground

2 Supply Voltage, 5V(4.7 V-5.3V) VCC

3 Contrast adjustment, through a variable resistor VEE

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

15 Backlight Vcc(5V) Led +

16 Backlight ground(0V) Led-

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.

6.3 Pin Descriptions


Power Pins: There are four power pins. VIN pin and three 3.3V pins.
 VIN can be used to directly supply the NodeMCU/ESP8266 and its
peripherals. Power delivered on VIN is regulated through the
onboard regulator on the NodeMCU module – you can also supply
5V regulated to the VIN pin
 3.3V pins are the output of the onboard voltage regulator and can be
used to supply power to external components.

GND: are the ground pins of NodeMCU/ESP8266

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.

GPIO Pins: NodeMCU/ESP8266 has 17 GPIO pins which can be


assigned to functions such as I2C, I2S, UART, PWM, IR Remote Control,
LED Light and Button programmatically. Each digital enabled GPIO can
be configured to internal pull-up or pull-down, or set to high impedance.
When configured as an input, it can also be set to edge-trigger or level-
trigger to generate CPU interrupts.

ADC Channel: The NodeMCU is embedded with a 10-bit precision SAR


ADC. The two functions can be implemented using ADC.
Testing power supply voltage of VDD3P3 pin and testing
input voltage of TOUT pin. However, they cannot be implemented at the
same time.

UART Pins: NodeMCU/ESP8266 has 2 UART interfaces (UART0 and


UART1) which provide asynchronous communication (RS232 and
RS485), and can communicate at up to 4.5 Mbps. UART0 (TXD0, RXD0,
RST0 & CTS0 pins) can be used for communication. However, UART1
(TXD1 pin) features only data transmit signal so, it is usually used for
printing log.

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).

Control Pins: are used to control the NodeMCU/ESP8266. These pins


include Chip Enable pin (EN), Reset pin (RST) and WAKE pin.
 EN: The ESP8266 chip is enabled when EN pin is pulled HIGH.
When pulled LOW the chip works at minimum power.
 RST: RST pin is used to reset the ESP8266 chip.
 WAKE: Wake pin is used to wake the chip from deep-sleep.

Tiny Sine Wave Control Pins: are used to control the


NodeMCU/ESP8266. These pins include Chip Enable pin (EN), Reset pin
(RST) and WAKE pin.
 EN: The ESP8266 chip is enabled when EN pin is pulled HIGH.
When pulled LOW the chip works at minimum power.
 RST: RST pin is used to reset the ESP8266 chip.
 WAKE: Wake pin is used to wake the chip from deep-sleep.

6.4 USB to Serial Converter


Incorporated into each NodeMCU is a USB to Serial
Converter. The official design is based on the CP2102 chipset and offers
the best compatibility. Genuine boards use the CP2102 chipset including
the officially licensed Amica NodeMCU modules. The other common
USB to Serial Converter used is the CH340G which is common on the
lower-priced modules including the LoLin units. Other designs may use
drivers including the FTDI chipset, but those designs are rare.

Depending on the Operating System you are using with the


NodeMCU, the appropriate driver must be installed. Generally, Windows
10 immediately recognizes the CP2102 chipset while the CH340G may
require separate installation.
6.5 Programming NodeMCU ESP8266 with Arduino
IDE
The NodeMCU Development Board can be easily
programmed with Arduino IDE since it is easy to use.
Programming NodeMCU with the Arduino IDE will hardly
take 5-10 minutes. All you need is the Arduino IDE, a USB cable and the
NodeMCU board itself.

6.5.1 Uploading program


Once Arduino IDE is installed on the computer, connect the
board with the computer using the USB cable. Now open the Arduino IDE
and choose the correct board by selecting Tools>Boards>NodeMCU1.0
(ESP-12E Module), and choose the correct Port by selecting Tools>Port.
To get it started with the NodeMCU board and blink the built-in LED, load
the example code by selecting Files>Examples>Basics>Blink. Once the
example code is loaded into your IDE, click on the ‘upload’ button given
on the top bar.

6.6 Features &Specifications


 Microcontroller: Tensilica 32-bit RISC CPU Xtensa LX106
 Operating Voltage: 3.3V
 Input Voltage: 7-12V
 Digital I/O Pins (DIO): 16
 Analog Input Pins (ADC): 1
 UARTs: 1
 SPIs: 1
 I2Cs: 1
 Flash Memory: 4 MB
 SRAM: 64 KB & Clock Speed: 80 MHz
 USB-TTL based on CP2102 is included onboard, Enabling Plug n
Play
 PCB Antenna
 Small Sized module to fit smartly inside your IoT projects.
6.7 Applications
 Prototyping of IoT devices
 Low power battery operated applications
 Network projects
 Projects requiring multiple I/O interface with Wi-Fi and Bluetooth
functionalities.

Programming NodeMCU Using Arduino IDE


To upload code into NodeMCU using Arduino IDE, follow the
steps below:
1. Open Arduino IDE, then go to File–>Preferences–>Settings.

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.

4. After installation is complete, go to Tools ->Board -> and select


NodeMCU 1.0(ESP-12E Module). Now you can program NodeMCU
with Arduino IDE.
Find out Unique 12 digit Code for RFID Tag
Before programming the NodeMCU for the smart shopping cart
project, first, we need to find out the 12 digit RFID tag unique code.
As discussed before, RFID tags contain a 12 digit unique code and it
can be decoded by using an RFID reader. When the RFID card is
swiped near the Reader, the Reader will give the unique codes via the
output serial port when it is connected to NodeMCU. First, connect
the NodeMCU to the RFID reader as per the circuit diagram and then
upload the code below to NodeMCU.

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.

ESP8266WebServer server (80);

Now, declare the network credentials- i.e. SSID and password. It is


required to connect the NodeMCU to the internet.

const char* ssid = "admin";


const char* password = "12345678";

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.

LiquidCrystal_I2C lcd(0x27, 16, 2);

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 ");

Then, to connect NodeMCU to the internet, call WiFi.begin and pass


network SSID and password as its arguments. Check for the
successful network connection using WiFi.status() and after a
successful connection, print a message on LCD with IP address.

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.

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();
}

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.

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();
}
}

Finally, the individual costs of the products are calculated as follows.


Here some random cost values are chosen which you can be changed
as per choice.

c1=p1*35.00;
c2=p2*38.00;
c3=p3*55.00;
c4=p4*45.00;

In the end, call server.handleClient() to handle new requests and


check them.

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

through a visual display. You’re able to create graphs, negative value


graphs, and conduct waveform a
CHAPTER 11
11.1 Observations and Results

CHAPTER 12
12.1 Conclusion

REFERENCES

You might also like