100% found this document useful (2 votes)
55 views13 pages

Project For C-Pro

Project programming

Uploaded by

Lim Sengly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
55 views13 pages

Project For C-Pro

Project programming

Uploaded by

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

Institute of Technology Department of Electrical

of Cambodia and Energy Engineering

Project Report
IOT Lighting Control

LECTURED BY:

SENG Theara

Group:

I3-GEE-B1-Group4

Experiment and Research by:


LAY Somphors (e20201022)
LIM Rithy (e20200541)
LIM Sengly (e20200955)
LIM Theavann (e20200234)
LO Sina (e20201778)

ENGINEERING’S DEGREE
DEPARTMENT OF ELECTRICAL AND ENERGY ENGINEERING
INSTITUTE
OF TECHNOLOGY OF CAMBODIA
PHNOM PENH

Academy Year
2022-2023
ABSTRACT

Digital education aims to use technology to solve economic and social problems in the
context of the Fourth industrial Revolution and urbanization example smart city etc. Young
people need to know both technology, problem solving, leadership and soft skills, based on past
project experience, digital education requires strong personalities, such as teamwork, knowledge
of digital devices.

In fact, many institutes and training centers for technology have strived to modernize the
technology sector and find new ways to meet the boundless needs of people around the world.
Among them, the Institute of Technology in Cambodia, which specializes in all There are ex-
perienced professors who train students to develop their work through research, laboratory
practice, and competitive examinations.

This is why the concept of research related to the creation of a project focused on the
control of automated lighting systems can emerge, which can expand many technological ideas
to market execution or become a manager. One for the future.The purpose of this project is
to cultivate the idea of creating new technologies and starting your own business as a useful
document.

The reason is to allow light in the home, village and country and can prevent harmful
darkness at night while keeping people creative through a process known as Effect Digital.
Digital education aims to use technology to solve economic and social problems in the context
of the Fourth Industrial Revolution and urbanization example smart cities etc

i
Contents

ABSTRACT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
CONTENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
LIST OF FIGURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 OBJECTIVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
3 LIST OF COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
4 DESIGN PROCEDURE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
4.1 HARDWARE PROCEDURE . . . . . . . . . . . . . . . . . . . . . . . . 2
4.1.1 Tool for simulation and design the schematic . . . . . . . . . . . . . . . . 2
4.2 FIRMWARE PROCEDURE . . . . . . . . . . . . . . . . . . . . . . . . . 3
5 EXPERIMENT PROCEDURE . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5.1 HARDWARE PROCEDURE . . . . . . . . . . . . . . . . . . . . . . . . 4
5.2 PROGRAMMING PROCEDURE . . . . . . . . . . . . . . . . . . . . . . 6
6 VISION AND FUTURE PLANS . . . . . . . . . . . . . . . . . . . . . . . . . . 8
7 CONCLUSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
8 REFERENCE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

ii
List of Figures

1 Fritzing software logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2


2 Schematic by using Fritzing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
3 Wokwi simulator logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
4 Simulation by Wokwi simulator . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
5 Flowchart for programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
6 Microcontroller Unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
7 ESP32-WROOM-32D datasheet pin . . . . . . . . . . . . . . . . . . . . . . . . . 5
8 ESP32 Function build in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
9 LEDs built-in and bread board . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
10 The results of hardware testing . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
11 Arduino IDE logo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
12 Interface of telegram bot which use to control the LEDs . . . . . . . . . . . . . . 7
13 Library for this project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
14 WiFi and telegram API configuration . . . . . . . . . . . . . . . . . . . . . . . 8
15 Future plans of Light control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

iii
IOT LIGHTING CONTROLLER

1 INTRODUCTION

In the society nowadays, IOT(Internet of Thinking) is the population technology which


spread out in real life and some of people used it to make their life more modern and useful.
Moreover, some of technologists use this technology (IOT) for their own businesses by making a
new product or innovation. On the other hand, IOT can be used with any fields of technology
and once of that IOT fields also cooperate with ESP(Espressif) and that’s why this project
should be use with ESP32.

2 OBJECTIVE

• To make the user easily to control the LEDs

• To make the user control the LED anytime and anywhere by just connecting to the WiFi
or the internet (no need the local internet)

• To understand about the theoretical that has been learned and brought it to practice in
reality

• To know how to integrate the c programming language with ESP32 and any components

3 LIST OF COMPONENTS

• ESP32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1)

• LEDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2)

• Prototype board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1)

• Bread board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1)

• Resistors

– 220 Ω . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (2)
– 1 kΩ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1)

• Transistor NPN (2N2222) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1)

• Diode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1)

• Power Supply DC 5V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1)

• USB type A output 5V . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .(1)

1
• Wiring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1set)

• Cover background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . (1set)

4 DESIGN PROCEDURE

In this case, there are 2 parts of the design stage for easy to manage the response and
handler.

4.1 HARDWARE PROCEDURE


4.1.1 Tool for simulation and design the schematic
In this procedure,by using Fritzing software is really easy to construct the schematic or
convert it to PCB.

Figure 1: Fritzing software logo

Fritzing is an open-source initiative to develop amateur or hobby CAD software for the
design of electronics hardware, intended to allow designers and artists to build more perma-
nent circuits from prototypes. It was developed at the University of Applied Sciences Potsdam
Fritzing is free software under the GPL 3.0 or later license, with the source code available on
GitHub and the binaries at a monetary cost, which is allowed by the GPL.

By using this software here is the final result of the project:

Figure 2: Schematic by using Fritzing

2
For simulation, using Wokwi website is the best and easy way because it contain many
component and it also support with Arduino IDE which easy to config the code.

Figure 3: Wokwi simulator logo

Wokwi is an online Electronics simulator. You can use it to simulate Arduino, ESP32, and
many other popular boards, parts and sensors. Hence, in this project Fritzing and Wokwi
are important for simulation and testing.

After using Wokwi for simulation, here is the result of the simulation:

Figure 4: Simulation by Wokwi simulator

4.2 FIRMWARE PROCEDURE


Before reach to programming stage, having creating flowchart is such as a good idea to see
what code should be start or end.

A flowchart is a picture of the separate steps of a process in sequential order. It is a generic


tool that can be adapted for a wide variety of purposes, and can be used to describe various
processes, such as a manufacturing process, an administrative or service process, or a project
plan.

So to drawing flowchart for this project, using Draw.io program is such as a good way and
easy to do.

3
Figure 5: Flowchart for programming

5 EXPERIMENT PROCEDURE

For the experiment procedure, this case also has 2 part such as the design procedure but
in this case, it focusing on the experiment in reality to prove that the circuit and schematic
that has construct by simulation are true.

5.1 HARDWARE PROCEDURE


A microcontroller (MCU for microcontroller unit, often also MC, UC, or µC) is a small
computer on a single VLSI integrated circuit (IC) chip. There are a lot of MCU nowadays such
as ESP Arduino STM and etc.

Figure 6: Microcontroller Unit

4
In fact, ESP32 has been used in this project because it has WiFi build in its module hence
it’s easy to do an IOT project. ESP32 is a series of low-cost, low-power system on a chip micro-
controllers with integrated Wi-Fi and dual-mode Bluetooth. The ESP32 series employs either a
Tensilica Xtensa LX6 microprocessor in both dual-core and single-core variations, Xtensa LX7
dual-core microprocessor or a single-core RISC-V microprocessor and includes built-in antenna
switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power-management
modules. ESP32 is created and developed by Espressif Systems, a Shanghai-based Chinese
company, and is manufactured by TSMC using their 40 nm process. It is a successor to the
ESP8266 microcontroller.

Figure 7: ESP32-WROOM-32D datasheet pin

Figure 8: ESP32 Function build in

5
For testing case, using bread board and LEDs build-in of ESP32 is a great choice and
fast for testing. By reading the datasheet from the espressif website they told that the LEDs
build-in is in pin 2.

Figure 9: LEDs built-in and bread board

Figure 10: The results of hardware testing

5.2 PROGRAMMING PROCEDURE


5.2.1 Program for Integrated development environment (IDE)
There a lot of IDE which support with ESP32 for coding such as Arduino IDE, VScode,
Espressif IDF, Eclipse, Platform IO etc. For basic and fastest way to config and debug, using
Arduino IDE is the great choice for basic learner.

The Arduino IDE (Integrated Development Environment) is used to write the computer
code and upload this code to the physical board. The Arduino IDE is very simple and this
simplicity is probably one of the main reason Arduino became so popular. We can certainly

6
state that being compatible with the Arduino IDE is now one of the main requirements for
a new microcontroller board. Over the years, many useful features have been added to the
Arduino IDE and you can now managed third-party libraries and boards from the IDE, and
still keep the simplicity of programming the board.

Figure 11: Arduino IDE logo

For application which use to control the LEDs there are Telegram, Blynk etc. In this
case, this project using telegram to control the LEDs which don’t need local internet. Hence,
we can control the LEDs anywhere with internet.

Figure 12: Interface of telegram bot which use to control the LEDs

5.2.2 How ESP32 connect to telegram?


First, set up the ESP32 board make sure that it’s ESP32 not ESP8266. This project code
with these 2 library:

• ArduinoJson Library

• Universal Telegram Bot Library

• WiFiClientSecure

• WiFi

7
Figure 13: Library for this project

Then we have to input the wifi ssid and password for ESP32 before config the telegram API
and telegram ID. That’s how ESP32 connect with telegram bot.

Figure 14: WiFi and telegram API configuration

6 VISION AND FUTURE PLANS

For this project, it can be scale and make it to market by just upgrade some components or
adding some feature such as lamp or MCU. Example smart lamp with smart charger or smart
light.

Figure 15: Future plans of Light control

8
7 CONCLUSION

To sum up, IoT life controller is a crucial subject that people have to study on. With the
finding of the internet of thinking , it is an essential information for humans to have a better
life living on earth. Similarly, IoT play an important role in developing business . IoT are the
internet of thinking its actually does the research on the internet and study the effect of human
activity that affect the lifestyle . The main goal of IoT is creative technology to develop LED
modern , address the waste of time problems, and find solution to the problem in order to avoid
deteriorating conditions .

This project can drop IoT in our hands from one area to another to control wherever we
want to connect for belonging to a connection that only uses the internet and wifi. That makes
it easy for us to protect and save time because we know that time is extremely worth .

8 REFERENCE

• Random Nerd
(https://randomnerdtutorials.com/telegram-control-esp32-esp8266-nodemcu-outputs/)

• AutoDesk Instructables
(https://www.instructables.com/Controlling-ESP8266-Using-Telegram-App/)

• WikiPedia
(https://en.wikipedia.org/wiki/ESP32)

• Arduino Website
(https://www.arduino.cc/en/software)

• Electro Maker
(https://www.electromaker.io/project/view/telegram-bot-with-esp8266-154)

You might also like