Transcripts
1. Introduction: Hello and welcome
this new course. Today, you will learn, enter think based
smart home automation and how to create it on
budget using ESP bar. This is actually from
educational engineering team. They SP 8266 is wifi. You all great for Internet of Things and home
automation projects. Home automation
has achieved a lot of popularity in recent years as day-to-day life is getting simpler due to the rapid
growth of technology, almost everything has become
digitalized and automatic. The Internet of Things, or IoT, is a system that allows
devices to be connected, controlled, and remotely
monitored across the Internet. Now, in this course, we are here to help you learn the hardware and software
requirements for this project and to get it up and running
inside your house. You will get a quick introduction
to enter two things. The basic concepts behind IoT and everything that
you need to know about it. You'll learn how to weld home
automation projects using low-cost ball and a
well-known Arduino IDE. The learning curve
will be minimum. You will learn how to
create our page to control your home remotely via internet. You will also learn how
to create mobile app to control your home
remotely via Internet. And we will also teach
you how to create our observer and
hosted on your board. Now will also teach you
what is ESP EDI 266, what you can do with
this low cost module. And this module
specifications will also show you different versions
available from this port. We will talk about
the pin out and what each of these
pens is used for. We'll talk about the
circuit connection, how to connect
different components. On budget. We will talk about
the ESP 12 Ebola. And we must d1 balls, which are the very famous
versions of the ESP a12 66. And we will end up
with ESP 826601, which is the version
that we will use. And we will list the things that made us prefer
this version. We'll talk about
programming the ESP 8266 using Arduino IDE. So you'll program it using a software that you
are already familiar with and a language that you
are already familiar with. We'll talk about how to design
your own relay module so that you can use it to
control high loads. I'm sure that at
the end of scores, you will gain a lot of knowledge and you'll be able
to control any of your home devices on
budget at less than $5. Thanks for watching
this introduction. This is Ashraf from
educational engineering team. What you will learn
in this course. Now, let's talk about things that we will cover
in this course. First, we will talk about hardware and software
requirements, and we'll give you a
quick introduction to the Internet of Things were then to learn how to build home automation projects
using a low cost board, the well-known Arduino IDE. So the learning curve
here won't be much. And I can do this project. Now. You will also learn
how to create web page to control your home
remotely via internet. You will also learn
how to create a mobile app interface to control home remotely
via Internet. We will also talk about creating a web server and
host it on your own. But again, we're talking
about a low-cost ball here. So it won't cost you a lot. This is why this will
be in terms of things, home automation and
budget or on budget. Now, we will also learn
the ESP 8266 board. And what can you do with
this low cost per joule? We'll talk about at specifications and different
versions available. And we'll explain that pin out. After that, we will
connect our circuit and we will discuss
different versions of the ESP balls that can
be used and why we are using the one that we are using and we prefer it
over other modules. Then we will have
our programming, the ESP 8266 using Arduino
IDE in a step-by-step manner. You'll also learn how to
design your own relay module in circuit schematic software
and how to make the PCB. After that, we will
cover how to use ESP 8266 control high loads
using that really module. I'm sure that at the
end of this course, you will enjoy the content
that you are going to go buy this module and start
automating your home using it. Thanks for watching this lesson. See you next.
2. 3 Hardware and Software Requirements: Hardware and software
requirements. This last one, we're
going to talk about the hardware and
software requirements to get this project done. The first thing that
you will need is an ESP 8266 WiFi transceiver. You will also need
the relate module and we will explain how to design and create a PCB for
your very own relay module. Even if you don't
have knowledge at all in electronic circuits. And we will show you
the other option, which is to buy this
module at a very low cost. You will also need some
basic electronic components depending on what
you are going to do This module or
with the circuit, if you want to
control a simple ID, or if you want to control
a high load devices. For programming grill
use Arduino IDE, which is a very
well-known platform for programming Arduino boards. And we will set it up to get you started on
programming ESP boards. You will need some jumper
wires for connection. And you will also need a bread board if you want to connect
different elements. And again, the two
charts today will help you control two
devices and ASP both. Now, if you don't have module, you can create one
on connected on your breadboard by buying
a five volt relay. To transit stores
to n four ends, you'll need a single
diode, which is 14,007. You need 220 ohm resistor
and 15 volt battery, or a PSU or power supply units. This is in case you don't have
access to already module, you can use to
single-channel modules or singularly with the
supporting transistor circuitry. And we will show you this circuit as we
go in this course. So mainly you will need that
ESP is 266 earlier module, and you will need the Arduino IDE as the
software requirement. That's it. If you don't have any of these, just keep watching the course and you will learn
how to get them. And they will cost less than $5. This is why this whole thing
is called internal thing, home automation on budget. That's watching this lesson. See you next.
3. 4 Introduction to Internet of Things: Hello and welcome
to this new lesson in which we're going to introduce you to Internet
of Things or IoT. It's a very common term and now people are
using it everywhere. Then kinds of things is a system of interrelated
computing devices, mechanical and digital
machines, objects, animals, or people that are provided
with unique identifiers. And the ability to transfer
data over a network without requiring human to human or human to computer.
Interaction. Seems complex here. Now, let's make it simpler. Let's take a simple, non-technical explanation
of the Internet of Things. How are you watching
this course right now? It might be on desktop or
mobile, maybe a tablet, but whatever device
you are using, it's most likely connected
to the Internet. And Internet connection
is a wonderful thing. It gives us all sorts of benefits that just
weren't possible before. If you were to think of your cell phone before
it was a smartphone, you could call and
you could text. Sure. But now you can read any book, watch any movie, or listen to any song all in the
palm of your hand. The point is that
connecting things to the internet yields
many amazing benefits. We have all seen
these benefits with our smartphones,
laptops, and tablets. But this is true for
everything else too. And yes, we do mean everything there in terms of
thing is actually a pretty simple concept. It means taking all
the physical places and things in the world and connecting them
to the Internet. Confusion arises not
because the concept is so narrow and
tightly defined, but rather because it's so
broad and loosely defined, it can be hard to nail down that concept in your
head or in your head. When there are so
many examples and possibilities in IoT
or Internet of things. To help clarify,
it's important to understand the benefits of connecting things
to the Internet. Why would we even want to connect everything
to the Internet? Now, one thing that you need to know is that when something
is connected to the internet, that means that it can send information or
receive information. For both. This ability to send and receive information
makes things smart. Let's use smartphones
again as an example. Right now, you can listen to just about any
song in the world. But it's not because your phone actually has every song
in the world sold on it. It's because every song in the world is stored
somewhere else. But your phone can send information asking
for that song and then receive information which is screaming that
song. Your phone. To be smart, I think
doesn't need to have superstar image or a super
computer inside of it. It just needs access to it. All a thing has to
do is connect to super solid or a supercomputer. In that side of things, all the things that
are being connected to the Internet can be put
into three categories. The first one is thinks that collect information
and then send it. The second category
is things that receive information
and then act on it. The third category
is things that do. Both. All three of these have enormous benefits
that compound on each other. Let's start with collecting
and sending information. Sensors. Could be temperature sensors, motion sensors, air
quality sensors, light sensors, you name it. These sensors, along
with a connection, allows us to
automatically collect information from
the environment, which in turn allows, allows us to make more
intelligent decisions. The second category is receiving and starting on information. We are all very
familiar with machines getting information
and then acting. Your printer receives a
document and it prints it. Your car receives a signal from your car key and the doors open. The examples are endless
without its simple as sending the command turn
on or as complex as sending a 3D model
to a 3D printer. We know that we can tell machines what to
do from far away. So what the real power of
the Internet of Things arises when things can
do both of the above. Things that collect
information and send it, but also receive
information and act on it. Now the third category
is doing both, which is the goal of an
Internet of Things system. Let's quickly go back to the example that we mentioned are examples
that we mentioned earlier. Since it can collect information
about our soil moisture from a farming place to tell the farmer how much
to water the crops. But you don't actually
need the farmer. Instead, the irrigation system
can automatically turn on as needed based on how much
moisture is in the soil. You can take it a
step further to if the irrigation system
receives information about them, whether it's
Internet connection. It can also know
when it's going to rain and decide not to water the crops today because they'll be watered by the rain anyway. And it doesn't stop there. All the information
about the soil moisture, how much the irrigation system
is watering their crops, and how will the clubs actually grow can be collected
and sent to super computers that can amazing algorithms that can make sense
of all this inflammation. And that's just one
kind of sensor. Add an other sensors like light, air quality, and temperature. And these algorithms,
algorithms, sorry, can learn mark like
much more with dozens, hundreds, thousands of farms, all connecting this information, this algorithm can create incredible insights into how
to make crops grow the best, helping to feed the world. And agriculture is just one of many applications of
Internet of Things. So the main goal
that I need you, or the main thing that I need to understand here is
Internet of Things is basically connecting
things to the internet. This is why it's called
Internet of Things. Now, connecting things to the
internet will help things become smart by
providing them with storage and with
supercomputers connection, which makes taking decisions faster and which helps
monitoring these systems. Now, in the next lesson, we'll talk about the ball that will make it easy for us to tell our home into an internet connected
home or use Internet of Things concept on our home devices and appliances. I hope that I didn't pull you with these theoretical ones, but you need to know these in order to move
forward with this course. Thanks for watching this lesson. See you next.
4. 5 Different Boards with Built in Wifi: Hello and welcome to this
new lesson in which we are going to talk
about the board that we will use in this internal
thing, home automation. It's the ESP 8266. They SBA to 66 is a $4
up to $10 wifi module. And it allows you
to control inputs. Outputs, as you would
do with an Arduino. But it comes with
built-in Wi-Fi. So it's great for
home automation, internet of things applications. Now, what can you do with
this low cost module? You can create your
own web server. You can send HTTP requests. You can control outputs. You can read inputs
and interrupts. You can even send emails and posts tweets to
your Twitter account. If you want to create a web
server or the ESP to 66, we highly recommend that you use this board
as it will cost, you weigh much less than using a Raspberry
Pi, for instance. Now, the main product
specifications, ESP 8266 specifications compared to other Wi-Fi solutions
on the market, makes the ESP 8266 a great option for most Internet
of Things projects. It's easy to see why
it's so popular. It only costs a few dollars and can be integrated in
advanced projects. Now some of the main features is that different
protocols it supports. It also has Wi-Fi Direct
and soft access point. It has integrated TCP
IP protocol stack, and it has built in
low-power 32 bit CPU. It also has SDI, o to 0, SPI uart, which are basically
communication protocols. There is also a successful
of the ESP 8266, which is the ESP 32, which combines Wi-Fi
and Bluetooth, and it has dual-core processor. You can see our profile. We have different
courses that's covering the ESP 32, but it's nasty. It's not a low-cost module. That's why we didn't
use it in this course. Now, let's take a quick look at different versions
available from the ESP 8266. They must be eight to 66 comes in a wide
variety of versions. As you can see in this image. There is the ESP wealth, ie, all often called E. We, that is highly
recommended when you are building or developing a
project and you need a belt. And programmers lost a lot of general purpose
input output pins. There's also the built
in program or features that will make it easy to prototype and upload
your program. But this comes with a cost. It will be at a
higher price range than the module that we
will use in this course. Each of these modules has
its own specifications. The differentiation and
the power consumption, number of output modules, the need for external
programmer or not, and the price, which is
the main point here, we are looking for a
solution that is low cost and can be used in any device to control that device and turn it on and off
without the hassle of paying too much money to turn that device into a smart device. In the coming lessons, we will cover that the SBA to 66 that we will use in
this course in details. Thanks for watching this lesson. See you next.
5. 6 Boards Pinout: Hello and welcome
to this new lesson in which we're gonna talk about the ESP 8266 pin out. Now, what you need
to know is that the most widely used
ESP aided or 60s if Development Board as ESP 01. Now the USB 826612 MCU kit. And we most D1 many are
basically comes in the second, third places when it comes
to ESPs, you're the one. That's why we will
start with that wealthy and we must do on mini. Then we will concentrate our, let's say, practical
lessons on the ESP 01. Now, we will show you the
pinout for those sports. If you are using another
development board, make sure you have
the right pin out, starting with not MCU, ESP 12th. As you can see in this image. Here we have ground down
ground and another ground. Now we have a lot of general
purpose input, output pins, as you can see here, here. And here. Now, if you saw two columns, it means that this is
a dual function pin. So it can be used for this
function. For this function. Now, these two functions, two pens are not usable for you. Now the ADC for receiving
analog signals. This is why this board is
like a development kit. As you can see, it's
called a kit because it has onboard programmer, has a lot of general
purpose input output pins. It can read analog signals, and it has a lot of pins with
dual functions like Flash. A sealant is DA for
communication, provide 3.3 volts. As you can see from
different pens. Three pins, actually,
now we have three or foreground that we
can use with any breadboard. So you can use it as
a development kit, but we don't recommend
it if you want to automate because it
costs more than $10. Now the board that we will use will cost you less than $5. And this is why we are
recommending that 01. Now, this is regarding
the first ball, which is that he SB 12 e. Now the second board
is that we must D1, meaning this is the pin
out for this board. Now it has less number
of input output pins, as you can see, 012345. And here we have 1213141516. So here we have five fans, and here we have six bins. Now in total, about 11 beds. Now it also provide
five volts, 3.3 volts, and the ground only three pins, not duplicated
like in this bowl. Now, beta1 spends
with dual function, as you can see, for that serial communication
or for connecting flash. Now, it has one pen
that can receive analog signals and
tell the recipient. So it's a smaller
version of this ball. So it's like less than cost, but still it costs
more than the ESP 01. Now, the bottom that
we are recommending and we will use is the
most widely used Board, which is the ESP 01. It's basically ESP 8266. Esp is your one. And this bond is
very small pore. It's like smaller than
your fingerprint. And it has only eight bins. It only has four
general purpose pins, as you can see here,
here, here, and here. And it has one ground
Ben and 1.33 volt. Then it has been enabled Ben. And you can see that
it supports TX, RX force here communication. So it only support one
communication with you all. And again, a very
small board consumes the least amount of power it has only for general purpose
input, output pins. So you can control
up to four devices. And this is basically the
ball that we will use. Now we'll talk about more
details in the coming lessons. But this last one was just
to let you know that we have three boards that are
most widely used. All these pores are ESP 01. Yes, B, E, which is the MCU kit. And we must D1 many. So these are the three balls you can use any of these pores. But we recommend the ESP
01 because it consumes the least per amongst our cost, our way much less than
the other two boards. And it's very easy to use
and program and Kinect. And we will show you this
in the practical lessons. Thanks for watching this lesson.
6. 7 The board to be used in this course: Hello and welcome to this new lesson in which we are going to talk about the ESP 018266. We already mentioned that
this will be the module that we will use in our course. And as you can see, it's a very small module. It has only eight pens with for general purpose
sellable output pins. And the other four pens are
used for different functions. Now, ESP one is an inexpensive small
size Wi-Fi him would you all watching sits off TCP IP stack along with a
built-in microcontroller. We can direct the
program this small chip, and can bring Wi-Fi capability
in our embedded projects. When first time this chip came into the market
in August 2014, I've got a lot of
attention by users. The main reason for it to seek attention is
that this module allows microcontroller
to connect with our Wi-Fi available, and it follows the
TCP over IP network. Now, ESPs U1 chip
integrates an antenna, balloon power
amplifier, filters, and power arrangement module. Yes, P 01 is used to industry or industry and many
projects as a wifi module. In this course,
we will use it as a wifi module and
a microcontroller. Now, this allows any
microcontroller or the microcontroller
that is available on the board itself to
connect to a Wi-Fi network, which is the main
thing that we need. Now, it can come in
different shapes. As you can see, this
one is a blue one, and this is the main schematic. Now, this is the
on-board antenna, as you can see, this wire. Here. We have the power to
lead the communication lid. Right here we have
these eight pins. This one is a general
purpose input output pin. And our expense for
the CRF communication. And here we have general
purpose input output 01, which is the first
pin in the cereal, or sorry, the input output pin. Blast, it supports your
communication using dxdy. So these two will be used
for CSR communication. Now we have a chip enabled pin, we have an external
reset button. Then we have the VCC
to power the board. And we have the ground. And we have two pins that are for general
purpose input output, which are pin number
two and then number 0. This one is also used for SPI. So mainly we have for
general purpose input, output pins, these 234. This is the ball has eight pins. And now let's specify what each of these
pens is used for. Now PIN number one,
it's the VCC pen. And that VCC pen is used for input power supply
three to 3.6 volt. So you need to make sure the VCC pin right here is
only connected to three, or three, up to 3.6 volt. Now we'll also have a ground pin that must be
connected to ground. Here. We have the rosette then that is used for external reset signal. Low voltage living will
activate this pen. We have other pins, like the CHP D pen right here. The CHP deepen is basically
the chip enabled. High means on. The chip works properly. Low means off, and it only
allows small current. We also have general purpose on, but output pins for input, output of a digital signal. And we have the TX RX labeled. This means that the
spin has dual function. Now, these are used for
general purpose input, output and serial,
dxdy and our XD, this band and this band. Now the remaining pens
like this one journal. But output is basically a general purpose
input output pin. And it doesn't have
dual function. This is the main
thing that you need to know about the pin out, the functionality of
that USB 01 board. Now, let's talk
about the features.
7. 8 Main board Features: Hello and welcome
to this new lesson. You know, try to
go on to discuss the main features of ESP 0 on. The first feature is that it is a low power 32-bit
microcontroller unit. It uses TCP IP protocol
for transmission. It consists of
integrated switch, but on power amplifier
and matching network. It works on 802.11 b g n Wi-Fi with a frequency of 2.4
gigahertz and WPA and WPA2, which is Wi-Fi protected access. It also consists of
thin bit analog to digital converter
that supports SPI. You are I squared, I squared as a
remote control BWM, general purpose input, output. It's deep sleep power is less than ten microgram and power down leakage current
is less than five. My clamp. It's wake up and transmit packets is less than
two milliseconds. Standby power consumption
is less than one millivolt. Its output power is plus
20 dB men, 802.11 B moved. Its operating temperature range is between minus 40 degrees. It easiest to a 125
degrees series here. These are the main features. And for me the main features
are it's Wi-Fi support, the low power consumption,
and low cost. Thanks for watching this lesson. See you next.
8. 9 Add Board to Arduino IDE: Hello and welcome. I'm the Senior lesson in which
you are going to add yes, be 8266 to the Arduino IDE. The first step is
opening up Arduino IDE. Now once you have the
Arduino IDE opened, you need to go to
the preferences. Now go to File Preferences. Now inside this
Preferences window, you need to add this line. Arduino the DSPS to 66.com slash stable slash package
underscore ESP 8266 com, underscore index.js on
this line is responsible for adding the ESP a 266
support to the Arduino IDE. And this one is responsible
for adding the ESP 32, which is not what
we are aiming for. So just add this line. Now if you couldn't find it, just Google Arduino,
ESP 8266 Jason. And you will find this
path, paste it here. Okay? And after doing that, the next step is
going to Tools board. And here we have a list. Here we have the board go to the boards manager and
the board's manager, you need to look for ESP 8266. And as you can see,
it's this library. But you need to do is to
install this library. Now, it's already
installed here, so I will just update it. Now it will download
the required files and install these files
into your system. Now once you are done with this, you will see that
it's installed. So close this window. Now, you can easily navigate to see the ball in your
Boltzmann shall go to Tools. And from there go to board. And from there, scroll down, you will see that
you have options. Here we have ESP
8266 moles, 3.2. And from this list you can see the different
versions of this ball. And there is an endless number of versions that
really are endless. As you can see here, we
have the ASP wealthy module that we talked about earlier. And let's scroll down. Here we have the
infant one module. Here we have a generic module. Now what we need is the generic ESP a12 66 generic
module, which is this one. So make sure that you have
selected this version. I will show you that
version again board. Yes, P A2, 66, go up all the way up
to 66 generic module, which is the version
that we will target. Now, that's it for this lesson. If you have done all
the steps height, you should end up here choosing the general ESP 8266 module. If you face any problems, you can contact us via
messages or the Q&A board. And we will be more than happy to help you
solve your issue. Thanks for watching.
This is Ashraf.
9. 11 Prepare Web Interface to Control Device: Hello and welcome
to this new lesson. Today, we will create our
interface to control, let's say, lead or relay or device and turn it on and off. To do that, simply go
to playing the CC. And here on the blank platform, you need to login with that account that
you have created. Now we already created an
account or previous lesson. So we'll use that account
to login to our dashboard. Now once you login
to your account, you will see this page. And on this page, you can create new templates. And template is a
digital model of a physical object like a device. It is used in Blink platform as a template to be
assigned to devices. So let's create a new template. Click here, and let's
call it ESP 2601. This here on the hardware, choose ESP H.263 sex, and the connection type, choose it to be Wi-Fi. Here you can add a description. This device on and off. Now, hit Done.
Once you hit Done, you'll see this page in which there is a very
important information. Here we have the
blank template ID and the plane device
name as assigned by us. Now template ID and
device name should be included at the top of
your main firmware, which is basically
our Arduino code. Now here you can edit
the template name, hardware, connection,
type, and description. If you scroll down, you can
change the manufacturer. You can add categories. You can choose offline,
ignored period, and you can add hotspot effects so that you
can recognize this device. You can even add
a template image, which will make your template
more visually attractive. Now there's the metadata here regarding the device
name on or location, time zone and name. You can change
these data streams. And we'll talk about
that in a minute. There's events,
there's Web Dashboard, and there's mobile dash. Now, let's talk
about data streams. Let us dreams is a way
to structure data that regularly flows in
and out from device. Use it for sensor data and
telemetry or actuators. Now, events is basically an
online or offline events. You can add more
events if you wish, by adding the FN name
called and tied. If this information warning
critical or content, you can send events
to replication tab of your mobile app or send
events to that timeline, which will make that
visible in the timeline. If your device or app, you can even apply a
tag for that event. Now, you can add a notification
to enable notification. When an event happened, like sending emails and they got push notification
or sending an SMS. And here you can see
the notification limit, which is basically the vigil at which you receive
that notification. You can see the notification every 13 minutes or
30 minutes, sorry. Here you can add a counter and you can enable
notification Manager. Now, if one pack here, again, you can see the event
name and code right here. You can choose warning and
let's say temperature. Let's make it red. Now. This will be an event, temperature events
that will send us identification to my email list. Let's select Device Owner every hour if
something went wrong. Now, now, just to make sure
that you understand things, you can taste the
event creation by sending it from
device using blank, using that firmware
API or a rest API. Now you will use
the event code in your Arduino code in our
case, to send events. So whenever blink receives an
event code of temperature, it will know for sure that this event must be triggered and we'll send you an
email to this address. Now, you can write
something like blank dot log event and tweet to the
balanced parentheses, you can add the temperature. Now, this is a whole
different story. So now you learnt how
to create an event. And we created a new event. Now, the online and offline are also events and this
is the code that you can use to communicate
with them using your code or your firmware code. Now, regarding data streams, data streams are channels that are used to
send data between the device and blink cloud. We will be using
that data stream to send random values
from your device or values like on and off to tear a specific
device on and off. Now, you can click on
that new data stream. From here, you can
create a digital pen. Analog pen, or a virtual pen. Will use virtual pen
for this lesson. And once you see this, you need to choose a name
for your virtual pen. Let's say on. Now, this is the owner of pen. Now that virtual pen name, we will keep it at v 0, which stands for virtual 0. Now, change the data
type two integrals. Now, you can even
change the amino and the maximum value
from 0 to a 100, but we will leave
it to 01 because these are the two values that
we will send and receive. Now, you can change
the advanced settings, but we won't need this. And once you are done
and you're satisfied, you can even change the icon
and hit the Create button. Now, you have created
a data stream and the name of the
steam is on-off prem. Once you are done,
you can create more data streams if you wish. But what we need to do is
to go to the web dash. Now, in this web dashboard, we need to add an on-off
button or switch. So you can simply drag
that and drop it here. This will be your on-off button. Now you can place it
wherever you want. You can increase the
size to make it easier. You can change the settings
by writing on off switch. Now you need to link
it to another S3. And in our case we have
only one data stream, which is on often v 0. Now the value will be one, value will be 0,
which makes sense. Change this to blue. Now, you can show the labels. So on labor will
be device is on, off, label will
be device is off. Now you can even
change the position. Here it is on the right. We can change it to left. Now you can hide
that widget name. I will keep it. Once you are done and satisfied with
what you see, click Save. And here it is. Now we
have the on-off switch. This is the name or AB. Now, other things that you
can do is adding a slider. For analog values. You can even add a label. You can add a chart, a
mob, and other modules. Now, we just need an
on-off switch to show you exactly how to communicate
with this interface. Now, once you are
done, click Save. This is what you will
see as you can see, device on, device off. Now this is the web
dashboard that you can use to control your device. In the next lesson, we will talk about how
to code your Arduino to receive this and turn the device on and off
based on this switch. Once we are done with that, I'll show you how to
create a mobile app using your iPhone or iOS
or Android phone. And how to create a data stream and the user interface for
your app so that you can easily control that device from anywhere with an Internet
connection using that app. That's it for this lesson. Thanks for watching. This is Ashraf.
10. 12 Coding Your Board: Hello and welcome
to this new lesson. We're going to start
coding our Arduino. Now, we go to the Start
menu and look for Arduino. Now, the first thing that you
need to do is to go here, copy, click to copy these two lines and add them at the
beginning of your code. Here we added these two lines. Now we need to define or
to import. The libraries. Include and less important,
the first level, which is ESP 8266 y phi x. Now the second library
is the blank simple. Asp A22, 66 dot txt. Now, these are the two main
libraries that we will use. Now our codes. Now, you need to make sure
that the ball that you have selected is
they ask people. So here we have generic
ESP 8266 module. Once you're done,
as you can see now, this is a library
that they SPF nice. Let's try to verify the code. Now save it somewhere that
is recognizable for you. Now. It's fine, I'm cold and
hit the Save button. It will compile the sketch
to make sure that it can recognize these two libraries
without any issues. Now as you can see,
it done compiling, so everything's okay. Let's define a few variables. Char, syndicate. Here we will add the authentication that
we will get from our app. We also need to add the SSID for our Wi-Fi network and the
password for our Wi-Fi network. Now after doing that, we need to go inside
the setup function. Here. Sit the pinMode folder
bin that we will use, which is 0, as outputs. Make sure that
software or firmware recognizes this pen as output because we
need it as output. Now, in order to connect with the blank website
or blink servers, we need to use the
blink function. Linked up again.
Now this function will take three parameters, authentication, the
SSID, that path. Now, these two will be to make sure that all boats
connect to the internet. This authentication will
be a unique number to tell our blink server that we are the ones who are trying
to connect to that app. So we will teach you
how to get that number. Well, the next
lesson. After that. Now, let's go and directly
inside the void loop. And by the following. The first thing that you
need to write is blank. Now, this will run
the link library continuously and it will do the initialization
and settings. As I'm doing that inside
that loop function, let's add an if statement. So if Alice now move this inside
the if statement, you need to write a flag. Now, flag is a variable that
we will define in a minute. Now, if this flag
is on equals one, we need to do the following. We need to send digital light to the pen that we are using, which is the control pen. And in our power nor case, that control pin
is pin number 0. So 0. Now 0 p sit below. If flag value is on equals one. Now this is low because
the relay turns on when the pen have
ground connected to it. Now, we will copy the same
line and we'll paste it here. But change this to high. This is high because
the relay turns off when the pen have VCC. Now, this will be
more clear once we crave the function that
will set the flag value. Now, let's work on
the flag variable. So let's go back here. We need to define
a few more values. First, let's define the on, off, on, off and make it equal 0. Char flag equal 0. And char is the
underscore on equal 0. And another charge,
e state equals 0. Now, move on and create our
function, call it blank. Underscore lights. Now, inside this function, we will do the flag thing. In here. Add that virtual pin number, which is v 0. None site on, OFF equals as integers. Now, let's create
an if statement. So f. Else. Now inside the if statement, we need to ask if on inside the parentheses we need to write our code. Now. We need to add a
condition to notify us just once every chance. So add f and inside it. Alright, not equal E stayed on what she is the
variable that we created here. Now inside it, we
can add a serial print n. We kinda
statement like tear. After that statement,
add e state equals one is the off equal 0 and
the flag equals one. Now, what you need to do
next is simply to copy this whole f statement and
added inside the else. Basically what you need to
do is to change this to off, change this to this to 0, and the flag to 0. Now once you have
done with this, you need to make
sure that you are enabled the serial since we are using the serial library here. So let's add a
defined line here. Define blank, underscore,
brand, Syria. Now let's do a quick summary of everything that we
have done so far. First, we define that template
ID and the device name, which are the values that
we got from the website. We define the serial to
use it for debugging. And we included the library
and the blink library. We created three variables for the authentication token and for our Wi-Fi network
name and password. We defined for variables for tracking of the on-off signal. And to turn the
device on and off, we wrote the blink
right function targeting VCE approaches the virtual pin number 0 that
we used in the blank app. Now inside here, we checked
the state of our pen. And the main thing
with that state, we turn the device on
using these flags. Now this flag is used
in the loop function. Right here. F flag, it will turn
the device off. Elsewhere, tell tone, and the
flag values are set here. As you can see, a flag equals the 0 state for
device will be off. So ie state off and it will print on the
cell monitors turn off. Now, if flag equals one
means our devices on, and it will turn on the device. So if flag value equals one, it means that the virtual
pen on our blink, the device is on. So we set the flag to one. After setting the device on. And basically inside
the setup function, the pinMode pin number is 0, then that we are targeting. And we're setting
that when as output. And here we are starting
that blink begin function with these three variables, that authentication, token, the Wi-Fi network
name and password. And inside here we are running the blink function
and we are checking the flag to turn the LED or
the device on, and that's it. This is our code.
In the next lesson, we'll create an Android
app on an iOS app to control this code and we'll get the authentication
from that cold. Thanks for watching this
lesson. This is optional.
11. 13 Create Mobile Interface to Control Your Device: Hello and welcome
to this new lesson. Now, let's download
that blink app. Go to your phone
and write blink. As you can see, here, we have more than one tab. Now the one that we
need is the first one. Blank. So let's
download this app. And as you can see, the last
update was two months ago. Shouldn't take long to download and install
the app on your phone. This is the user interface. Now as you can see
from the description, this app is used to control
Arduino, Raspberry Pi, ESP, and either balls to help you build a
smart home or robot. So it's a very useful app
and it's provided by blank. As you can see, they have more than one AB and they have blink for
Internet of Things, which is the new app. So let's download
this one as well. Now, both of these
apps works the same or using the
very same concept. As you can see, the different
apps provided by them. Cutting edge power. Now, this app is basically a
drag and drop. Things are. Blink is a simple and powerful low-code application builder where you can prototype, deploy, and manage connected electronic
devices at any scale, from your personal
projects to millions of products used by your clients. It's a very useful app
and you can easily connect your hardware
like ESP theta2, arduino, Raspberry Pi, seed, spark funds products,
add fruit products. So the possibilities
are endless. You can easily connect supported devices and
remote control them. They are telling you that
this is the new version. And as you can see, it only has five ratings. So let's open this app. Now. You need to login using the same credentials that
we created previously. And you need to
write your password. Slides are very long password. That's why it's taking
some time for me to now hit the login button. And as you can see,
no devices here. Now you can add a new device or you can go to
the developer mode. Now, once you click
the blue bar mode, you will see the device
that we have created. So click on it. And here it's telling you how
to add a widget, how to resize our
tab and all that. We need to move tab on the
widget once to open when your settings and you can
even duplicate widget. Now let's hit Okay, I'm ready. Click the plus sign. We need a battle. Now, this is the on-off button
that we will use. Now. The click. And while you are clicking, move it for anywhere so
that you can place it. Now click once to
open the settings, call it on, off button. Make it center line to lift
the data stream to be Vizio. And you can choose either
push button, switch. I will leave it at switch. Now the onwards own
upwards of the text sizes use the text
color is blue. The sign here it is. As you can see, this is our
button on our on-off button. Now you can add other
words just as well. You can add sliders. You can add joystick, can add a value display, an LED, as you can see, even at a gage LCD display,
super charged terminal. You can add different tabs
to your ab time input. And you can even
add a music player. So a lot of possibilities. Now click on the gear icon. This is the template ID, and this is the tile icon. Now you can change it. Now here we have created a template and the
developer mode. Now if you wanted to create
a new device, you can eat. Do that by clicking
Add new device. Now, as you can see here, power on your device
and made sure that indicator is blinking. Now, this feature will help you add new devices and use them, control them using this app. So if you have a smart device, you can turn it on and blink. I will try to detect it. Now if you went
back to the moon, this is the template ID. And again, you can change
the type of this AB, which is the thiol app
key-value type button to Audible app to our collage. And this is everything
you need to do to create a simple app
using that link AB. Now, what you need to do next. Now once you have
created the app and you have set everything, you need to go back
here to your console. And from this menu, you need to create a new device. Hit my devices,
flick new device. And from here, click
from Template. And what you need to choose the template that
we have created. The device name will take
the very same thing. Click Create. And now we have your device. Now, this is the dashboard and this is the
authentication token. So what you need to
do is to copy this. All you can copy the
whole thing and go to your Arduino code simply
based on these two lines. So to move this application, now here we have the
authentication tall. That's it. Now, you're
absolutely the future that blink app on your
phone off and on. You will be able to see the
device on your device's list. And as you can see, the
device is now offline. Now once you click on it,
you can easily control this button to turn
your device on and off. If you have reached this point, then everything is going. Okay. The next lesson we will upload the code or ESP board, and we will taste
the on-off button. Thanks for watching this
lesson. This is Ashraf.
12. 14a Hardware Connection Explained: Hello and welcome
to this new lesson. In this lesson, we are going to explain the circuit connection. For this to work. The first thing
that you need to do is to connect the power supply. Now here we know
for sure that this will be our 3.3 volt pin. So it will be our
power supply pin, and it must be connected to the 3.3 volt. Then right here. Now, we also know
that the 3.3 volt pin must be connected with that. Using this number is just the value here
will be ten kilo-ohm. The next step is taking this wire outside and
connecting it to our button. Now, the other half
or the other part of this pattern will be
connected to the ground. Now this will be our recipient. Now, the next step is connecting 3.3 volt or the VCC
band right here. Let's use another
color connecting the VCC pen to the enabled Ben, which is number four right here. So we need to grab some
and connected here. So now we have V CC ben
injected with a 3.3 volt. Then on the TTL, this is the TTL. The VCC pen is also
connected with the enabled Ben ESP 0 on. Now, it's also connected using a resistor ten kilo
to that second bend, which is the steepen. And it's also connected
to a switch to ground, which is the connection
that we did here. Now, we also have another band, which is the t XD pen. This pen must be connected
with the XD band right here. So TX RX. Now, one more thing
that we need to mention is that we
have a TX and RX pin. Now, we need to connect the
ground pen to the switch, as we mentioned earlier. Now the second pin here will be left without connecting
it to anything. This one is the general
purpose input output pins 0, which is basically that pin that we need to
connect to ground. The programming code. Now when we want to program, we need to press this button or simply connect this to ground. Now, we also have the
last sprint here, which is that then
the RX deep end. And we need to connect it
with the dx. And right here. Now one thing that
I need to mention, this is the whole circuit and these are all
the connections. Now you need to make sure that the r x dx ground and 3.3
volt pins are connected. Now this switches are very important switch because it will help you reset the ball. And you also don't
know all you need to know that the
general purpose input, output when 0 must be connected to ground
during programming. Now other people
prefer to buy a USB to TTL programmer that has all of this built in and that is
specialized for ESP 01. And you can look this
up by searching for USB, TTL, ESP 01. But this is basically
the connection that 3.3 volt then TX RX ground. Now usually the TX
and RX gets mixed up. So if you face a problem, you can switch them. Connect that dx here
on the Alex here, and it should work the switches for reset and the
general purpose input, output pin 0 must be kings to round during
the programming wound. These are the main laws regarding that
service connection. Now, one more thing
is that this pattern, that pattern is basically
a button that you need to press if you saw the connecting line on the Arduino IDE while
loading the code, which is something we will
explain in the next lesson. And if it couldn't
connect to your board, you need to press
the reset button just to make sure that you
have received the board and Arduino IDE light that
code to this board memory. Thanks for watching this lesson. Now, let me summarize
the connection by doing a quick drawing. Now let's say that
this is our ESP. Here we have append that
must be connected to 3.3 volt and must be connected
to a resistor ten kilo ohm. And we need to connect
it with the second. Then after that,
we need to connect switch and connect
the other terminal of the switch to the ground pen. Now this ground men must
also be connected to the ground on our speech TTL. Now this will be left without
connecting tiny thing. This is the general
purpose input, output and 0 must be
connected to ground. During programming. This pen, the forefront
is a negative two dx. Now, this pen must be
connected to the x. This pen must be
connected to 3.3 volt. So we connect directly
with this point. That's it. Now, let
me change the color. This is this pen, this pen, this pen, this pen. On the USB to TTL board. This is the connection. In a simpler way. If you have any question please ask and
you're on the ball. Again, the spins are the
3.3 volt around our x. And this is the ground
pin on the ESP, and this is that it
bends from our ESP. Esp. Thanks for watching this lesson. See you next.
13. 15 Programming The board: Hello and welcome
to this new lesson. Now, let's talk about
how to load your code on the ESP A2 0 or
successes, or ESP 01. Now here I'm using the F to the programmer, and
as you can see, it's called CP 2000s
to your USP to TTL. Now, this is my
ESPs, your one ball. This is the reset button. Here we have the four
wires for power, ground, RX and TX from the module
connected to art board, as we explained in
the previous lesson. Now, after doing
this connection, you will see that you
have a USB port or a USB device connected neural Device Manager in
your Windows device. Now, you'll likely find this
device as not recognizable. So you might need to go
and download that drivers. And you already added the link to the resource
of this lecture. You can go to
Google and dry ESP, 8266, USB drive up
on Windows ten. Now you will end up
with a GitHub link. Now, you can go and open that GitHub link to
download the drivers. But make sure that you
are the first director, which is ESP EDI 266. Now, there is also other links that can be
used to get the driver's. You can simply write cp 210 x USB to your bridge,
BCP and drivers. And you'll end up
with this page. Go to the download section. From here you can select your operating system,
Universal Windows driver, Mac OS, Windows driver, and the driver with your mirror. And here are different softwares for Linux and adult tribes. Now the Universal
Windows driver will do the job and you just
need to go here. Now we reflect on
the device and hit the update driver button
or uninstall driver, and choose the
directory where you installed the driver or
downloaded on your system. Now if you face any problem getting this driver
to be recognized, we are here to help you and
we already provided links to download that drivers
and we attached them. Now, once you have the driver and the
device up and running, you will see this
Silicon Labs CP to 110 x USB to your art bridge. Come eight. You need
to go to your code. Inside your code, you need
to go to the Tools Board, hit the ESP 8266, and from there select
ESP 8266 module, which is the genomic module. Then scroll down to the
port and select column. Once you have done,
hit the upload button. Now, if everything is
connected correctly, the code should be uploaded
without any problems. Now it will take a few
minutes to come up, a few seconds to compile. Then it will solve the
uploading process. Now as you can see, the compiling process
does take some time, like ten to 30 seconds. Okay? Now connecting, different thing is
connected correctly. You should see this lighting and the person that will
keep increasing until it reaches a 100%. That's it, a 100 per cent. Now it's telling you to
how to set via our Ts pen. So simply press the button. And now our code is
loaded on the USBE board. And the next lesson, we will install this board on our module and test it
out using the blink out. Thanks for watching this
lesson. This is Ashley.
14. 17 Final Testing and Code edits: Hello and welcome
to singular song. Now, we have tested the board and our code and we found
out that there is a problem. The board did turn on
and the relay switch, but it wasn't easy
to turn it off. So I have made a few edits
to the code just to make sure that it will work smoothly to turn the
devices on unblock. Now the first thing that
we need to mention is that this re module works just fine. But you need to know that
this module will turn on. If they received, the relay will switch if they receive
an off signal, and it will turn off if
it received on signal. So this is the first
piece for inflammation. Now inside the blink tried
function, as you can see, we are targeting V 0, which is the pen that we use
in our app, or blink AB. Now here's the button. Now, if we received using this function and on
signal or off signal. So if you receive one or
0, alpha received one, we want to store one inside the onLoad and 0 inside
the variable ball of loop. And we have defined
these two variables to be integers up here. Now, the button or fewer
received 0 from the blink AB. We will save 0 inside the
onLoad and one inside the loop. Now, going inside this, as you can see, here, we have the vaults
of the function. Nothing new here. Now, inside the void
loop, blink the tongue. That's the same thing as before. But here, if on Lw equals one, so if you receive an on signal, we will send a signal to 0, which will basically turn on the relay all
switch to relay on. Basically it will target the
anomeric laws of our delay. Now if we received one or
the afloat equals one, it means that we need
to turn off the relay. And it will found a
relay normally open. So we will send high. Now this is again as
the common sense, which is that low is on
and off button our case. And in this module, low means that the
relay will switch on. High means that the
relay will switch off. That's why it's called offload. Now, this is our code
and what we need to do at this point is two, let's say, upload the code. So I will reconnect IS people in front of you just
to make sure that you can see everything
that I'm doing. Now to do this, what we need to do
is the following. This is the relate module. So we need to take off the
ESP Z11 from that module. And we need to place it
right here on our PSP ball. And we already mentioned
that connection, so I won't repeat it. Now, let's connect the wires. This is the ESP sorted with
threads, black with black. And in my circuit, white we'll go with Brown. And the other y and go
with the ESP is L1. So here we have it.
Now we have to ask me, I just need to plug n. They SP port. Now, let me connected. Now as you can see,
our borders on the ESP is what we need to do. Next is simply check
the device manager. Make sure that we are
selecting the right board. Here's the component, come
eight here, and the tools, we have the import
command selected and the generic ESP eight
to 66 module selected. Now upload the code and it will take few
seconds to combine. Meanwhile, let's try to open
up the length pi b e. Now, I will login to my
dashboard to check. Okay, now as you can see, Nicole is being uploaded seven per cent per cent
on moving forward. The core reach a 100%. Okay, now done.
Once you are done, you can hit the reset
button. And that's it. Now what we need to do is
we need to disconnect. The USP will make
sure that there is no power now to move
these four wires. And all they ask people. Now we have the code. So we need to connect
module by module. But it is. Now we'd have two wires, the lungs while is for Vcc. And Vcc is basically
that is y of t. And the other one
is the Wi-Fi AP, which is the ground. So I've connected
with the black pen. Now let's turn it off. Now as you can see, we have it on here, we have all device. It's an offline mode
since a Sunday. So we'll wait for our ball to connect all the Wi-Fi network. Now sometimes you need
to elicit the doubled, but we will wait a few seconds. Now this is the rosette gram. Now, we will wait for the ESP to connect
our Wi-Fi network. Now, let's proceed with
the very final step, which is the finance this thing. Now, this is our device
and this is our switch. Now on, off switch,
the device is on. And you can see
from the blue LED right here is that
the device is on. Now when I switch it
off, as you can see, the blue LED is now the
one underneath the ball. Now it's on, now it's up. The same thing will
happen when you connect the on, off, on, off. Now you can connect and off
your electrical devices using the normally
open and come on pins. Now, that connection is
very straightforward. You just need to connect
the neutral directly from your wall socket to
electric device like a fan. And a new trial needs
to be connected through the normally open and
common pens and our ball. That way, you will be able
to turn the fan on and off via this web interface
or via your mobile app. That's it. This is everything
you need to know. And if you face any
problem and any stage, I'm here to help you fan
flushing this lesson. This is Ashraf.
15. Practical Testing: Hello and welcome
to this new lesson. Now, let's this out this poll. As you can see, this is the ESP 01 connection and this is the speed
to TTL programmers. Now what you are going to do is disconnect the USP and
remove the whaling. Now, let's take away the USBE
board and put this aside. Now, we have our ASB 01 bold, and we have this. This is the module that
we are going to use. It takes five volt DC and
can withstand AC and DC. And here it has the ports, two ports normally closed, normally open and common. The VCC and ground, which takes five volts. It needs five volt operate. So we will connect
ground and VCC from this USP to TTL programmer. Now we need to make sure
that we have five volts, as you can see here. So simply move this pin from
3.3 volts to five volts. So now we have the ground
and five volt pins, which are red and black. Now, let's drink
male to male wires. Okay, I don't have
the same color, so we'll go with this. I have white foreground and
the oral drawn 45 volts. So white foreground and
orange for five volts. Now let's start with connecting that ground
pen to the left, which is the white wire. And the second wire
is the Vcc pen, which is the orange wire. Let's use this screwdriver. Okay? Now, let's connect
the orange wire. Now. We have it connected. We need to play our
ESP bold like this. This part is made
for the SP one. So you don't face any
problem connecting it, as you can see, just
stick it in place. Now, let's connect the
USB port to turn it on. Okay. Now you can see here we have
a blue LED and added let. Now pressing this pattern, who received the SP
bold and it will try to connect Wi-Fi
network again. As you can see on our screen, we have the ESP 8266 tastes. And as you can see here, if we flipped device on, it will turn the device on and you can see
the blue lid on. Now sometimes there might
be a little bit delay. Now, if you click off, it will turn the device off.