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

Intern 122 Report

Technologics is a company headquartered in Bangalore, India that provides automation services including PLC, SCADA, industrial automation, building management systems, and embedded systems. The company's mission is to be a leading solution provider through expertise, quality, and cost-effective services. It aims to focus on profitability, maintain a lean organization, employ quality assurance, and practice sound financial management. Technologics serves various industry verticals including residential, commercial, healthcare, education, and industrial automation needs.

Uploaded by

S Varshitha
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)
336 views

Intern 122 Report

Technologics is a company headquartered in Bangalore, India that provides automation services including PLC, SCADA, industrial automation, building management systems, and embedded systems. The company's mission is to be a leading solution provider through expertise, quality, and cost-effective services. It aims to focus on profitability, maintain a lean organization, employ quality assurance, and practice sound financial management. Technologics serves various industry verticals including residential, commercial, healthcare, education, and industrial automation needs.

Uploaded by

S Varshitha
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/ 73

Embedded Systems and IoT

CHAPTER 1
ABOUT THE COMPANY
1.1 Introduction

Fig 1.1 Company Logo

TECHNOLOGICS head- quartered in Bangalore,


India. It is established by technology pioneers having
decades of experience across India & Middle East
in controls and automation industry. We offer a wide
range of services, related to PLC, SCADA, Industrial Automation, Integrated Building
Management System ( IBMS ), LabVIEW, ETAP, Mechanical Design ( CAD / CAM / CAE ),
Oracle, JAVA JSP & Embedded systems for commercial, residential and Industrial sectors.
TECHNOLOGICS commenced business trading as a designer and installer of multi brand
controls, automation distribution systems, providing a complete range of Custom Installation
services and has an extensive experience in the field of complex turn-key solutions development
and integration. We propose, design, develop, train, install, integrate, operate and maintain the
state-of-the-art IBMS/SCADA and the PLC automation systems and solutions. The services we
offer span the full development / integration lifecycle from definition of requirements to field
testing of implemented solutions.

1.1.1 Our Mission 

Our Mission is to be an ultimate solution provider with a reputation for expertise, quality, and
cost effective in the world of automation and to advocate sustainable environmental protection

by maximizing our consolidated effort through unmatchable teamwork.

 Focus on profitability and return on investments over growth.


 Maintain a lean and flexible organization.

1
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 Employ quality assurance in pursuit of service excellence.


 Practice sound financial management.
 Employ effective project management processes.
 Develop strong project management teams and support systems.

1.1.2 Our Vision

Our Vision is to provide training and implement services with edge of competitive in quality &
price to our valued customers in the ground of sustainability. We promote reputed multi brand
residential, commercial and Industrial automation products. Our focus and growth will be on the
technological outsourcing in the field of PLC controls, BMS, HVAC controls and other related
sub systems in the Middle East and Indian subcontinent.

1.1.3 Our Approach

 We develop the best talent at every level of our business


 Provide best services to attract new client, retaining and expanding the relationship with
the existing clients.
 Deliver leading quality and innovative services with maximum efficiency.
 Constantly update and adapt latest technology emerging in the control market.
 Managing risk while protecting our business values and brand.
 Thinking long term and act responsibly and strategically.

1.1.4 Objectives

1. Increase the technical knowledge and real time industrial exposure of the students during
the commencement of Industrial Training
2. Maximize students employability and increase the rate of placement
3. Branding of College &wider recognition by Industry and Corporate
4. Higher Ranking for the College in Surveys
5. Possibility of establishing the Centre of Excellence by the Industry

2
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

6. Certified and Industry oriented Technical Skills & Personality Development Training
under one window saving cost and Time
7. Live Projects and Practice on Real Systems and Instrument

1.1.5 Company Values

People-oriented: We offer our people the opportunity to accelerate more rapidly than is possible
elsewhere. We will continue to drive the greater dimension length to identify and recruit the very
best person for every position. We perceive the importance of individual creativity, but we know
that a team effort produces the best results. The dedication of our people to the company and the
intense efforts they give to their work is vital to our continued success. Advancement depends
solely on ability, performance and contribution to the firm’s success with no discrimination of
race, colour, age, gender.

Client-focused: We are big enough to solve our clients’ problems, yet substantial enough to
sustain the loyalty, intimacy and culture that we all treasure and which contributes greatly to our
success. Our client’s interest always comes first. Our experience shows that if we treat our
clients well, our own success will pursue. We always seek aggressively to widen up, our client
relationships but we will never put down our competitors in this pursuit. Extensive Integrity in
everything we do Integrity and honesty are at the heart of our business. We expect our people to
maintain high ethical standards in everything they do, both in their work for the company and in
their personal lives. We regularly receive confidential information as part of our normal client
relationships. To breach a confidence or to use confidential information improperly or carelessly
is unthinkable. We protect the company’s intellectual property as though it were our own
personal property.

Innovative: Our assets are our people, technology, intellectual capital, culture of innovation and
reputation. If any of this is ever lost, the last is the most difficult to regain. We covet our culture
of innovation and as such we stress creativity and imagination in all our work. We are and will
continue to be thought leaders in our chosen industries. We take great honor in the professional

3
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

quality of our work. We have an uncompromising determination to achieve excellence in


everything we do. We would rather not pursue opportunities than deliver solutions that do not
represent the highest level of quality.

Quality Policy Statement: TECHNOLOGICS committed to providing the highest quality of


service to its customers, delivering advanced systems, solutions and services that benefit the
businesses, the industry and the society."

 To adhere to our quality policy, we use the following as our guidelines in daily operation:
 Total commitment towards customer satisfaction through service excellence.
 Strive for quality excellence in offered solutions and products.
 Offer timely and cost-effective solutions.
 Constant up-gradation of skills and technologies.
 Sensitivity to the needs of our customers, associates and society.

1.2 Boards and Directors

Technologics Global Private Limited is an unlisted private company incorporated on 08


November, 2016. It is classified as a private limited company and is located in Bangalore,
Karnataka. The company has 4 directors and no reported key management personnel. The
longest serving directors currently on board are Mohammed Haneef, Mohammed Fayaz,
Mohammed Shaifazam and Shanan Ummer who were appointed on 08 November, 2016.
They have been on the board for more than 6 years. Mohammed Haneef has the largest number
of other directorships with a seat at a total of 1 company. In total, the company is connected to 0
other companies through its directors.

1.3 Industry Verticals

4
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

We specialized in System integration, training and strategic outsourcing, bringing together the
expertise and capabilities of Technologies to help our clients achieve their organizational goals.
In simple terms, we find out what our clients want and use our people and technology to help
them get it as efficiently as possible.

Whether that is Industrial automation, HAS, BMS, or SCADA solutions, then, we’re the
company you should be talking to.

TECHNOLOGICS offers head on challenge in following vertical markets:

 Residential: Home automation (HAS), Energy and Utility and central monitoring &
Controls.
 Commercial: Lighting control system (LCS), Building automation (BMS), CCTV, FAS,
Utility& energy management (EMS), car park and CO-Monitoring, hotel room
management system
 Health care: Lighting control system (LCS), Building automation (BMS), Utility, energy
management (EMS), nurse call system and any sub system Integration.
 Educational: PLC, DCS, SCADA, VFD, HMI, HVAC controls, BMS, Lighting control
system (LCS), energy management (EMS).
 Industrial: PLC, DCS, SCADA, VFD, HMI BMS & EMS.
Integration Services include:

 Design and systems evaluation


 Management, engineering and technical development and support
 Quality assurance
 All Communication Equipment Hardware including recommendations and procurement
 Delivery coordination and Installation support
 Industry Standard Practices
 Project specific compliance
TECHNOLOGICS solutions are the result of in-house development and know-how, based on
standard software and hardware components, provided by leading international companies, by

5
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

implementing the newest technology, innovative solutions, and high-quality service we provide
our customers with:

 Efficient production management and control


 Increased production reliability
 Improved production efficiency
 Higher productivity
 Better quality control
 Lower energy consumption
 Lower production cost
 Lower energy consumption and costs
 Improved energy reliability
 Compliance with energy management standards (SIST EN 16001, IDO 50001, ISO
14001)

1.4 Company Products and Services


They offer a wide range of services, related to PLC, SCADA, IBMS & Embedded systems for
commercial, residential and Industrial sectors. They provide training and turnkey solutions in the
field of Industrial, automation, BMS, HAS, Facility Management software’s, Embedded,
Robotic, IT verticals with edge of competitive in quality & price to our valued customers in the
ground of sustainability. They are also master dealer & system integrator of multi brand
residential, commercial and Industrial automation products. Our focus and growth will be on the
technological outsourcing in the field of Industrial Automation, BMS, HVAC controls and other
related sub systems in the Middle East and Indian subcontinent.
Technologics Global Pvt Ltd started in the years 2016 are one of the
foremost Wholesaler and Service Provider of an extensive array of Organic Waste
Controller, Industrial Automation Control System and many more.
 Automation System
o Delta Automation Control System
o Industrial Automation Control System

6
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

o Flexible Automation System


 Training
o Corporate Training Workshops
o Industrial Automation Training and Internship
o Internship Industrial Training
 Scada Software
o SCADA Software Development
o Plc Scada HMI Software Development
 Training Services
o Robotics Design Services & Assembly
 Management Service
o Intelligent Building Management System
o Building Management Solution Service
o Energy Management Service
 Plc Panel
o Vfd And Plc Panel
o Plc Panel
 Mechanical Projects
o Online And Offline Mechanical and Electronics Engineering Final Year
Project
o Mechanical Project Works

Number Of Employees Working In An Organization Are:


Technologics Global Pvt Ltd Automation Machinery Manufacturing Bangalore, Karnataka 607
followers Diverse Technology Seamless Integrity Follow View all 35 employees

7
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

1.5 Industrial Projects & Association

Fig. 1.2 Industrial Projects and Association

8
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

CHAPTER 2
ABOUT THE DEPARTMENT

2.1 Trainings Offered by the Organization:

2.1.1 PLC SCADA Training  


Description:
Today’s highly increasing competitiveness over the industry demands high quality and most
consistent products with a competitive price. To address this challenge number of industries
considering various new product designs and integrated manufacturing techniques in parallel
with the use of automated devices.
Automation takes a step further mechanization that uses a particular machinery mechanism aided
human operators for performing a task. Mechanization is the manual operation of a task using
powered machinery that depends on human decision making.One of the remarkable and
influential moves for getting the solutions of above-mentioned challenge is the industrial
automation. Industrial Automation facilitates to increase the product quality, reliability and
production rate while reducing production and design cost by adopting new, innovative, and
integrated technologies and services.

Fig 2.1 PLC SCADA

9
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

2.1.2 Embedded System and IOT Training


Description:
A precise definition of embedded systems is not easy. Simply stated, all computing systems other
than general purpose computer (with monitor, keyboard, etc.) are embedded systems.

System is a way of working, organizing, or performing one or many tasks according to a fixed
set of rules, program or plan. In other words, an arrangement in which all units assemble and
work together according to a program or plan. An embedded system is a system that has software
embedded into hardware, which makes a system dedicated for an application (s) or specific part
of an application or product or part of a larger system. It processes a fixed set of pre-programmed
instructions to control electromechanical equipment which may be part of an even larger system
(not a computer with keyboard, display, etc.).

A general-purpose definition of embedded systems is that they are devices used to control,
monitor or assist the operation of equipment, machinery or plant. “Embedded” reflects the fact
that they are an integral part of the system. In many cases, their “embeddedness” may be such
that their presence is far from obvious to the casual observer.

Fig 2.2 Embedded systems and IoT

10
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

2.1.3 Building Management System Training


Description:
A Global Training leader in Building Automation System, Energy management solutions,
Technologics provides unique Training and services that optimize energy efficiency and comfort
in buildings, all the while reducing operating costs. Building System and Controls training offers
a comprehensive portfolio of technical courses to help you effectively monitor and coordinate
your HVAC equipment and systems.

Courses are designed by professional instructors in partnership with industry experts, product
engineers, technical support engineers, and product development teams. Using proven best
practices gained through decades of building controls experience, we provide practical, results-
oriented training tailored to your job.

Overview Of BMS:

The objective of Building Management Systems (BMS system) is to manage & control the sub-
systems within a building to ensure a pleasant, controlled and safe environment. A BMS can
control some of the following building equipment’s or operation like: HVAC, CCTV, Access
Control, Fire and Intruder Alarms, Lighting and even Power Consumption.

2.1.4 LabVIEW Training

Description:

LabVIEW is an integrated development environment designed specifically for engineers and


scientists building measurement and control systems. With a native graphical programming
language, built-in IP for data analysis and signal processing, and an open architecture that
enables integration of any hardware device and any software approach, LabVIEW is the software
you need to build the optimal solution that can meet your custom requirements and solve the
challenges at hand.

11
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

2.1.5 Operation and Maintenance Training:

The primary and overall objective of this course is to give a hands-on experience of Operations
& Maintenance

2.1.6 AI & ML Training:

Description:

Today’s highly increasing competitiveness over the industry demands high quality and most
consistent products with a competitive price. To address this challenge number of industries
considering various new product designs and integrated manufacturing techniques in parallel
with the use of automated devices.

Automation takes a step further mechanization that uses a particular machinery mechanism aided
human operators for performing a task. Mechanization is the manual operation of a task using
powered machinery that depends on human decision making.

One of the remarkable and influential moves for getting the solutions of above-mentioned
challenge is the industrial automation. Industrial Automation facilitates to increase the product
quality, reliability and production rate while reducing production and design cost by adopting
new, innovative, and integrated technologies and services.

Fig. 2.3 Artificial Intelligence

12
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

2.1.7 HVAC Training:

Description: Today’s highly increasing competitiveness over the industry demands high quality
and most consistent products with a competitive price. To address this challenge number of
industries considering various new product designs and integrated manufacturing techniques in
parallel with the use of automated devices.

Automation takes a step further mechanization that uses a particular machinery mechanism aided
human operators for performing a task. Mechanization is the manual operation of a task using
powered machinery that depends on human decision making.

One of the remarkable and influential moves for getting the solutions of above-mentioned
challenge is the industrial automation. Industrial Automation facilitates to increase the product
quality, reliability and production rate while reducing production and design cost by adopting
new, innovative, and integrated technologies and services.

2.1.8 OPC Training


Description:
This course covers the evolution of data connectivity from proprietary data connectivity and
custom protocol translation. The course also provides an overview of the OPC Specifications and
common use cases for applications that implement them.

This course provides managers, process control engineers, and operators with a solid background
around the basics of OPC the specifications, the applications, and their use cases. OPC
technology is used in a wide variety of industries such as oil & gas extraction and refining,
mining; pharmaceutical, food processing, discrete manufacturing, building automation, and
more. Professionals working either directly or in support of the process control environment will
benefit from this course.

2.1.9 Full Stack Software Testing

Description:

Today’s highly increasing competitiveness over the industry demands high quality and most

13
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Consistent products with a competitive price. To address this challenge number of industries
considering various new product designs and integrated manufacturing techniques in parallel
with the use of automated devices.

Automation takes a step further mechanization that uses a particular machinery mechanism aided
human operators for performing a task. Mechanization is the manual operation of a task using
powered machinery that depends on human decision making.

2.1.10 RPA Training

What are RPA and AI?

The application of technology that enables computer software to partially or fully automate
human activities which are manual, repetitive and rule-based.

RPA gives a company the ability to map out a business process that is definable, repeatable and
rules-based and assign a software “robot” to manage the execution of that process.

Courses are designed by professional instructors in partnership with industry experts, product
engineers, technical support engineers, and product development teams. Using proven best
practices gained through decades of building controls experience, we provide practical, results-
oriented training tailored to your job.

Robotic process automation (RPA) is the application of technology that allows employees in a
company to configure computer software or a “robot” to capture and interpret existing
applications for processing a transaction, manipulating data, triggering responses and
communicating with other digital systems.

2.2 Top trends of embedded systems for IoT 


As we are progressing every day, more and more ideas are surfing up. Technology itself has
become a crucial part of a person’s day-to-day life.
From setting alarms to brushing our teeth with the newly developed electronic brushes to using
microwave, television, iron and so on. We are all engulfed in the ever-expanding blanket of
technologies.

14
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Talking about embedded systems, it gets the spotlight due to its application-orientated outcomes
and focusing areas of development.

2.2.1 Trends of embedded systems include:


1- Automation everywhere
2- System-on-Chip solution
3- IoT security
4- Healthcare
5- Automobile

2.2.2 Trends of IoT:


In a survey done by SAFT BATTERIES, employee productivity will increase by 50%,
consistency and reliability will increase by 42%. After the implementation of the IoT trends,
34% have seen an increase in revenue, and 24% have seen an average increase in already
existing revenue streams.

Collectively, 82% have seen the rise in revenue and market share prices by 81% by
implementing the trends of IoT.

After the implementation, IoT has enabled over 55% of businesses to decrease their operating
costs by 21%. As a result, 39% of IoT adopters say IoT allows greater flexibility when
supporting their custom.

15
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

CHAPTER 3

TASKS PERFORMED

3.1 Lecture-Discussion

3.1.1 Introduction to Embedded Systems

An embedded system is a computer system designed to perform a specific task, with dedicated
hardware and software, embedded in a larger device or system. These systems are designed to be
highly reliable, often with real-time constraints and low power consumption. They can be found
in a wide range of applications, from simple household appliances to complex industrial
automation systems, medical equipment, and automotive control systems.
Embedded systems typically consist of a microcontroller or microprocessor, memory,
input/output (I/O) interfaces, and other peripheral devices. The software is usually written in
low-level programming languages, such as assembly language or C, to maximize performance
and minimize memory usage.
The development process for embedded systems can be challenging, as designers must balance
the system's performance requirements with the limitations of the hardware and the available
resources. The system's reliability, safety, and security are also critical factors that must be
considered.
Embedded systems play an essential role in our modern world, providing the intelligence and
control necessary for many of the devices and systems we rely on every day.
Embedded systems are used in a wide variety of industries and applications, including:
Consumer electronics, Automotive, Industrial automation, medical devices, Aerospace.
The development of embedded systems involves a range of disciplines, including electrical
engineering, computer engineering, software engineering, and mechanical engineering.

16
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Designers must carefully consider the requirements of the system, including power consumption,
processing speed, memory size, and input/output interfaces, in order to create an efficient and
effective solution.

Embedded systems can be programmed using a range of programming languages, including C,


C++, assembly language, and Python. The choice of language depends on the application, the
hardware used, and the performance requirements. Overall, embedded systems are critical
components in many of the devices and systems we rely on every day. Their reliability,
efficiency, and effectiveness are essential to ensure the safe and successful operation of many
modern technologies.

A) Applications of Embedded System

Embedded systems are widely used in a variety of applications across many industries. Some
examples of applications of embedded systems include:
 Automotive industry: Embedded systems are used in cars for engine management, safety
systems, infotainment systems, and other functions.
 Home automation: Smart home devices such as thermostats, security systems, and smart
lighting systems use embedded systems for control and automation.
 Medical devices: Embedded systems are used in medical equipment such as heart
monitors, pacemakers, and insulin pumps.
 Industrial automation: Embedded systems are used in industrial automation systems to
control and monitor machinery, assembly lines, and other systems.
 Aerospace: Embedded systems are used in aircraft and spacecraft for navigation,
communication, and control.
 Consumer electronics: Devices such as smartphones, digital cameras, and smart TVs all
use embedded systems.
 Robotics: Embedded systems are used in robotics for control and automation, allowing
robots to perform complex tasks.
 Military and defense: Embedded systems are used in military and defense applications,
such as control systems for unmanned vehicles and weapons systems.

17
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 Energy management: Embedded systems are used in smart grids to monitor and control
the distribution of energy.
 Agricultural industry: Embedded systems are used in precision farming systems for
monitoring and controlling irrigation, fertilization, and other processes.
3.1.2 Introduction to IoT

IoT, or the Internet of Things, refers to the interconnection of physical devices, vehicles,
buildings, and other items embedded with sensors, software, and network connectivity. This
allows these devices to collect and exchange data, providing useful information and enabling
new applications and services.
The concept of IoT has been around for several decades, but recent advancements in technology
such as low-cost sensors, wireless connectivity, and cloud computing have made it more
practical and accessible. With IoT, devices can communicate with each other and with humans,
making it possible to monitor and control a wide range of systems and processes in real-time.
IoT has numerous applications across many industries, including smart homes, wearables,
healthcare, transportation, agriculture, and manufacturing. IoT can also be used to optimize
energy usage, improve public safety, enhance customer experiences, and enable new business
models.
However, IoT also presents some challenges, such as security and privacy concerns,
interoperability, and data management. As IoT continues to evolve, it will require a
multidisciplinary approach involving technology, policy, and society to ensure its full potential is
realized while minimizing any negative impacts.
The Internet of Things (IoT), also sometimes referred to as the Internet of Everything (IoE),
consists of all the web-enabled devices that collect, send and act on data they acquire from their
surrounding environments using embedded sensors, processors, and communication hardware.
These devices, often called "connected" or "smart" devices, can sometimes talk to other related
devices, a process called machine-to-machine (M2M) communication, and act on the
information they get from one another. Humans can interact with the gadgets to set them up, give
them instructions or access the data, but the devices do most of the work on their own without
human intervention. Their existence has been made possible by all the tiny mobile components

18
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

that are available these days, as well as the always- online nature of our home and business
networks.

A) Applications of IoT
IoT (Internet of Things) has many applications across various industries and fields. Some
common applications of IoT include:
 Smart Home: IoT technology can be used to control and automate various devices and
appliances in a home, such as lights, thermostats, security systems, and entertainment
systems.
 Healthcare: IoT devices such as wearables, sensors, and monitors can be used to collect
and analyze patient data, improve patient care and outcomes, and support remote patient
monitoring.
 Agriculture: IoT technology can be used in agriculture to monitor crop growth, soil
moisture levels, and weather conditions, which can help farmers optimize crop yield and
minimize waste.
 Manufacturing: IoT devices can be used to monitor and optimize factory operations,
track inventory, and improve supply chain management.
 Transportation: IoT technology can be used in transportation to track vehicle location,
monitor driver behavior, and improve traffic flow.
 Energy Management: IoT devices can be used to monitor and control energy usage in
homes and buildings, helping to reduce energy waste and lower utility costs.
 Smart Cities: IoT technology can be used to manage and optimize city infrastructure,
including traffic lights, waste management, and public transportation. Overall, the
applications of IoT are diverse and constantly evolving as new technologies emerge and
businesses and organizations find new ways to leverage the power of connected devices
and data.

19
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

3.1.3 Arduino Uno

Fig: 3.1 Arduino Uno

Arduino Uno is an open-source microcontroller board based on the ATmega328P


microcontroller. It has 14 digital input/output pins, 6 analog input pins, and is capable of
providing up to 20 mA of current per pin. It also has a USB interface for programming and
power, as well as an ICSP header for programming with an external programmer. The Arduino
Uno is a popular choice for hobbyists, students, and professionals due to its ease of use, low cost,
and versatility. It can be programmed using the Arduino software, which uses the C++
programming language with a simplified syntax. With the Arduino Uno, you can create a wide
range of projects such as robots, home automation systems, and wearable devices.

20
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

A) Components of Arduino Uno


The Arduino Uno is a popular microcontroller board used in many embedded systems projects. It
is based on the Atmel Atmega328P microcontroller and comes with a variety of components and
specifications, including:
 Microcontroller: The Arduino Uno is built around the Atmel Atmega328P
microcontroller, which has 32KB of flash memory for storing code and 2KB of SRAM
for data storage.
 Clock Speed: The microcontroller on the Arduino Uno runs at 16 MHz • Digital
Input/output Pins: The Arduino Uno has 14 digital input/output pins, which can be used
for connecting to sensors, actuators, and other devices. These pins can be configured as
either input or output, and they operate at 5 volts.
 Analog Input Pins: The Arduino Uno has 6 analog input pins, which can be used for
measuring voltage levels from sensors and other analog devices.
 PWM Pins: The Arduino Uno has 6 PWM (Pulse Width Modulation) pins, which can be
used to control the speed of motors and the brightness of LEDs.
 Power Supply: The Arduino Uno can be powered by either a USB cable or an external
power supply. It has a voltage regulator that can accept input voltages between 7 and 12
volts.
 Programming Interface: The Arduino Uno can be programmed using the Arduino
Integrated Development Environment (IDE), which is a software platform for writing,
compiling, and uploading code to the microcontroller.
 Other Features: The Arduino Uno also has a reset button, a serial communication
interface for connecting to other devices, and an LED that can be used for debugging.

21
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.2 Arduino Uno components


B) Arduino Uno Pinout
 Digital I/O Pins (0-13): These pins can be used for both digital input and output. They
operate at 5 volts and can source or sink up to 20 mA of current.
 Analog Input Pins (A0-A5): These pins are used for analog input, which allows the
Arduino to read voltage levels from sensors and other analog devices. They operate at 5
volts and have a resolution of 10 bits.
 PWM Pins (3, 5, 6, 9, 10, and 11): These pins are used for Pulse Width Modulation,
which allows the Arduino to control the speed of motors and the brightness of LEDs.
 Power Pins: The Arduino Uno has several power pins, including 5V, 3.3V, and GND.
These pins are used for providing power to external devices and for connecting to power
sources.
 Reset Pin: This pin is used for resetting the Arduino.
 ICSP Header: This header is used for programming the Arduino using an In-Circuit
Serial Programming (ICSP) programmer.
 UART Pins (0 and 1): These pins are used for serial communication, which allows the
Arduino to communicate with other devices such as computers and Bluetooth modules.

22
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.3 Arduino Uno Pinout

C) How to program Arduino Uno


Programming the Arduino Uno involves writing code in a language called Arduino
programming language, which is based on C++ programming language, and then uploading it to
the microcontroller on the board. Here are the basic steps for programming the Arduino Uno:
 Download and install the Arduino IDE: The first step is to download and install the
Arduino Integrated Development Environment (IDE), which is available for free from the
Arduino website. The IDE is a software platform that allows you to write, compile, and
upload code to the microcontroller on the Arduino Uno.
 Connect the Arduino Uno to your computer: Connect your Arduino Uno to your
computer using a USB cable. The Arduino Uno will be recognized as a serial port by
your computer.
 Open the Arduino IDE and select the Board and Port: Open the Arduino IDE and
select the board you are using from the "Tools" menu. In this case, select "Arduino
Uno". Then select the serial port that the Arduino Uno is connected to from the same
"Tools" menu.

23
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 Write the Code: In the Arduino IDE, write your code using the Arduino programming
language. You can use the examples provided in the IDE or write your own code.
 Verify and Upload the Code: After writing the code, click on the "Verify" button to
compile the code and check for errors. If there are no errors, click on the "Upload" button
to upload the code to the microcontroller on the Arduino Uno. You will see the progress
in the status bar at the bottom of the IDE.
 Test the Program: Once the code is uploaded, you can test your program by connecting
your sensors, actuators, or other devices to the appropriate pins on the Arduino Uno.
Then, open the Serial Monitor in the Arduino IDE to view the output of your program.

3.1.4 ESP32

24
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.4 ESP32

ESP32 is a popular microcontroller board based on the ESP32 system-on-chip (SoC) from
Espressif Systems. It is a powerful and versatile board that is widely used in the Internet of
Things (IoT) applications due to its high processing power, low power consumption, built-in Wi-
Fi and Bluetooth connectivity, and support for a wide range of peripherals.

Some of the key features of the ESP32 include:

 Dual-core processor: the ESP32 features two Tensilica Xtensa LX6 32-bit
microprocessor running at up to 240 MHz.
 Wi-Fi and Bluetooth connectivity: The ESP32 features built-in Wi-Fi and Bluetooth
connectivity, making it easy to connect to the internet and other devices.
 Low power consumption: The ESP32 is designed to consume very little power, making it
suitable for battery-powered applications.
 GPIO pins: The ESP32 has many General-Purpose Input/output (GPIO) pins that can be
used to interface with a wide range of sensors, actuators, and other components.
 Analog-to-digital converter (ADC): The ESP32 has a built-in ADC that can be used to
measure analog signals from sensors.
 Pulse-width modulation (PWM): The ESP32 has built-in PWM generators that can be
used to control the brightness of LEDs, the speed of motors, and other parameters.
 I2C, SPI, and UART interfaces: The ESP32 supports popular communication protocols
such as I2C, SPI, and UART, making it easy to interface with other devices.

The ESP32 can be programmed using the Arduino IDE or using Espressif’s native development
environment, ESP-IDF. It is widely used in a variety of applications, including home automation,
industrial automation, robotics, and smart energy.

A) COMPONENTS AND SPECIFICATION OF ESP32


Here are the main components and specifications of the ESP32:

25
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 ESP32 SoC: The ESP32 system-on-chip (SoC) is the main component of the board. It
contains two Tensilica Xtensa LX6 32-bit microprocessors running at up to 240 MHz,
along with built-in Wi-Fi, Bluetooth, and other peripherals.
 Flash memory: The ESP32 comes with up to 16 MB of flash memory for program
storage and data logging.
 RAM: The ESP32 has up to 520 KB of SRAM for program execution and data storage.
 GPIO pins: The ESP32 has up to 36 GPIO pins that can be used for digital input/output,
analog input, PWM, and other purposes.
 ADC: The ESP32 has a 12-bit SAR ADC that can measure up to 18 channels with a
resolution of up to 4096 steps.
 DAC: The ESP32 has two 8-bit DACs that can be used to generate analog output signals.
 Communication interfaces: The ESP32 supports various communication interfaces,
including SPI, I2C, UART, and CAN.
 Wi-Fi: The ESP32 supports 802.11 b/g/n Wi-Fi with a built-in antenna.
 Bluetooth: The ESP32 supports Bluetooth Low Energy (BLE) with a built-in antenna.
 Power supply: The ESP32 can be powered using a USB cable or an external power
supply with a voltage range of 5V to 12V.
 Dimensions: The ESP32 board is typically about 2.7 inches (68.6 mm) long and 1.7
inches (43.2 mm) wide.

B) ESP32 Pinout

26
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.5 ESP32 Pinout

 VIN: This pin is used to supply power to the board. It can accept a voltage range of 5V to
12V, which is regulated down to 3.3V by the board's voltage regulator.
 GND: These pins are connected to ground.
 IO34 - IO39: These pins are general purpose input/output (GPIO) pins that can be used
for a variety of purposes, such as digital input/output, analog input, PWM, and more.
 EN: This pin is used to enable or disable the ESP32. When this pin is pulled high
(connected to 3.3V), the ESP32 is enabled and can run. When it is pulled low or left
floating, the ESP32 is disabled.
 IO21 - IO27: These pins are also GPIO pins, and can be used for various purposes.
 IO5 and IO4: These pins are used for I2C communication, which is a popular protocol for
connecting sensors and other devices to microcontrollers.
 IO23, IO19, and IO18: These pins are used for SPI communication, which is another
common protocol for connecting devices to microcontrollers.
 RX0 and TX0: These pins are used for serial communication, which is a common way to
communicate with the ESP32 from a computer or other device.
C) How to program ESP32
 Install the Arduino IDE: The Arduino IDE is a popular software tool that can be used to
program the ESP32. You can download it from the official Arduino website and install it
on your computer.
 Install the ESP32 board definitions: In order to program the ESP32 with the Arduino
IDE, you will need to install the board definitions. You can do this by following the steps
outlined in the official ESP32 installation guide.
 Connect the ESP32 to your computer: You will need to connect the ESP32 to your
computer using a USB cable. Make sure that the correct driver is installed on your
computer so that it can recognize the ESP32.
 Choose the correct board and port in the Arduino IDE: Once you have installed the

27
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

board definitions and connected the ESP32 to your computer, you will need to select the
correct board and serial port in the Arduino IDE. You can do this by going to the Tools
menu and selecting the appropriate options.
 Write and upload your code: Finally, you can write your code in the Arduino IDE and
upload it to the ESP32 by clicking on the Upload button. The code will be compiled and
uploaded to the ESP32, where it will be executed.

3.1.5 Wokwi Simulator


Wokwi is an online Electronics simulator. You can use it to simulate Arduino, ESP32, and many
other popular boards, parts and sensors.

Why Wokwi?

 Start right now: No waiting for components, or downloading large software.Your


browser has everything you need to start coding your next IoT project in seconds.
 Mistakes are okay: You can't destroy the virtual hardware. Trust us, we tried. So don't
worry about frying your precious components. And unlike real hardware, you can always
undo.
 Easy to get help and feedback: Sharing a link to your Wok Wi project is all you need.
 Gain confidence in your code: Separate hardware and software issues.
 Unlimited hardware: No need to scavenge parts from old projects. Use as many parts as
you need, without worrying about project price and stock.
 Maker-friendly community: A place for you to share your projects, ask for help, and get
inspiration.

Unique Features of Wok Wi Simulator are,

 Wi-fi simulation - Connect your simulated project to the internet. You can use MQTT,
HTTP, NTP, and many other network protocols.
 Virtual Logic Analyzer - Capture digital signals in your simulation (e.g. UART, I2C,
SPI) and analyze them on your computer.
 Advanced debugging with GDB - Powerful Arduino and Raspberry Pi Pico debugger

28
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

for advanced users.


 SD card simulation - Store and retrieve files and directories from your code.
 Chips API - Create your own custom chips and parts, and share them with the
community.
 Visual Studio Code integration - Simulate your embedded projects directly from VS
Code.

3.2 Practical Session

3.2.1 Simple Programs executed using Wokwi Simulator

1. Blink A Led on Using Esp32:

Fig: 3.6 Interfacing LED with ESP32

29
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

The ESP32 is an advanced Iot microcontroller board possessing Wi-Fi and Bluetooth Low
Energy capabilities, as well as limited compatibility with the Arduino Core. This is the first
module in a series of tutorials regarding the use of the ESP32 Development Board, from its
equivalent Arduino projects to advanced IoT projects.

The 'Blinking an LED' project uses the ESP32 Development Board will be used to blink an LED
at a specific timed interval, infinitely. It is the essential fundamental tutorial for any
microcontroller board, as it is the hardware equivalent of the classic "Hello World" tutorial!!!

#define LED 2

void setup() {
  pinMode(LED, OUTPUT);
}
void loop () {
  digitalWrite (LED, HIGH);
  delay(500);
  digitalWrite (LED, LOW);
  delay(500);
}

2. Dht22 on The Esp32 (Digital Humidity and Temperature sensor):

Fig: 3.7 Interfacing DHT22 with ESP32

30
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

This project employs the ESP32 as the control device, which connects to an existing Wi-Fi
network and creates a Web Server. When a device connects to this web server, the ESP32 will
read the temperature and relative humidity from the DHT11/DHT22 sensor and send it to the
device’s web browser with a nice interface.

Code for DHT22 on the ESP32:

#include "DHTesp.h"

const int DHT_PIN = 15;

DHTesp dhtSensor;

void setup() {

  Serial.begin(115200);

  dhtSensor.setup(DHT_PIN, DHTesp::DHT22);

void loop() {

  TempAndHumidity  data = dhtSensor.getTempAndHumidity();

  Serial.println("Temp: " + String(data.temperature, 2) + "°C");

  Serial.println("Humidity: " + String(data.humidity, 1) + "%");

  Serial.println("---");

  delay(1000);

3. Arduino Keypad

31
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.8 Arduino Keypad


There are numerous ways for users to make inputs in Arduino-based projects. You can choose
from simple input methods, like momentary push buttons, to more elaborate approaches. This
article discusses keypads, which are a more advanced method to allow users to interact with an
Arduino. It explains how to connect a small keyboard to an Arduino, how the keypad functions
in theory, and how you can implement that theory in software.

Simple keypads and keyboards without a dedicated controller typically work in an easy-to-
understand way. You can divide the keypad into rows and columns.

Note how the buttons sit exactly where the rows and columns meet. The Arduino, or any other
microcontroller, sends a quick pulse to each line, one row at a time. In this article, the Arduino
pulls the input lines low for a short period. It then checks whether any of the columns transitions
to a low state as well. If that happens, the Arduino registers a button press. Suppose that a user
presses the five-key on the keypad. The Arduino pulls each of the yellow input lines low. When
it reaches the second yellow line, it detects that reading the second column returns a low state.
That happens because someone pushes a button. Each button connects a row and a column, just
like an ordinary switch.

Code for Arduino Keypad:

#include <Keypad.h>

const uint8_t ROWS = 4;

const uint8_t COLS = 4;

32
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

char keys[ROWS][COLS] = {
  { '1', '2', '3', 'A' },
  { '4', '5', '6', 'B' },
  { '7', '8', '9', 'C' },
  { '*', '0', '#', 'D' }
};
uint8_t colPins[COLS] = { 5, 4, 3, 2 }; // Pins connected to C1, C2, C3, C4
uint8_t rowPins[ROWS] = { 9, 8, 7, 6 }; // Pins connected to R1, R2, R3, R4
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
  Serial.begin(9600);
}

void loop() {
  char key = keypad.getKey();
if (key != NO_KEY) {
    Serial.println(key);
 }
}
4. Flame sensor on the ESP32

33
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig 3.9: Interfacing of the flame sensor with ESP32

Flame Sensor with ESP32 is a type of flame detection system that uses an ESP32 microcontroller
to process and analyze data from sensors, and to communicate with other devices using Wi-Fi.
The ESP32 can be used to connect the system to a network, allowing it to be remotely monitored
and controlled.

Code for Flame Sensor Using ESP32:


const int flamePin = 15;
const int ledPin = 2;
void setup() {
pinMode (flamePin, INPUT);
pinMode (ledPin,OUTPUT);
Serial.begin(9600);
}
void loop(){
int flameValue = analogRead(flamePin);
Serial.println(flameValue);
if (flameValue>200 ){
digitalWrite(ledPin,LOW);
Serial.println(“No flame detected.”);
}
delay(100);
}

5) Gas Sensor on the ESP32

34
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig 3.10 Circuit diagram of Gas Sensor

Gas sensor is used to detect the presence of gas in a specific area. These sensors can be
connected to the internet, allowing for remote monitoring and alerts to be sent to a control center
or to a specific person’s device. The system can also be set up to automatically shut off gas
valves or perform other safety actions in the event of a leak.

Code for Gas Sensor on ESP32


const int gasPin =32;
const int ledPin =2;
void setup(){
pinMode (gasPin,INPUT);
pinMode(ledPin,OUTPUT);
Serial.begin(9600);
}
void loop() {
int gas Value = analogRead(gasPin);
Serial.println(gasValue);
if (gasValue >200) {
digitalWrite(ledPin,HIGH);

35
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Serial.println(“High gas level detected!”);


}
else{
digitalWrite(ledPin,LOW);
Serial.println(“gas level is normal.”);
}
delay(100);
}

3.2.2 MQTT Box

MQTT Box is a helper program to develop and load test MQTT based clients, brokers, devices,
cloud, and apps. Every aspect of MQTTBox is specifically designed to maximize development
and testing productivity. Together, with MQTT clients and load testing tools integrated, its
powerful enough to supercharge your MQTT workflow.

A) Usage/Features

MQTT Clients
 Add multiple MQTT clients with TCP and WebSocket’s connection support
 Connect with wide range of MQTT client connection settings
 Publish/Subscribe to multiple topics
 Supports Single Level (+) and Multilevel (#) subscription to topics
 Copy/Republish payload
 History of published/subscribed messages for each topic
 Auto connect clients to brokers
 Supports QoS 0,1,2

MQTT Load

 to increase load
 Load test by publishing messages with QoS 0,1,2

36
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 Load test by publishing different payload in same test case


 Load test by subscribing to messages with QoS 0,1,2
 View live status of load testing on dashboard
 View load test results for all/each instance on graphs plotted vs time
 View load data for all/each instance in tables with smart search
 Track time to millisecond units
 Load test result history

A) Navigation

Below screenshot shows navigation between MQTT clients and MQTT Load test cases.

37
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.11 Navigation between MQTT clients and MQTT Load test cases

B) MQTT Client
You can add multiple MQTT clients each with multiple publishers and subscribers.

38
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.12 MQTT clients each with multiple publishers and subscribers

C) MQTT Load Dashboard

View live data on MQTT Load dashboard when test in progress. You can start, stop or restart

39
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

load test along with viewing graphs and data for each or all instances.

Fig: 3.13 MQTT Load Dashboard

3.2.3 MIT App Inventor

App Inventor is a visual, blocks-based programming language and online platform for creating
mobile apps for Android devices. It was developed by MIT’s Media Lab and is now maintained
by the Massachusetts Institute of Technology (MIT). It allows users with little or no
programming experience to create their own mobile apps by dragging and dropping visual blocks
that represent programming concepts. App Inventor is also open-source, which means that
anyone can access, modify, and distribute the software. It is intended to help educators and
students learn programming and is widely used in classrooms and educational institutions.
It is possible to create an SMS application using App Inventor. To do this, you would first
need to design the user interface of the SMS application using the built-in components such as
Buttons, Textboxes, and PhoneNumberPicker. You would then need to create event handlers for
the various buttons and components using blocks. To create the interface, you can use a Phone
Number Picker component, which allows users to select a recipient from their device’s contact

40
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

list, a Textbox for the message and a Button to trigger the sending of the message. You can also
add additional components such as a Label to show the character count, or a button to clear the
message. Once the interface is set, you can proceed to set up the event handlers to make the SMS
application functional. For example, when the user presses the “Send” button, an event handler
would be triggered that would gather the information entered in the Textbox and
PhoneNumberPicker component, and use the built-in SMS component to send the message to the
selected recipient.
Additionally, the user will be prompted with a confirmation message before sending the SMS,
this is a security measure to prevent accidental sending of messages.
We will create an application named ‘SMS’ with App Inventor that sends an SMS from a mobile
application to a phone number.

Fig: 3.14 MIT App in phone

Programming the SMS Application

41
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

To program the application, App Inventor proposes to use The Space Blocks which allows to
create a program in the form of a block diagram. Very simple to use but requiring some
programming logic.
Here is the SMS program realized in the Blocks area of the Inventor App:

Fig 3.15: SMS program realized in blocks area of the inventor app

3.3 Project
To create a device that can track the price of Bitcoin in real-time and display it on an ESP32
board. The device should be able to connect to the internet using Wi-Fi and fetch the latest
Bitcoin price data from an online API. The device should be able to display the current Bitcoin
price on a screen attached to the ESP32 board. The user should be able to configure the device to
update the Bitcoin price at a specific interval. The device should also be able to alert the user
when the Bitcoin price crosses a certain threshold set by the user.

Steps involved in solving the problem statement:


1. Gather requirements: The first step is to gather all the requirements for the Bitcoin
tracker, including the features, functionality, and design. This will help in developing a
clear understanding of what needs to be done and what the final product should look like.
2. Choose the hardware: The next step is to choose the appropriate hardware for the project.
In this case, the ESP32 board will be used as it is cost-effective and has built-in Wi-Fi
capabilities. A screen and a battery will also be required.
3. Set up the development environment: Set up the development environment by installing
the required software and libraries to work with the ESP32 board. Arduino IDE is a
popular choice for programming the ESP32 board.

42
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

4. Connect to the internet: Connect the ESP32 board to the internet using Wi-Fi. This will
allow the device to fetch the latest Bitcoin price data from an online API.
5. Fetch the Bitcoin price data: Use an online Bitcoin API to fetch the latest Bitcoin price
data. The API should be able to provide the data in a format that can be easily parsed by
the ESP32 board.
6. Display the Bitcoin price: Display the Bitcoin price on the screen attached to the ESP32
board. The screen can be an OLED or LCD display, and the price can be displayed in text
or using a graphical representation
7. Configure the update interval: Allow the user to configure the device to update the
Bitcoin price at a specific interval. This can be done using a button or a menu system.
8. Set price alerts: Allow the user to set price alerts, so that they can be notified when the
Bitcoin price crosses a certain threshold set by the user. This can be done using an alarm
or notification system.
9. Test and refine: Test the device thoroughly to ensure that it works as expected. Refine the
code and design as necessary to improve the performance and user experience.
10. Deploy and maintain: Deploy the device and provide instructions on how to use it.
Maintain the device by updating the software and firmware as necessary to keep it up-to-
date with the latest Bitcoin price data and any changes in the API.

3.3.1 Methodology:
Block Diagram

ESP32 API OLED LED

Fig: 3.16 Block diagram of Bitcoin Tracker

43
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 Choose a Bitcoin API: The first step is to choose a Bitcoin API that provides real-time
data on Bitcoin prices. You can use APIs such as Coinbase, Kraken, or Bitstamp.

 Connect ESP32 to Wi-Fi: Connect the ESP32 to Wi-Fi, so it can access the Internet and
fetch the Bitcoin data from the API. You can use the Arduino IDE to program the ESP32
to connect to Wi-Fi.

 Fetch Bitcoin data: Use the API to fetch the Bitcoin data, such as the current prices, and
other relevant information.

 Display the data: You can use an OLED display or a simple LCD screen to display the
Bitcoin data fetched by the ESP32. You can also use LEDs or buzzers to create visual or
audio alerts based on certain price thresholds.

 Implement error handling: In case the API connection fails or the Wi-Fi connection
drops, implement error handling to ensure the ESP32 can recover and continue to fetch
data.

 Secure the connection: To ensure the security of the Bitcoin tracker, you can use
SSL/TLS to encrypt the communication between the ESP32 and the Bitcoin API.

Overall, building a Bitcoin tracker using an ESP32 requires knowledge of programming, Wi-Fi
connectivity, and working with APIs. However, it can be a great way to learn about IoT devices
and their applications.

3.3.2 Hardware and Software requirements


Hardware requirements are as follows:
1. ESP32 Board

44
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

ESP32 is a series of low-cost, low-power system-on-a-chip micro-controllers designed


by Espressif in Shanghai, China. It has integrated Wi-Fi and dual-mode Bluetooth radios. It
has many of the capabilities of the Arduino and can be programmed with the Arduino IDE
software and so is an easy upgrade path to wireless communications for Arduino users.

The ESP32 supports many peripherals such as: capacitive touch, ADC, DAC, I2C, SPI, UART,
I2S, PWM. It is appropriate for Internet of Things Projects and enables Bluetooth
communications for Smartphone applications.

Fig: 3.17 ESP32 Board

This key studio ESP32 core board is a Mini development board based on the ESP-WROOM-32
module. The board has brought out most I/O ports to pin headers of 2.54mm pitch. These
provide an easy way of connecting peripherals according to your own needs. When it comes to
developing and debugging with the development board, the both side standard pin headers can
make your operation simpler and handier. The ESP-WROOM-32 module is the industry's

45
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

leading integrated Wi-Fi + Bluetooth solution with less than 10 external components. It
integrates antenna switch, RF balun, power amplifiers, low noise amplifiers, filters and power
management modules. At the same time, it also integrates with TSMC's low-power 40nm
technology, so that power performance and RF performance.

A) Technical Details

• Microcontroller: ESP-WROOM-32 module


• USB to Serial Port Chip: CP2102-GMR
• Operating Voltage: DC 5V
• Operating Current: 80mA (average)
• Current Supply: 500mA (Minimum)
• Operating Temperature Range: -40? ~ +85?
• Wi-Fi mode: Station/SoftAP/SoftAP+Station/P2P
• Wi-Fi protocol: 802.11 b/g/n/e/i (802.11n, speed up to 150 Mbps
• Wi-Fi frequency range: 2.4 GHz ~ 2.5 GHz
• Bluetooth protocol: conform to Bluetooth v4.2 BR/EDR and BLE standards
• Dimensions: 55mm*26mm*13mm
• Weight: 9.3g

2. OLED
I2C OLED refers to an OLED display that communicates using the I2C protocol. OLED stands
for Organic Light-Emitting Diode, which is a type of display technology that does not require a
backlight to produce light. I2C, on the other hand, is a communication protocol that allows
multiple devices to communicate with each other using a single set of wires.
When an OLED display is connected to a microcontroller or a computer using the I2C protocol,
it can receive commands and data to display images and text. I2C OLED displays are popular in
many embedded systems and hobbyist projects because of their small size, low power
consumption, and ease of use.

46
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

I2C OLED displays come in different sizes and resolutions, and can display different colors
depending on the model. They are commonly used in wearable devices, IoT devices, and other
projects that require a small and low-power display.

Fig: 3.18 I2C OLED Display


A) Description
The technical specifications of I2C OLED displays can vary depending on the manufacturer and
the specific model, but here are some common specifications:
• Communication protocol: I2C
• Resolution: varies depending on the model, common resolutions include 128x64, 128x32,
and 64x48 pixels
• Display size: varies depending on the model, common sizes include 0.96-inch, 1.3 inch,
and 0.91 inch diagonally
• Color: some I2C OLED displays are monochrome (usually white or blue), while others
can display multiple colors (usually red, green, and blue)
• Viewing angle: typically, around 160 degrees
• Operating voltage: usually around 3.3-5V
• Operating current: varies depending on the model and brightness level, but typically
ranges from a few mA to around 20mA

47
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

• Operating temperature range: typically, around -30°C to +70°C

3. Resistors
A 560-ohm resistor is an electronic component that provides 560 ohms of resistance to the flow
of electric current. It is a passive component that is commonly used in electronic circuits to limit
the current flowing through LEDs or to set the bias of transistors.

A 560-ohm resistor is a relatively low value resistor and can be used in circuits with a voltage
range of typically 5V or less. It is available in a variety of package sizes and types, including
axial, surface mount, carbon film, and metal film.

When selecting a resistor for a specific application, it's important to consider factors such as the
power rating, tolerance, and temperature coefficient. The power rating of a 560 ohm resistor
determines how much power it can safely dissipate without overheating, while the tolerance
determines how close the actual resistance value is to the stated value. The temperature
coefficient indicates how the resistance of the resistor will change with temperature changes in
the environment.

Fig: 3.19 560ohm Resistor

48
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

A) Technical specifications
• Resistance value: 560 ohms (±5% tolerance is common, but other tolerances are
available)
• Power rating: typically, 1/4 Watt, but other power ratings may be available
• Maximum working voltage: depends on the power rating and environment, but typically
around 200V or less
• Temperature coefficient: the resistance value of a resistor changes with temperature, and
the temperature coefficient (usually expressed in ppm/°C) indicates how much it will
change over a given temperature range.
• Operating temperature range: depends on the type of resistor, but most used resistors
have an operating temperature range of -55°C to +125°C.

4) LED
A 5mm LED (Light Emitting Diode) is a type of LED that has a diameter of 5mm. LEDs are
semiconductor devices that emit light when an electric current is passed through them in the
forward direction. They are commonly used in a wide range of electronic applications such as
indicators, displays, and lighting.
5mm LEDs are available in various colors such as red, green, blue, yellow, white, and multi-
color. They have a voltage rating of around 1.8 to 3.5 volts and can be operated at current levels
ranging from a few milliamps to tens of milliamps.
They are also available in different brightness levels, and their brightness is measured in
millicandela (mcd) or lumens (lm) depending on the application. High-brightness 5mm LEDs are
commonly used for lighting applications, while lower brightness ones are used as indicators and

49
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.20 5mm LED


A) Technical specifications
Here are some technical specifications of a 5mm LED:

 Diameter: 5mm
 Operating Voltage: 1.8V to 3.5V (typical)
 Operating Current: 10mA to 30mA (typical)
 Power Consumption: 50mW to 100mW (typical)
 Luminous Flux: 2lm to 10lm (typical)
 Viewing Angle: 30 degrees to 120 degrees (typical)
 Operating Temperature: -40°C to 85°C
 Storage Temperature: -40°C to 100°C
 Lifetime: 50,000 hours (typical)

Software Requirements are:


1) Arduino Ide
Arduino IDE (Integrated Development Environment) is an open-source software platform used
for programming and developing applications for Arduino boards. The IDE is available for
Windows, Mac OS X, and Linux operating systems.

50
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Arduino boards are microcontroller-based development boards that can be programmed to


perform a variety of functions, such as sensing input from sensors, controlling motors, and
interacting with other devices via serial communication. The Arduino IDE provides an easy-to-
use interface for writing, uploading, and debugging Arduino code.

The Arduino IDE includes a text editor for writing code, a compiler that converts the code into
machine-readable instructions, and a bootloader that allows the code to be uploaded onto the
Arduino board. It also includes a serial monitor that allows users to communicate with the board
and receive input from sensors or other devices.

The Arduino IDE is free and open-source, and its code is available on GitHub for developers to
contribute to and modify. It also has a large community of users who share projects, tutorials,
and support each other through forums and other online resources.

Fig: 3.21 Arduino IDE Software

A) Technical specifications
The Arduino IDE is a software platform used for programming and developing applications for
Arduino boards, and as such, it does not have technical specifications in the traditional sense.
However, here are some general specifications of the Arduino IDE:

 Operating Systems: Windows, Mac OS X, and Linux


 Programming Languages: C and C++

51
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 Compiler: AVR-GCC
 License: Open-source (GNU General Public License)
 Integrated Libraries: Standard Arduino libraries and third-party libraries
 Development Tools: Text editor, serial monitor, and board manager

The requirements for running the Arduino IDE can vary depending on the specific operating
system and version. For example, the minimum system requirements for running Arduino IDE
on a Windows PC are:

 Windows 7 or later
 2 GB RAM
 1024 x 768 screen resolution
 2 GB hard disk space

3.4 Circuit Diagram


The circuit diagram of Bitcoin Tracker is shown in the figure 3.23

52
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.22 Circuit diagram of bitcoin tracker

Connect the SDA & SCL Pin of OLED Display to D21 & D22 of ESP32 Module. Connect the
red & green LED to D18 & D19 respectively via 200-ohm resistor. Power the OLED Display
using the 3.3V & GND pin of ESP32. The red LED here indicates the price of Bitcoin is going
down while the green LED indicates the rise in Bitcoin price.

3.4 RESULTS

34.1 Hardware Setup

Fig: 3.23 Hardware Setup

53
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

The Bitcoin Price Tracker is designed using the ESP32 development board, which has built-in
WiFi. It connects to your WiFi network and fetches the updated Bitcoin price through the
CoinDesk every 15 minutes. Along with the Bitcoin price, the device also displays the
percentage change from yesterday’s closing price. It also lights up either a red or green LED
depending on whether the price has increased or decreased.

3.4.2 Testing the Bitcoin $ Price Tracker

 After uploading the code, the ESP32 Module will try connecting to the WiFi Network
using the Network credentials provided in the code. Once it gets connected, it will try to
fetch the data using the given API & will display parameters on Serial Monitor.

Fig:3.24 WIFI Connection

 On the other hand, the OLED will boot up with Bitcoin Logo initially.

54
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.25 Hardware Setup with Bitcoin Logo

 Once the device connects to the WiFi Network it will display the current Bitcoin price
along with the change in Bitcoin value since yesterday date. If the bitcoin price is
decreasing the Red LED will turn ON.

55
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig:3.26 Hardware Setup with Output (1)

 Once the device connects to the WiFi Network it will display the current Bitcoin price
along with the change in Bitcoin value since yesterday date. If the bitcoin price is
decreasing the Red LED will turn ON.
 In case, if the Bitcoin price value is increasing the green LED will turn ON.

56
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Fig: 3.27 Hardware Setup with output (2)

CHAPTER 4

REFLECTION NOTES

4.1 Experience

57
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

I have carried out my internship work in Technologics global private limited for the duration of 4
weeks. The first day of the internship training program they gave a brief introduction about
Technologics global, company profile, key persons in the organization, vision and mission of
company and services provided.

In first week, they gave introduction about IoT, they taught pros and cons of IoT, we learned the
electronic components, they helped to connect circuits. Time to time practical assignments were
provided which helped me to practice in home. Revision time and query sessions were also
provided which helped me in clearing previous doubts.

Small challenges were given at the end of the day to strengthen practical knowledge. The task
involved program solving, gathering information about the individual component, its working
specification, features, usage cost advantages, disadvantages, applications and so on.

The guide at Technologics global also helped to self-analyze the concept and the work to get
required outputs by giving valuable information about the system. They made sure that I
understood the concept by giving various assignments.

Two main things that we have learned are importance of time management skills and self-
motivation. At last, this internship has a new insight and motivation to pursue a carrier in this
domain.

In this internship we came to know how to choose a specific technique we also learnt applying
accumulated knowledge and skills in particular concept and ESP32 to develop our project.

4.2 Outcomes of Internship

 Internships are generally thought of to be reserved for college students looking to gain
experience in a particular field. However, a wide array of people can benefit from
Training Internships in order to receive real world experience and develop their skills.

58
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 An objective for this position should emphasize the skills you already possess in the area
and your interest in learning more.
 Internships are utilized in a number of different career fields, including architecture,
engineering, healthcare, economics, advertising and many more.
 Some internships are used to allow individuals to perform scientific research while others
are specifically designed to allow people to gain first-hand experience working.
 Utilizing internships is a great way to build your resume and develop skills that can be
emphasized in your resume for future jobs. When you are applying for a Training
Internship, make sure to highlight any special skills or talents that can make you stand
apart from the rest of the applicants so that you have an improved chance of landing the
position.

4.3 Technical Outcomes Programming Skills:


During my embedded systems and IoT internship, I gained hands-on experience with various
tools, software, and hardware components that are commonly used in the field of embedded
systems and IoT. I learned how to program microcontrollers using different programming
languages such as C, C++, and Python, and how to use development environments such as
Arduino IDE and Visual Studio Code. I also gained experience in trying out the various
examples in Wok-Wi simulator.

Embedded System Design: One of the main technical outcomes of my internship was the
development of my skills in embedded system design. I learned how to identify the hardware and
software requirements of a given system, and how to select the appropriate components and
modules based on the system specifications. I also gained experience in designing, testing, and
debugging embedded systems. IoT Integration: Another technical outcome of my internship was
the development of my skills in IoT integration. I learned how to integrate different sensors and
actuators with cloud-based Embedded and IoT. I also gained experience in developing
dashboards and visualizations to monitor and analyze the data generated by the sensors, and how
to use machine learning algorithms to derive insights and predictions from the data.

59
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Wireless Communication: My internship provided me with hands-on experience in developing


wireless communication solutions for IoT applications. I learned how to use different wireless
communication protocols such as Bluetooth and Wi-Fi, to enable communication between
sensors, actuators, and cloud-based platforms. I also gained experience in designing and
implementing wireless mesh networks, and how to optimize the performance and reliability of
wireless communication solutions.

Project Management: Finally, my embedded systems and IoT internship allowed me to develop
my project management skills. I learned how to plan, execute, and monitor projects using
different project management tools and methodologies. I gained experience in setting project
goals and milestones, estimating project timelines and resources, and managing project risks and
issues. I also learned how to communicate effectively with our guide, team members, and
management, and how to present project progress and results using different communication
channels such as reports, presentations, and demos.

4.4 Non-Technical Outcomes

Verbal and Written Communication: During my embedded systems and IoT internship, I
improved my verbal and written communication skills by regularly communicating with my
guide and team mates. I was responsible for documenting my progress. I received positive
feedback on my communication skills, and I learned how to effectively convey technical
concepts to both technical and non-technical audiences. Personal Development: Through my
embedded systems and IoT internship, I developed personally by overcoming challenges and
pushing myself out of my comfort zone. I worked on projects that were outside my previous
experience and required me to learn new skills and technologies. I also learned how to work
effectively in a team, manage my time and priorities, and take initiative to solve problems.

Time Management: I improved my time management skills during my embedded systems and
IoT internship by managing multiple projects simultaneously and meeting tight deadlines. I
learned how to prioritize my tasks, break them down into manageable chunks, and allocate my
Embedded and IoT time effectively. I also learned how to adapt to changing requirements and

60
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

deadlines, and communicate proactively with my supervisors when I needed additional support
or resources.

Resource Utilization Skills: Finally, I developed my resource utilization skills by effectively


managing the resources available to me during my embedded systems and IoT internship. This
included managing my time and workload, using the available tools and platforms effectively,
and optimizing my use of materials and equipment. Through this experience, I learned how to be
efficient and resourceful, and how to deliver high-quality work with limited resources.

Problem-Solving Skills: One of the key technical and non-technical outcomes of my embedded
systems and IoT internship was the development of my problem-solving skills. I encountered
various technical challenges throughout my projects, such as connectivity issues, hardware and
software conflicts, and debugging errors. I learned how to approach problems systematically,
analyze the root cause, and identify the best solution. I also developed my creativity and critical
thinking skills by exploring different alternatives and evaluating their feasibility and impact.
Overall, my embedded systems and IoT internship was a valuable learning experience that
allowed me to develop my technical, communication, personal, and professional skills.

CHAPTER 5

61
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

CONCLUSION

5.1 Conclusion
The project “Bitcoin Tracker using ESP32” can be a fascinating and rewarding project for those
interested in IoT and cryptocurrency. With ESP32's capabilities, it is possible to create a device
that can fetch real-time Bitcoin prices and display them on an OLED screen or send them to a
web server for remote monitoring. However, it is important to note that the value of Bitcoin can
be highly volatile, so it's important to keep this in mind when creating a Bitcoin tracker.
Additionally, it's important to follow best practices for securing your Bitcoin tracker to protect
your device and data. Overall, building a Bitcoin tracker using ESP32 can be a great way to learn
about both IoT and cryptocurrency while creating a useful tool for tracking Bitcoin prices.

5.2 Future Scope


The future scope of a Bitcoin tracker using ESP32 is vast and exciting. As the world increasingly
adopts IoT devices and cryptocurrencies, the demand for advanced Bitcoin trackers is expected
to grow. Here are some potential future developments for Bitcoin trackers using ESP32:

 Integration with Blockchain Technology: Integrating the ESP32-based Bitcoin tracker


with blockchain technology can enhance its security and offer real-time transaction
tracking, leading to better insights and predictions about the cryptocurrency market.
 Machine Learning and AI Integration: Machine learning and AI algorithms can be
incorporated into the Bitcoin tracker to predict market trends and make automated trading
decisions.
 Integration with Other Cryptocurrencies: ESP32-based Bitcoin trackers can be expanded
to include tracking for other popular cryptocurrencies like Ethereum, Ripple, and
Litecoin, providing users with a comprehensive cryptocurrency tracking solution.
 Real-time Data Analytics: Advanced data analytics tools can be used to provide real-time
analytics of Bitcoin prices, including historical data analysis, trending patterns, and
prediction models.

62
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

 Mobile App Integration: A mobile application can be developed to connect to the ESP32-
based Bitcoin tracker, allowing users to monitor Bitcoin prices and manage their portfolio
from their mobile devices.

REFERENCES

63
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

1. Iftikhar, M. A., Khalid, S., Shahzad, W., Rehman, S., & Masood, M. (2020). IoT-based
ECG monitoring system: Challenges, applications and solutions. Journal of Ambient
Intelligence and Humanized Computing, 11(6), 2509-2535.
2. Kang, J., Choi, J., & Lee, Y. (2018). An IoT-based electrocardiogram monitoring system
for smart healthcare. Journal of Medical Systems, 42(11), 219.
3. Li, X., Yang, J., Zhang, L., & Fang, Z. (2017). An IoT-based ECG monitoring system for
smart healthcare. In 2017 IEEE International Conference on Smart Computing
(SMARTCOMP) (pp. 1-6). IEEE.
4. Chauhan, A., & Prasad, N. R. (2019). Internet of Things (IoT) enabled ECG monitoring
system: A review. In 2019 International Conference on Communication, Computing and
Electronics Systems (ICCCES) (pp. 741-745). IEEE.
5. Saavedra, G., Garcia-Sanchez, A. J., & Garcia-Sanchez, F. (2021). A novel IoT-based
ECG monitoring system for telemedicine. Sensors, 21(5), 1615.
6. Mahmud, M. N., Nafis, S. M., & Karim, A. (2018). A smart IoT-based wearable ECG
monitoring system. In 2018 IEEE International Conference on Informatics, Electronics &
Vision (ICIEV) (pp. 1-5). IEEE.
7. Rehman, S., Iftikhar, M. A., Khalid, S., Masood, M., & Khan, A. W. (2020). An IoT-
based ECG monitoring system for smart healthcare. Journal of Ambient Intelligence and
Humanized Computing, 11(6), 2537-2552.
8. Karim, A., & Mahmud, M. N. (2019). Design and implementation of an IoT based ECG
monitoring system using Arduino. In 2019 IEEE International Conference on Electrical,
Computer and Communication Engineering (ECCE) (pp. 1-4). IEEE.
9. Jain, A., & Gupta, N. (2021). IoT-based remote ECG monitoring system. In Internet of
Things and Artificial Intelligence: Challenges and Opportunities (pp. 215-229). Springer.
10. Lu, C., Xu, X., Zhou, X., & Xu, X. (2020). A wearable IoT-based ECG monitoring
system for remote health monitoring. In 2020 IEEE 17th International Conference on
Networking, Sensing and Control (ICNSC) (pp. 595-599). IEEE.

64
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

APPENDIX-A
SOURCE CODE

const char* ssid = "************";


const char* password = "**********";
#include <Adafruit_SSD1306.h> //Include the required libraries

65
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

#include <WiFi.h>
#include <Wire.h>
#include <HTTPClient.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <ArduinoJson.h>
#define SCREEN_WIDTH 128 //Define the OLED display
width and height
#define SCREEN_HEIGHT 64
#define OLED_RESET -1 // Reset pin # (or -1 if sharing
Arduino reset pin)
#define SCREEN_ADDRESS 0x3C //I2C address for display
#define upLED 18
#define downLED 19
Adafruit_SSD1306 display
(SCREEN_WIDTH,SCREEN_HEIGHT,&Wire,OLED_RESET); //Create the display object
const char* ssid = "************";
const char* password = "**********";
const int httpsPort = 443; //Bitcoin price API powered by
CoinDesk - https://www.coindesk.com/price/bitcoin
const String url = "http://api.coindesk.com/v1/bpi/currentprice/BTC.json";
const String historyURL = "http://api.coindesk.com/v1/bpi/historical/close.json";
const String cryptoCode = "BTC";
WiFiClient client; //Create a new WiFi client
HTTPClient http;

String formattedDate; //Create variables to store the date and time


String dayStamp;
String timeStamp

66
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

const unsigned char bitcoinLogo [] PROGMEM = // 'Bitcoin Logo',


128x64px
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xc0, 0x3f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x03, 0xe7, 0xc0, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x03, 0xe7, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x24, 0x40, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x02, 0x24, 0x40, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x02, 0x24, 0x40, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x02, 0x24, 0x40, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x02, 0x3c, 0x40, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xfe, 0x3c, 0x7c, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x1f, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x03, 0x00, 0x00, 0x01, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0c, 0x03, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x03, 0xf0, 0x3f, 0x80, 0x60, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xf0, 0x3f, 0xe0, 0x20, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x30, 0x70, 0x30, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, 0x30, 0x10, 0x30, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, 0x30, 0x10, 0x30, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x18, 0x30, 0x10, 0x30, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x18, 0x30, 0x30, 0x20, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x18, 0x30, 0xe0, 0x60, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,

67
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x3f, 0xc0, 0xc0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x01, 0xc0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x00, 0xf0, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x00, 0x38, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x3f, 0xe0, 0x18, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x30, 0xf8, 0x0c, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x18, 0x30, 0x1c, 0x0c, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x18, 0x30, 0x0c, 0x0c, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x18, 0x30, 0x04, 0x0c, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, 0x30, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x18, 0x30, 0x0c, 0x0c, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x18, 0x30, 0x38, 0x0c, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x18, 0x01, 0xf0, 0x3f, 0xf0, 0x08, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x01, 0xe0, 0x1f, 0x00, 0x18, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x00, 0x00, 0x00, 0x30, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0e, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x03, 0x00, 0x00, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x07, 0x03, 0xfe, 0x3c, 0x7e, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x02, 0x3c, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x02, 0x24, 0x40, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x02, 0x24, 0x40, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x02, 0x24, 0x40, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x24, 0x40, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x03, 0xe7, 0xc0, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup()
{
Serial.begin(115200); //Start the serial monitor

68
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

pinMode(upLED, OUTPUT); //Define the LED pin outputs


pinMode(downLED, OUTPUT);

if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) //Connect to the


display
{
Serial.println(F("SSD1306 allocation failed"));
for (;;); // Don't proceed, loop forever
}

display.clearDisplay(); //Clear the display


display.setTextColor(SSD1306_WHITE); //Set the text color to white
display.drawBitmap(0, 0, bitcoinLogo, 128, 64, WHITE); //Display bitmap from
array
display.display();
delay(2000);

display.clearDisplay(); //Clear the display


display.setTextSize(1); //Set display parameters
display.setTextColor(WHITE);
display.println("Connecting to WiFi...");
display.display();

WiFi.begin(ssid, password);

Serial.print("Connecting to WiFi...");
while (WiFi.status() != WL_CONNECTED) //Connect to the WiFi
network
{
delay(500);

69
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Serial.print(".");
}
Serial.println();

display.println("Connected to: "); //Display message once connected


display.print(ssid);
display.display();
delay(1500);
display.clearDisplay();
display.display();
}
void loop()
{
Serial.print("Connecting to "); //Display url on Serial monitor
for debugging
Serial.println(url);

http.begin(url);
int httpCode = http.GET(); //Get crypto price from API
StaticJsonDocument<2000> doc;
DeserializationError error = deserializeJson(doc, http.getString());

if (error) //Display error message if unsuccessful


{
Serial.print(F("deserializeJson Failed"));
Serial.println(error.f_str());
delay(2500);
return;
}

70
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Serial.print("HTTP Status Code: ");


Serial.println(httpCode);

String BTCUSDPrice = doc["bpi"]["USD"]["rate_float"].as<String>(); //Store crypto Price


String lastUpdated = doc["time"]["updated"].as<String>();
http.end();

Serial.print("Getting history...");
StaticJsonDocument<2000> historyDoc;
http.begin(historyURL); //Get historical crypto price from API
int historyHttpCode = http.GET();
DeserializationError historyError = deserializeJson(historyDoc, http.getString());

if (historyError) { //Display error message if


unsuccessful
Serial.print(F("deserializeJson(History) failed"));
Serial.println(historyError.f_str());
delay(2500);
return;
}

Serial.println(historyHttpCode);
JsonObject bpi = historyDoc["bpi"].as<JsonObject>();
double yesterdayPrice;
for (JsonPair kv : bpi) {
yesterdayPrice = kv.value().as<double>(); //Store yesterday's crypto
} price

Serial.print("BTCUSD Price: "); //Display current price on


serial monitor

71
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

Serial.println(BTCUSDPrice.toDouble());

Serial.print("Yesterday's Price: "); //Display yesterday's price on


serial monitor
Serial.println(yesterdayPrice);

bool isUp = BTCUSDPrice.toDouble() > yesterdayPrice; //Check whether


price has increased or decreased
double percentChange;
String dayChangeString = "24hr Change:";
if (isUp) //If price has increased from yesterday
{
percentChange = ((BTCUSDPrice.toDouble() - yesterdayPrice) / yesterdayPrice) * 100;
digitalWrite(upLED, HIGH);
digitalWrite(downLED, LOW);
}
else //If price has decreased from yesterday
{
percentChange = ((yesterdayPrice - BTCUSDPrice.toDouble()) / yesterdayPrice) * 100;
dayChangeString = dayChangeString + "-";
digitalWrite(downLED, HIGH);
digitalWrite(upLED, LOW);
}
Serial.print("Percent Change: "); //Display the percentage
change on the serial monitor
Serial.println(percentChange);

display.clearDisplay(); //Clear the OLED display


display.setTextSize(1);
printCenter("BTC/USD", 0, 0); //Display the comparison

72
Dept. of ECE H.K.B.K.C.E
Embedded Systems and IoT

header
display.setTextSize(2);
printCenter("$" + BTCUSDPrice, 0, 20); //Display the current
price

display.setTextSize(1); //Display the change percentage


dayChangeString = dayChangeString + percentChange + "%";
printCenter(dayChangeString, 0, 55);
display.display(); //Execute the new display
http.end(); //End the WiFi connection
esp_sleep_enable_timer_wakeup(900000000); //Sleep for 15
minutes
}

void printCenter(const String buf, int x, int y) //Function to centre the current
price in the display width
{
int16_t x1, y1;
uint16_t w, h;
display.getTextBounds(buf, x, y, &x1, &y1, &w, &h); //Calculate string width
display.setCursor((x - w / 2) + (128 / 2), y); //Set cursor to print string in centre
display.print(buf); //Display string
}

73
Dept. of ECE H.K.B.K.C.E

You might also like