100% found this document useful (11 votes)
3K views347 pages

EXPLORE ESP32 MICROPYTHON - Python Coding, Arduino Coding, Raspberry Pi, ESP8266, IoT Projects, Android Application Projects

This document discusses MicroPython for the ESP32 microcontroller. It provides background on MicroPython and how it is a Python implementation designed for small controllers. It then describes the ESP32 chip and how MicroPython has been ported to it, building upon the popularity of the ESP8266. Details are given about the features and capabilities of the ESP32 and how it is more powerful than the ESP8266. The document focuses on introducing MicroPython for the ESP32.

Uploaded by

jose moreno
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
100% found this document useful (11 votes)
3K views347 pages

EXPLORE ESP32 MICROPYTHON - Python Coding, Arduino Coding, Raspberry Pi, ESP8266, IoT Projects, Android Application Projects

This document discusses MicroPython for the ESP32 microcontroller. It provides background on MicroPython and how it is a Python implementation designed for small controllers. It then describes the ESP32 chip and how MicroPython has been ported to it, building upon the popularity of the ESP8266. Details are given about the features and capabilities of the ESP32 and how it is more powerful than the ESP8266. The document focuses on introducing MicroPython for the ESP32.

Uploaded by

jose moreno
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 347

EXPLORE

ESP32 MICROPYTHON
Python Coding, Arduino Coding, Raspberry Pi,
ESP8266, IoT Projects, Android Application Projects

By
Akira Shiro
TABLE OF CONTENTS
PYTHON VS MICROPYTHON - COMPARE & ACCESS
MicroPython for ESP32
INTRODUCTION
INSTALL PYTHON 3
INSTALL THONNY IDE
INSTALL PUTTY
SOLVE PORT IS NOT DETECTED DEVICE DRIVERS
INSTALL MICROPYTHON ON ESP8266 ESP32
HOW TO GET STARTED WITH MICROPYTHON
ESP32 MICROPYTHON WITH RASPBERRY PI
ESP32 MICROPYTHON WEB SERVER
CHANGE ESP32 WIFI CREDENTIALS FROM MOBILE
Download the MicroPython firmware
FLASHING MICROPYTHON USING THONNY IDE
FLASHING MICROPYTHON USING ESPTOOL
FLASHING MICROPYTHON USING ESPRESS-IF TOOL
DEVELOPING AND DEBUGGING ESP32 IOT APPLICATIONS
USING ESPRESSIF ECLIPSE PLUGIN
PRINT FUNCTION
TYPE FUNCTION
INPUT FUNCTION
HELP FUNCTION
CONDITIONAL STATEMENTS (IF,ELSE, ELIF)
FOR LOOP
CREATE WON FUNCTION
ESP32 TUTORIAL USING MICROPYTHON LETS GET STARTED
E4HOME AUTOMATION USING WEBSERVER ON ESP32 SENDING
HTML PAGE DNS MDNS ESP32
BLINK AN LED
ANALOG TO DIGITAL CONVERSION
CAPACITIVE TOUCHPAD
DHT11 -TEMPERATURE AND HUMIDITY
ESP32 INTERNAL TEMPERATURE
ESP32 INTERNAL HALL EFFECT SENSOR
MULTI THREADING
FATAL FURY ON ESP32 TIME TO RELEASE HARDWARE
EXPLOITS
AUTO CONNECT TO WIFI NETWORK
PYTHON VS MICROPYTHON -
COMPARE & ACCESS
Programming is something that every modern makers should have some
grasp. Figuring out exactly what program is best for your particular purpose
can be half of the battle. I've had a chat previously about programming, but as
an overview programming is simply the process of creating instructions for a
computing device to comprehend and execute. These instructions are referred
to as a software. Once the software program is run, the computing device will
perform the specified task. The programming language is a set of commands,
directives and other syntaxes, which gives you a vocabulary to create these
software programs. Now Python and micro path and our power house
programming languages. Each language can support your programming
needs to almost the limits of your imagination. Both languages are
transportable open source growing in popularity, comparatively, easy to use.
And free. They also have similar syntax, keywords and operators. So how
exactly do they differ from each other? Get up, get up, get up, get the fuck
up. The biggest factor is that Python because of its intensive processing
demands requires a full-sized computer. Laptop or cloud server to run
effectively in Harrison, the hardware requirements of micro path and up
orders of magnitude lower. This means macrobiotic can operate effectively
on microcontrollers and microprocessors to clarify a microcontroller is a
compact integrated circuit designed to govern a specific operation inside an
embedded system to the table. I brought an Arduino UNO. Which is a perfect
example of this. A microprocessor on the other hand is an integrated circuit
that contains all the functions of a central processing unit of a computer,
which includes an operating system. Demonstrate this. I brought to the table,
a raspberry PI full model B eight gigabytes, which is a perfect example of a
microprocessor. Both these devices can easily fit in the Palm of your hands
and encourage and makers, rainbows of creativity. Now with most recent
modern technology, this concept of micro Python for credit card size
computers, whereas Python for lodge, computational devices. This concept is
just not become so cut and dry. Some micro processes have become so
powerful. They can functionally run Python. The newest rush reply for model
B eight. Gigabytes is a perfect example. So does it take to make a streamlined
slimmed down Python? Start by ripping out, hates the libraries leaving only a
subset of library. A module is a Python object with an arbitrarily named
attribute, which you can bind and reference. Simply a module is a file
consisting of Python code. A library is a collection of a whole bunch of these
modules. Furthermore, of the few libraries left, remove unnecessary functions
in classes that come with Python. A function is a bulk of code, which only
runs when it's. Clauses are essentially a template to determine variables and
functions of objects. Objects are simply collections of data. Some features
that will not cater well to constraint systems also removed. And some
freedoms with syntax are eliminated. This is a simplification of what Damian
George, an Australian program and physicist did in 2014. Turning Python
into what we see today as micro Python. These changes mean micro Python
is an extremely compact programming language takes up less than a
megabyte of storage space. And underload utilizes only around 16 kilobytes
of Ram. If you're interested in each and every detail at a highlight. Come take
a look at the write-up on this topic, where I go very deep into this jumping
into the computer. You can see on one of the core electronic website, here's a
particular write-up. And if you jump on deep dive on differences between
Python and micro Python, it will talk about the real nitty gritty details.
Between path and a micro Python, both Python and micro Python,
programming languages are free to download and use jumping over here.
You can see where you can download Python and jumping over here. You
can see where you can download micro Python. They also open source so
that it gives individuals the freedom to modify, contribute, and propose
improvement. There are also online. Browser-based emulators for both
Python and micro path. And so you don't even need to download anything to
experience these languages. Also, if you're interested in micro bullets that
will run micro Python brilliantly, come back to that webpage that I showed
you before and under micro Python compatible bullets, you'll see a whole
bunch of micro bullets that will run Python.
MicroPython for ESP32

This is indeed the coveted just before lunch slot. Um, so if any of you feel
yourself kind of slowly slumping over, I won't take it personally. It's. The
way these things go. So I'm here to talk about the ESP 32 port of micro
Python. U m, we've, we've talked about, um, micro Python as a, as a project
overall from Damien talked about some specific application of micro parts
and is a great way to prototype stuff. I'm Anna and I'm coming, you're talking
about this ESP 32 port, which I'm really, really excited about. So it's great to
be able to come and talk about it to you. Um, There's some background about
micro Python, but it's probably not all that necessary since we've already kind
of covered that fairly well. But for anyone who wasn't here before, it's a
reimplementation of Python. I'd say it's a Python because it's very much like
all the other pythons. And if you know how to program Python, you know
how to program Miko Pathan, it runs on small controller boards of various
kinds, including the PI board and the micro bit. And these ESP 82 66 systems
on a chip that have become very popular recently. And now it's got a port to
the ESP 32.
What are those chips? An ESP 82 66, which you can't really see because it's
all. Pretty horrible, um, is a small system on a chip featuring on board wifi
and various other peripherals. Um, they kind of first, uh, actually, before I get
onto that, they're made by a company called expressive who are a fabulous
manufacturer. Um, I think the thing that makes espresso particularly
interesting as the, one of the first of the Chinese manufacturers to really
embrace the open source world, they're very active in a, an open source
community. They're very supportive of our open source development efforts.
Um, and that's really great. And I, um, I think that's been a great advantage
for them as well. Uh, the 82 66 became a real enthusiastic stream, partly
because it's very powerful thought it is partly cause you could get them for
like $2. Um, And the has learned a lot out of that. They've taken a lot of
inspiration from the things people have done with 80 to 60 Sixers, many of
them fairly silly, but nonetheless people have had a lot of fun with them.
People have tried a lot of things. People have put a lot of interesting stuff
together and the company has been able to learn from that and combine a lot
of that knowledge into the ESP 32.
So as I mentioned before, the HQ 66 came to prominence, um, as a. Uh, wifi,
accessory for Arduinos and things like that until somebody's looking at the
spec sheets realized it was well, several times as powerful as the Arduino, it
was helping out. And that this relationship seemed a little silly and that
perhaps we should just develop directly for the 82 66 instead, it's got a
reasonably nice, uh, sea-based um, SDK. It's not that hard to get started in.
But there is a bit of a barrier to entry there. Um, and thankfully someone
Damien ported, a micro Python across to it. I discovered this, I just started
developing some stuff ready to 66. I got really fired up about it after Linux
con Jalong. I think it was got really excited about this whole 82 66 chip and
writing. See again, and I hadn't written C in ages and. Just as the novelty and
excitement of writing, see again, was starting to wear off. My copay thing
came off out. So I let upon micro Python and went, this is the coolest thing
ever. Um, and I got more into it and I got more into it. I got really excited
about it. And then I started working on it sort of just with it. And then I
started running C again to work. And so the cycle, but never mind. So yeah,
following up on the 82 66, there's now the ESP. 32, as I said before, it's taken
a lot of inspiration from what people have done. It's more powerful. Again,
there's two CPU because instead of one CPU core, there's an ultra low power
processor, which is a really cool little accessory. That's really just like a, uh,
uh, very small, very slowly. It's just got enough power to wake up the other
CPS, if something interesting is happening and if you're running on a battery,
that's a really important thing. Runs a slightly faster clock rate. Most
importantly to us, it's got a heap more Ram five 20 K does not sound like a
great amount of Ram to a modern developer. Um, I installed some software,
uh, yesterday to do the machine learning things that downloaded. Um, I
wasn't an a half a terabyte or something of data onto my laptop just to install.
Um, but you. It's enough to be usable for, for Python, for micro Python, one
60 K headroom on the ADC. 66 isn't is plenty enough to run micro Python,
but your applications tend to bump into that limit fairly easily. The five 20 K
gives us a bit of bit of breathing room. It's also got a bigger flash, which is
really nice. These devices are much less powerful than something like an RP
zero w which is the next sort of thing up that you might be thinking of. That's
the wireless PI zero, uh, that's a much more powerful CPU running at a faster
rate. It's got a lot more memory. It's got a lot more ability to expand with,
with flash and things like that. But yeah, provide a little middle ground. It's
an interesting market segment. That's kind of opened up between the eight bit
sort of Arduino AVR world and that RPO world. Um, the 32 is very
interesting because it features as well as the wifi that you know about.
It's got a Bluetooth, um, which is really handy. A lot of things these days
speak BLE of various kinds is great for talking to mobile devices and other
sensors and things like that. It's got more IO lines than the 82 66, which is
really handy. It's got more than one analog input. Um, as Anna mentioned,
there's only one analog input on the. Uh, 82 66, which you can get a little bit
annoying at times. Uh, the ESP 32, you can configure like eight of them and
you can actually change them between pins, which is kind of cool. Um, it's
also got a digital analog converter, which has kind of handy, uh, pulse with
modulation of various pins. They've done a really interesting thing. They've
built a capacitive touch sensing circuit. Into the thing. And so there's eight
capacitive touch sensors. So if your project wants to have a, a touch interface,
rather than a button interface, it's really easy. You don't need any external
components, just a piece of copper, um, which is a really good feature.
It's a really interesting, it tells you something really interesting about their
approach. This may not be the cheapest system on a chip out there, but if you
need no other chips on the board, They can still compete. So it's a really
interesting little way of thinking about it. And similarly, there's that ultra-low
pro power processor and there's even things like there's a whole effect sense
of built into the chip. I think that's pretty cool. Very few people need it.
However it's there. It's easy to make. It's just another piece of Silicon on the
die. If your application does, for some reason, need a high current
measurement device, you can just lay your board out so that the processor has
the power line running right past it. And you'll see a signal on that hall effect
sensor. That's kind of cool. One less component again.

A group of Russians called Zerto bars, a very good at boiling chips in acid,
um, and taking photos of them under a microscope. So this is actually a
picture of a decapper ESP 32. Um, It gives you some idea of, of just how
crazy the architecture of these chips is.
If you zoom in on that top corner there, you can actually see the circuitry of
this thing, the coils and the stuff to make a hardware radio. I think that's quite
fascinating that you can actually do this. You can make coils and wiring and
circuits out of Silicon that are right there on the die.

And it's actually quite beautiful in a strange and. I have no, it reminds me of
maps in those old games, like quake and things like that with the circles and
paths and all that stuff. It's really amazing that this is a thing we can do these
days. I think you normally

wouldn't buy it as a individual discreet little piece of Silicon because frankly,


the pins are far too small and you can't even see them, but they're available as
these sort of modules, which are much easier to solar they're on a 20th inch
sort of picture on the edge.
So you can actually hand sole to them. If you. Work at it. Um, and they're
quite a handy little chip that a little RF screen that tab on the top there isn't
built-in antenna. So you don't even need to deal with anything that isn't like a
digital 3.3 volt line. Um, Oh, sorry. And the, the flash memory is, is under
that little can as well. So, um, it's all, it's all basically there for you to use. It's
quite easy to work with that kind of thing.
If that seems also a little bit too hard to. Um, deal with, in terms of soldiering,
there are lots of these boards available, um, from various manufacturers.
There's a Spock fund one there in the middle, which has got a integrated
battery controller.
The other ones is Ida fruit. Oh, sorry that one's a dev kit. Say the other one is
an Ida fruit fair. Uh, you, I should know that. Does it say it in tiny little
letters? No, it doesn't. Um, One of their Huizar ranged maybe or something
it's got an onboard battery controller as well. The better control is, as Anna
said, a very, very handy, if you want to have some kind of portable device,
cause it's something that's quite easy to get wrong.
So having a board that has that on there, so you can just plug a lipo in is
really handy. Um, so they're really good in those, the standard headers around
the outside, it makes it very easy to get started on this stuff and prototype
stuff together with little wires. Um, All right.
So that's the module. I, it was just talking about community since we're here.
One of the things about conferences is they're very much about the
community and over, about having a community. I think it's really important
that we have a micro Python community, that we have a Python community
and a micro bison community within that. Um, and in ESP 32 microbiomes
and community within the micro Python community.
I noticed this news article the other day, um, Intel launched with great fuss
and excitement, the Galileo platform and all of this sort of stuff. And it was
going to take over the world of IOT and everything is going to be fantastic.
And lots of people have them and yeah, it's all going to be beautiful.
And there was no real community behind it. And so whatever it was a year
later wind hadn't really taken off and everyone's looking at their watch going
out. Did we do anything cool with that? And then, or NICU, they just shelved
it just like that bank. So anyone who spent a lot of time and effort and stuff,
developing stuff or learning about that platform, it's kind of a separated from
under you, which I think is really disappointing.
I mean, it wasn't nice platform. It's just, it was a good idea, but unless there's
a community, a single company, can't push a. Platform along well, they can
for awhile, until I lose enthusiasm that they can't make it a global thing. So it
needs to be more than that. It needs to be a community of people. And that's
something I'm really trying to get going with micro bison as well.

Um, so where are we at with micro? And so I talked here last year, possibly
this very room about, um, uh, ESP, 82, 66 micro bison. Um, and there was a
lot of fun. And at the time there was select much muttering about this new
ESP 32. Those modules actually finally started making it out onto the market
in about November.
Um, and then they promptly disappeared off the market. Again, every single
one of them sold. And then they appeared again here and there in dribs and
drabs. And. Everyone responded to this in the sense of a way by ordering as
many of them as they could possibly get hold of. And then they immediately
went out of stock again.
Um, and finally I got hold of my first ones in November and we could start
working on stuff. Um, Damien got hold of his as well, apparently around
them. Um, because the initial ports, uh, dates back to December, uh, which is
when the ripples started to actually work, um, I can't actually read it. I'm not
very good with dates and times, but I am pretty good at typing.
Get logged into the terminal. So it around December, somewhere there. Uh,
and then I ended up coming across and doing some work on the project with
Damian to get the wifi. Stuff going and TCP sockets and some more support
for other GPIO functions then. And that work, that, that initial work on this
port, um, I'd just like to thank microbic for sponsoring that work.
Um, they helped make that possible to get that off the ground. As a, another
port started on ASP 32, they make a really cool little robot called the Edison,
which is pictured there, which had a little educational robot thing. So I just
wanted to say thank you to them and give them a little bit of a, uh, thank you.

From there we went on and we actually finally admitted we were doing this
thing and stuck it up on GitHub. Um, which is great because it made other
people leapt all over it. And then I went down to limits coffee, Tazzy to kind
of like, you know, launch it. Wow. It's a good excuse. Isn't it? Um, we went
down there and at limits comp, we had support from expressive to make, uh,
a little board called an IO tos, which is this thing pictured, um, Which has a
little, uh, our led display and it has a joystick and it has an ESP 32 on top and
all of that sort of stuff.
And, uh, as I'm working up to my talk about how to develop C code for the
ESP 32, I got up on stage and said, ah, look, unfortunately we haven't
actually got microplasm booting on the IO tos yet. And so on. And the car put
up their hand and said, Yes I have. Oh, right. Okay. Excellent. So, um, we did
indeed get that running on the Iotas, which was cool.
Um, and Jaya who's probably around here somewhere. I got it working with
the Neo pixels on the board and people added more stuff and suddenly we
had a snowball rolling, which is brilliant. It's this community thing I'm
talking about is that we've suddenly got multiple contributors. It's not just one
person or two people or three people pushing this thing along.
It starts snowballing. So that's really exciting. We went from software SPI to
hardware SPI, which was a great start. Um, other functions appeared.
Someone said, why is there no PWM? And I said, of course there's PWM.
And I said, no, there isn't. I mean, Oh yeah, I didn't write that after all. I
thought I had. Oops.
So someone implemented that, which has great, Andy Valencia there, um,
you are support arrived. So now you can talk to all three you out on the
board. Um, Which is another thing that took me by surprise. When I
discovered I actually had three U arts, which was kind of cool, uh, and other
people are adding more support all the time.
I've mentioned a few names here. There are many, many, many more
contributors, um, in the, in the thing get logged as your friend. But I just want
to emphasize the fact, this is becoming a community thing. This is becoming
something that is bigger than just a couple of people. And here we are at
Python again,
what's in progress. Uh, So the ESP 32 also got used on a badge at a
conference in Amsterdam, I think, or near Amsterdam anyway, uh, called
Shi, uh, and the whole bunch of people from that, uh, community have been
putting a lot of effort in it, on things like, uh, Bluetooth, Ellie, and, uh, I think
the same people are involved in the deep sleep thing.
I can't remember now. Uh, those are pull request numbers, uh, and those
things are waiting to kind of get merged back into the main line of a VSP 72
micro Python. But once that's working, it'll support, uh, Bluetooth ele it'll
deep be able to deep sleep so that you can run it off batteries and it can wake
up, do some thinking, go to sleep again.
Um, There's some more sophisticated PWM control available on the chip.
Uh, one of the fun things about this is, is that espresso for kind of doing a lot
of their development of their SDK. Very publicly. This is very unusual, but
they've released a very early SDK and they call it an IDF, um, IOT
development framework.
They released it quite early with a lot of things missing, and then they slowly
adding those things bit by bit. Which is a little challenging at times for us
trying to keep up with, with their development. But it's really exciting as well
because every now and then you'll discover a new piece of hardware is now
available.
I, we also need to have at some point some support for that ultra low power
CPU, because that's a really exciting piece of hardware for anyone who wants
to run stuff on batteries and a really exciting thing. That's just suddenly
become a thing recently. Um, Is to attach more Ram to this thing. So there's a
new chip coming out from espresso or a new module coming out from
expressive soon, which has got four megabytes of onboard, um, Ram serial
attached Ram.
So it's just attached to, um, the internal bus of the, the module and. I think it's
really exciting. Can we make micro Python use this big slice of Ram? You
know, if we've got more Ram available, can Python use that? And I've been
sort of looking at it and poking gently at it. And just before this talk, Googled
it again, and someone's in the meantime implemented it.
So that'll be really, that's, that's pretty amazing. It's um, something we have to
now look at how to integrate that back into the main line of, of micro
Pathans. So it's not to make it too much of a fork, but it's really exciting that
we can now address. That much more Ram. And if you look at the dev kits
and things like that, a lot of dev kits have a pixel map, display of one sort or
another.
Iotas had a display. The dev kit from expressive has one, the badges all tend
to have maybe an ePaper display. Um, they did, it would help lot. I love to
have a kind of standardized frame buffer approach that would work across
multiple of those devices. So everyone doesn't have to reinvent how to do this
every time.
Um, Probably a much lighter approach than you'd normally use for like a web
tech or whatever, but like come up with something. So those are all things
that are kind of in progress at the moment.

So we've got coming up, we've got a, um, a sprint signed up for Monday.
Um, that's really exciting. I've never actually kind of run a sprint before or,
or, um, Participated in a Python sprint.
Um, but I'm hoping it will let us achieve some really cool stuff. Um,
expressive or very kindly provided some support for that. There's a whole
box full of, um, ESP 32 dev kits, uh, for people that can contribute at the
spring. Um, if you happen to have a sprint ticket for Monday, please do come
along. It will be a hoot.
Uh, I think it's not just, I mean, micro itself is written in seat. So you need a
fair bit of C programming ability to, um, make much progress within the guts
of micro Python. But if you do have some C background, it's actually very,
very easy to work on. So, um, uh, partly I guess, because it's relatively
recently implemented and it's implementing quite a modern way and it's.
Quite well-documented internally and all of that sort of stuff. It's, it's a nice
code base to work with. But the other thing is that there's a lot of work that
still needs to be done on this platform in passing, uh, and okay. A lot of work
that needs to be a feedback that needs to be done about how do we make this
a better Python platform?
How do we keep our classes in our libraries? As pathetic as possible within
the scope of, of micropayment. Um, so there is a definitely a role for people
who aren't see people as well within that sort of spring and all of that. And
it'd be great to come and hang out and just, you know, get a chance to talk to
each other about what we're interested in doing and so on and so forth.
Um, Tim who is around here somewhere or another, Oh, up the back, Tim.
Hey, Tim, uh, has also got an SPGA board,
uh, port of. Micro Pythen that he's interested in doing some work with on
Monday. Uh, that's basically running micro bison in a little soft core within
an SPGA. And so there's a whole Python tool chain there, um, that lets you
configure the FPJ from Python and then program the actual running of the
FPGA in Python and so on and so forth.
It's a really interesting effort. Um, I don't think Tim is talking about it this
year, but you talked about it at Linux con, right? Have I got my timeline?
Right?
Right which one I'm talking about, I'll post that link as well. Um, so there's
that. And the other thing I wanted to just mention is I'm, uh, running or
organizing a micro path and meetup group here in Melbourne, uh, at, uh,
connected community hackerspace, which is just opposite Swinburne.
Um, that gives you a chance to come along and just meet up with some
fellow enthusiasts and, uh, do some interesting kind of work. It's very hands-
on space, there's machine tools. There's things like that. Um, Play around
with hardware, have a bit of an experiment, get to know the platform, not so
useful for those of you out of state, but for people who are around here, if
people are interested in running a similar thing anywhere where you happen
to be from, I'm happy to help out with information about that stuff too, and
help get things started elsewhere.
So cool. That's about all I had to talk about. In terms of this stuff. Does
anyone have any questions about these P 32 port or about my career path in
general?
um, I'd heard that there were some issues with the actual Silicon in the ASP
32, in terms of some of the functionality, is that, uh, or maybe you could
comment on sort of just give an update in terms of rev one Silicon out now.
Uh, so you could say that that would imply that there isn't a totally perfect
thing in rev, zero Silicon.
I don't know, specifically myself. I haven't bumped into, into the problems,
but then my, my stuff has occupied a relatively small part of the Silicon. So
I'm not sure. Um, yep.
Thank you, Nick. Um, What's the development experience like, um, on these
chips, I know it's juicy, it's a GCC port, but is there a good GDB, um,
interactive debugging, things like that? Uh, I'm I've been strictly off in the
world of, uh, print statements, um, and logging. Fire that via the serial port.
You're glad to get those out working.
Uh, yeah, so I haven't actually tried using GDB on it. Interestingly though,
the dev kit J or whatever, it's called, not the dev kits to see little ones, but the
big ones have a tag port and things like that on them. So, and I think I'm not a
hundred percent sure, but I think what's on there is so there's a Juul, a USB
converter.
And one of them goes to the standard serial ripple kind of port that we use
and that you flash the chip through it. I think the other one actually goes
through to the, uh, jaytag port or something similar like that. So there's some
circuitry there that I don't yet understand, um, that I think will let you do that
debugging over USB rather than actually having to get out the, the, you
know, old Xilinx jaytag cable or whatever you've got.
Um, Uh, so far though, I haven't bumped into too many things that aren't
solvable that way. Maybe I've just been lucky.
INTRODUCTION
I like to introduce you to the coast. Micropattern for everyone using ESP 32
or ESP two double six, micro biotin is a lightweight version of Python
programming language designed for microcontrollers. We use ESP 32 as the
development board for the school. USPA two double six. Also can use to
learn 80% If you are new to embedded system or, you know, Python
language you want to learn and burdensome.

Don't worry about this bulky wiring based around the projects the SACCR
diagrams are provided for you.
That is the default. And this is plenty with the 0.2 seconds at the end, this one
is blending with one second each and every Lydia is bringing into different
speeds. Multithreading as well.
We mainly use. Windows operating system to explain this project, but at the
same will support for Mac operating system as well as Linux operating
system. We'll also discuss how to solve if the port is not detected in session
three, we'll be flashing microbiota and firmware to ESP 32. The same will
work for the ASPA two w six in session four.
We'll be discussing about Python three syntax. If you already know by ten
three, you can skip this session in session five. That is very important.
Session of the scores will be controlling the GPA pins starting from bringing
an led to multithreading. You can see here, which having them yellow color
that only work with ESP 30.
We know that ESP 32 or ESP do double six. How by Fe connectivity, the
session. And we'll be able to auto-correct by fan into, by using ESP 32 or
ESP, a two double six. If you have ESP, w six already, you can start with
that. We need an DST 11 center module to measure temperature and
humidity. I used LD T3, voltage regulator to regulate the voltage to 3.3 volt,
10 kilo on potential meter. Phew. One kiloohm resistors, 10 to 50 mil jumbo
wires, a mini breadboard. Very most important part here it is. Micro USB
cable. It should be a good quality cable. This will be a kickstart to micro
Python.
INSTALL PYTHON 3
Let's check vitamin three is installed in your PC using command prompt type
CMD in the search bar. So command from this loaded type Python space,
hyphen version.

So I do showing like Python is not recognized. We have been installed by


then to this day. Open a browser and go to biotin.org.
Yeah, you can download vitam version. So it is available for windows,
Linux, and max. So it automatically detects for the operating system itself.
So click over here or it can go to other operating systems and download. So I
am just clicking here.
Then it will get downloaded to your download folder in the case of windows
operating. Go to download folder by 10 is downloaded. Rightly not as an
administrator click on add by ten three point eight two-part install.
Wait for a few minutes, you have sex as fully insured by country in your PC.
Let's say by tennis installed successfully closed this week. No, go to
command prompt by typing CMD. Check it again by 10 in salt. So by ten
three point eight 0.2 is installed. That is showing right now. So you have
successfully installed by then 3.8 0.2 let's check is the five 10 is working. So
to log the biotin type Python here So now the Python Shelly's Lauder Bryn
command. Come in is over. So it should have drained welcome to
microbiomes and goals. Let's see. So it is spender. That means biotin 3.8 0.2
is successfully installed. In some cases, when we died by 10 or when we
check biotin version, then it will show the is not set. In that case. You have to
install the part. Let's see how to set the pot up on command drawn.
Check where the Python is installed by using ware by 10 So this shows the
part of the bite and where it is installed. It is installed app data, local
programs. Copy this right-click on PC. Both the properties, where do
advanced system settings go to environmental variables,

go to part here and here you can click on you and you can pace the part here
you can click on. Okay. So that is a way you can set apart. Once you set apart
again, open command, bro. Check it is installed.
INSTALL THONNY IDE
We need an ID for scripting and managing microbiomes and code. In this
case, we are using Tony ID. Let's install, Tony ID to easy open any of the
browser, go to tony.org.

Tony ID is available for Mac windows, as well as Linux operating system.


Here you can download based upon your operating system. In this case, I'm
going to download.
Tony for windows operating system. Just be here in the case of windows
operating system for other operating system, you can choose. So just click,
then it will get started. Downloading, go to download folder. Tony ID
application is downloader.
Right? Click on the application, click on DNS and administrator click on
next.
Accept the agreement, click on next browse to a proper drive. So I'm keeping
it as a default. Click on next and you can create an desktop icon by clicking.
Here we go next. And just install it. Read for a few minutes. Tony ID is
successfully installed. Click on finish.

Tony ID shortcut is already done. Right turn in the desktop.


Always. You can tell us from the. Double click on the icon, pick on that
scope. So if you have another language, you can choose that Tony ID
successfully loaded.

So by default, Tony ID comes with biotin 3.7 0.7 by default. Python is a


loaded here. We'll check. A default. Python is working using print command.
By 10 is working here. So this is the shell. This is the potential Linda Tony
ID will change the default interpreter later to use microbiota for ESP 32 or
ESBA two WCX.
INSTALL PUTTY
I can cause began install another piece of useful software for windows
operating system called party. It can be used to communicate directly to ESP
32 or ESP similar softwares. Also, you can find for other operating systems.
Let's now insert party for windows. Got a browser. Go to party.org.

Here you can click this portion. So it will get started downloading. I have
already downloaded so you can download and go to download for them to
find this application and download for them. Buddy is already downloaded
that I click and click on install
pig run here. You go next browse about, I keep it as a default click on next.

I short cut to a desktop so you can choose one of this. I'm just gaping this
option. Install. So what is successfully installed? Click on finish icon is
already created in the desktop. We'll be using this application later.
SOLVE PORT IS NOT
DETECTED DEVICE DRIVERS
If the body is not detected in your busy, when you're collecting ESP 32 or
ESP two double six, we have the install communication driver IC majorly of
the development board user CP 2 1 0 X or CS 3 4 0 tips 32. It comes with the
CP 2 1 0. And ESPN two w six Lauren bought it comes with CST four zero
check we'll be installing CS 3, 4, 0 first going to device manager, device
manager, manager. I have two board here. This one is ESP eight, two and six.
This is ESP 32, which users 3, 4, 0 chip. And this is a CP 2, 1 0 chip. So let
me connect C uh, ESP, uh, two double six.

The waste manager is reloader. You can see it is detected something like
USB 2.0 CDL, but the driver is not installed so fast. We have installed the .
Then we'll be coming back to CP 2, 1 0 already installed CP 2, 1 0, and I'm
reconnecting and checking it.
If I can enter the ESP 32, you can see there is something called a port comes.
If I take boards, you can see the column six is I located to ESP 32. And which
users CP 2, 1 0 communication tip from silicone labs. So one, I didn't insert
this one. I already insert, but we'll be checking how to install both. In your
busy. So if I say I'm connecting back to ESP, we'll be installing the device
diver for this one ARPANET browser. You have research CSD for zero
driver wcs.com. Click on this website that is ww.ca wcs.cn. To download the
driver. Click here now website is loaded.
So this is in Chinese. No worries. So this is a driver. You have to install. If
you have a Google translator, you can translate into English.So it's support
CS 3, 4, 0. So many chips they do in support with Desi yourself, see is 3, 4, 0.
So just pick over here to download the software. I have already downloaded
the software, so I'll be going to download for them.

You got it right? You're not an administrator. Yeah. You can click on install
button. It is Xs fully installed right now. You're going to AKI check the
device driver. I'll be reconnecting it. Now in, under the board, he can tease.
He really, USBC is 3, 4 0. It is as in calling five for ESP a to w six. So you
have successfully installed CSV for zero driver IC. So this is the kind of ISIS
this is for using for communication. So let's see. In the case of ESP 32 Danila
is using mostly that is CP 2 1 0 6. We'll be installing that next, go to the
browser. X there's always shows to Silicon labs website, go to Silicon labs
website.

I'm going to use download for windows 10 because my system is windows


10. You can take on download option, so it will get downloaded. I have
already downloaded so you can download it, go to your download folder.
Right-click so extract file. Or extra to a particular driver drive is always good.
So click here. So I'm going to use this one right-click and run as an
administrator click on next finish, because I have already installed that. So
you have successfully in Salta CP Duwan zero communication. I see
connecting those ESP 32, which uses CP 2 1 0 chip. This is the
communication tip over here under the ports. It is . So you have successfully
installed board communication, IC drivers.
INSTALL MICROPYTHON ON
ESP8266 ESP32
Do you want to install on your ESP? Oh, ESP 32. No.

Would MCU then keep watching. So this is surprisingly simple to do so over


here, I've got funny installed on the map. They works the same way on
raspberry PI as it does on windows. So here I'm just using a node MCU,
which runs on the ESP 8, 2 66. So I've plugged that in and what I'm going to
do now at the bottom of the screen there, I click on it. When I click where it
says Python, and I'm going to choose a different interpreter numb here, we
have a list of all the different interpreters
that we can select from one of those is micropolitan on the ESP 8 2, 6, 6. So
I'm gonna select. And then I'm going to click on install or update firmware.

Now I do need to nip out to a website to grab the latest binary of micro
hyphen. So let's head over to Microsoft than to all get that file downloaded.
So over here in micro Python, we're just going to click on the download tab
and then we'll scroll down to see which different boards we can download the
package for. And here we are, the expressive boards.

And we will, the generic expressive ESP 8 2 6 6 module two. We're going to
click on that and then it'll give us loads of different versions of this. And we
just want the top one, the latest one, that's one
point 15 at this point in time. So now that that's downloaded to my downloads
folder, we can head back over to Fonny and then I'm going to click on the
firmware browse button,

click on the downloads for. And then right at the top there, we have the file
up just downloaded. I'm going to leave that as it is now, I'm going to erase the
flush before installing. I'm just going to let it pick the port, which has the
same report. So let's click install and it says there it's installing the store, but
raising flush and within a couple of seconds, maybe about a minutes time, it
will have completed that way. Right. A hundred percent right. Dumb.

We can close that dialogue box. We can click. Okay. And. It will say, please
restart or stop and restart. Sometimes it seems to work, sometimes it doesn't.
And you can also just click on here to go to micro Python generic. And that
also seems to just make it work. So there we go. We can see you've got
microbiome and at one point 15 on the ESP module, USPA 2, 6, 6. So let's
just, uh, import machine.
And then do a DIR machine just to check. We can see that that we've got
Micro-Pak to be installed. So this also works on ESP 30 twos. I've got an ESP
32 here as well. So let's plug that module in.
So we're gonna head back over to the microbiome insight and on that, I'm
going to go back one and I'm going to find the generic, ESP 32 modules. I'm
going to click into that and then scroll down and we're going to look for it.
The most recent stable version.
So some of these say unstable, we want the most recent stable version. So
that's version one point 15. It's going to click that to download it. Sorry, here,
Anthony. We're going to do the same thing again. We're going to click on the
bottom and we're going this time. We're going to choose micropipet and ESP
32, we're going to click on the configure interpreter.

We can now go over to install and update the firmware. Like, would it be.
We can find the firmware that we've just loaded, which is this 15.1 for ESP
32. And then we can just click the serial bottom itself. We now click install.

They should detect that, um, flash. Now, if it doesn't detect the board, when
you first plug it in and report yeah. What you'll need to do is disconnect the
board and then hold down the boot bottle. When you pull down the boot box
and connect the power again, still hold it down and then click install again.
And this time it should detect it, um, to start flushing the firmer. So if I just
moved that up, We can see that, that it's now erasing the flush and

then it'll restart again after it's raised the flush and then start installing.
Sometimes you just need to hold down that boot button once, while you
apply the power, click the install, and then release the boot barn. So we can
see that it's now a righted. So that's completed now a hundred percent and we
can. Exit that, um, have a look and see if we've got plank, bison installed.
Let's click. Okay. And there we go.
HOW TO GET STARTED WITH
MICROPYTHON
We will learn how to get started with micro Python. I will walk you through
in setting up your micropolitan environment and we will also

prepare the development board of your choice to work with micro Python.
For this I will be using an ESP 32 development board from express it, but this
tutorial will be compatible. And would work with other micropolitan
compatible board with some minor adjustments, especially with been
assignments. Maybe sometimes I will be also using this one. This one is held
tech wiped by KIPP, which is also with ESP 32 onboard. Now we are here in
my desktop. I will be opening my. Google Chrome. So in preparation,
number one, download Toni Python IDE from Tony, that org. And since I am
using windows, I will be downloading the windows version and it's also
compatible with Linux, Mac and windows.
So it downloads. And save it to and save it to the folder of your choice. I will
be saving it in the desktop for easy reference. So here, this is one of the best
beauty pool and beginner friendly ID available. We will also use Tawny
Python to erase and flash new firmware to ESB 32 with the help of ESP tool
login. Number two, download the micro Python pyramid from micro Python
that org Mike I, uh, on that or go to download section.
And at the bottom, there is a, by the way, these are the boards compatible
with micro Python. It's a spy board, STM 32. And this one, uh, Y PI with Y
and express E board. Which our ESP 82 66, ESP 32 and tiny Pico. Tiny Pico
is also ESP 32, by the way. So download the generic, ESP 32 model. And
you scroll down, look for ESP 32. Yeah. Download the latest stable version.
So for the stable, these are the stable versions or this one, one point 13, it's
newly released last, uh, September two. So I will download this one and save
it to the folder of your choice. And I will choose again, the older I created in
the desktop with Microsoft. No number three, download the ESP 32 USB
driver from Silicon labs website. knobs. Yeah, this is why. And this. It's
under the side labs that com and download the software. I am using windows
10. So I will download this one and say it again to the polder of your choice.
Yes. So you beat again in the desktop micro Python folder start gunboat.
Okay. Number four and pour later, references, download the pin assignments
or pin pin outs, or a schematic diagram of your development board. You will
be needing it later on to know, let's say the pin assignment of the onboard led.

So I have here, a copy of the Venus are immense for this. Uh, ESP 32
development board. So I will post the link of this for you to download and
also have the schematic diagram.
But this one is not exactly per this like, uh, development board, because I
think this one has 36 patience while this one has a total of 30 pins on the, this
is, uh, This is do it ESP 32 dev kit version one with 30 pins number pipe.
Now that we have all the necessary files, let's install the Toni Python IDE. So
let's install the Toni Python in the stack. Micro Python folder, Toni Python, I
D E. Next step. Yes. Maybe create the stock shortcut or ECE references and
installed Tony Python is beginner friendly ID because it is simple to use. And
all the necessary tools is included such us repo, terminal Python, editor file
access to micro Python file system. And even flashing the micro Python
theorem, where, and these are all available in graphical user interface. Now
don't think one lines all is click here and there in one simple IDE of course
there are more feature rates, applications available. We can look at such SBS
code, but as of this moment, let's just use Tanya Python for simplicity. So I
will click penis. Number six installed that ESP 32 USB driver. So I will
extract this one using a seven zip extract, two same folder and look for, okay.
X 64, because I am using 64 bit windows and just click. Yes, the next. And
finish. Let's verify if the installation of the USB driver is successful by
connecting the ESP 32 to our computer, then right.
Click the start, start button and look for device. under the device manager,
click pour the ports. And if you are successful installing the USB driver, you
should see the Silicon labs CP 2 1 0 X USB two U R breeds. We'd come
number.

And as for me, this is come pour, take note of this because we will need this
one later. Before we can begin using the ESP 32 per micro Python
development and programming. We need to erase the original film where,
and then plush a new firmware with micro Python, interpreter installed. So
let's open the Tonya Python. I already have the micro Python inside. So that's
why I'm having useful prompt of the micro Python. But for the sake of
tutorial, I will show you how to plush the ESB 32 with new layer to do that.
Click the tools menu in the Toni Python, manage plugins and in the search
box type E S P tool and hit enter, click install, and give it some time
downloading Dan. Okay.

Then when you see that and installed both on here, I will just click close.
Now we are ready to plus a new payment where to our ESP 32 to do that,
click again, the tools menu, then select options and click the interpreter tubs
then. Which interpreter or device should Tony use for running your phone? I
will select ESP 32.
It could be circuit Python, but I'm at the probe or micro Python by using the
BBC microbiome or micro Python, ESP 32 82 66 or micro Python, generic.
This one is using piebald. So let's select the micro Python ESP. And in the
ports select the correct compart, which is comb. Pour, then click open the
dialogue for installing or upgrading micro Python on your device. I will click
this one and in the port select again, they come poor and in the Pilgrim where
select brow. And go to the folder you choose before I choose the one, the, the
microbiome on Paul there in the
desktop, then I will select the bean pile, which is the PM where with micro
Python interpreter installed. So I will open then make sure that the erase
plush before installing is tick or check should be. Then click install. Give it
some time until this one is successful. Okay. Erasing is complete.

Now writing now it's flashing a new firmware to the ESP 32 leak. Okay.
Click close and click. Okay. Now the micro Python is successfully installed
to the ESP 32 development board. Now we can check this one. We can test
some code.

Let's make the onboard led lights on and lights off, making some codes,
import machine. And let's create a burger bowl, L E D N set it to the pin into
the onboard led and, and let's set the pin direction to output. And the turn on
the led, we just need to send L E d.org.
As you can see the led onboard is turn on to turn it up. You're saying led that
off like that, or led that value equals one or N E D. That value equals zero,
but turn it. Or led that value to through or L E D that value to false, very easy.
Right. And you can make it without compiling. And the moment you send
the, the code, like this one led that value to them. The moment I press this
one. The onboard led will turn on. See, it's very fast. You may ask how about
to blink the onboard led just like the blink example of the Arduino to do that.
We need to import time or delay import time. Okay. Now while true. So to
turn it on L E D that on, we need to wait some time or delay some time. So
that is a time at this time that is sleep. Let's say for 500 milliseconds, 0.5 L E
D. That oh, and time that is sleep. 0.5.

So when I hit enter twice, it will execute the code one, two. And as you can
see the led, the onboard led is now blinking. Just like the blink example of the
Arduino ID. That's all for now in the next week, we will learn what is
microbiota. And how it works, or any question John or suggestion regarding
this tutorial, please feel free to write it in the comments section and I will be
happy to answer it.
You may also interested to check out the companion blog posts of this
tutorial for additional information at tech thinker, blogspot.com. And if you
enjoy this video, Give me a thumbs up and share these to your friends and
subscribe for more. Be just like this. Thank you. And have a good days
ahead. See you and the next week.
ESP32 MICROPYTHON WITH
RASPBERRY PI
We'll demonstrate how to set up a program in ESP 32 microcontroller
running micro Python from a raspberry PI. All my tutorials are fast paced, but
the code notes updates and more are available on my website. And as always
a link will be placed in the description.

Here's an ESB 32 breakout board connected to a 16 by two LCD display


showing temperature readings from a DSA TB 20 sensor connected via a one
wire interface. This is a standalone setup, but ESB three twos can easily
transmit temperature and other sensor data wirelessly from multiple remote
locations to a central server, such as a raspberry PI.
Here's the JQ 6,500 sound module connected via you are to an ESP 32. The
module lets you store and play audio files. The motion detector is also
connected to a GPL input pin. When motion is detected and interrupt fires
and a sound place. The ESP three, two is a very powerful and versatile chip.
Here's a generic ESP 32 breakout board. And I got an eBay for a few dollars.

They're sold on alley express for around the same price as my generic E-bay
version out of fruit also has an ESB through to board with battery support
called the who's on 32 it's part of their feather series.
It's more expensive, but they offer a large selection of add on boards with
features such as a real-time clock SD card displays, GPS and more. Another
board is the PI comm YPI 2.0, which is compact. Has an RGB led and has an
external intent option.

The MP3 two is designed for efficient wifi and Bluetooth, including
Bluetooth, low energy or BLE. It has powerful 240 megahertz dual core. My
controller with five 20 K of S Ram. The chip is designed for mobile devices.
So it has ultra low power consumption. There are three, two GPL pins with
support for I squared, C I two S by and you are in addition has multiple
analog to digital channels and digital to analog hardware, accelerated
encryption pulse with modulation capacitance, touch interfaces, and a bunch
of. The built-in wifi makes the SB 32, a great solution for road devices, such
as sensors, inputs, and relays. If there's interest, I'll probably turn this project
into a series that demonstrates connecting sensors to the SB 32 in detail and
using network messaging protocols, such as MQTT to report data back to the
PI wireless.
One of the main reasons I like the ESB three, two is that you can program it
in Python, more specifically micro Python, the very efficient streamlined
version of the Python three programming language, which is optimized to run
on microcontrollers, such as the SB 32. The raspberry PI is great for many
projects, but it's a full fledged computer with a Linux operating

system for simple, repetitive tasks, such as monitoring sensors and


controlling relays. It's often easier, cheaper, more reliable, and more efficient
to use a microcontroller, which boots up instantly and just runs your profile.
Especially if your project uses batteries or solar, because the ESP through
two uses a fraction of power required by the PI. Also many sensors have
settable interference, especially on longer wire runs. A more reliable
approach is to connect the sensor with a short wire to an ESP three, two, and
then transmit the results using ethernet or a wireless protocol. To get started.
The micro Python firmware needs to be uploaded to the ESB 32. This can be
done with a simple USB cable, which provides a two-way serial interface
between the PI and the SB 32.
It also provides five volt power on a breadboard. I have an ESB 32 breakout
board next to the board is an old grasp PI B plus, but any PI should work. I'll
plug one, ended up the USB cable into the pie. The other end plugs into the
micro USB port on the ESP 32 board. The red light indicates that it's got
power.

Now for the software first, please make sure the PI is up to date from a
terminal type pseudo app. Get update and C2 app get upgrade. She used the
latest version of raspy and Jessie to ensure you have all the necessary
software or utility called ESP tool will be used to upload the micro Python
firmware it's installed using pseudo PIP three install ESP tool. I'm using PIP
three to target Python three. Okay. That's successfully installed now type D
message grip, TTY USB.

This shows that a CP to 10 X, U R T USB bridge is attached to port TTY,


USB zero. Some devices need to be put into programming mode using the
push buttons on the board before you can use the SB tool.
However, I found it's not necessarily on the ESP. At least not on this one to
test the connection type ESP tool PI double dash port slash dev slash TTY
USB zero followed by the command flash ID. This query is the ESB three
two for basic info, such as the chip type, ESB 32 and flash size four
megabytes.
It looks like everything's okay. Before uploading the firmware, it's
recommended to erase the chip. I'll use the up arrow to recall the last ESB
tool command and change flash ID to erase flat. This gives us a blank slate.
Okay. The chip erase completed successfully. A copy of the micro Python
firmware is required.
You could build it yourself from the source code on the GitHub repo, but it's
much easier just to download a daily, build open a web browser and go to
micro python.org.
Click the download tab, click ESP 32. Currently only one firmware is
available for the ESB 32 click to download it. Once that completes close the
browser.
The micro Python firmware build was downloaded to the downloads folder.
LS shows a long file name, highlight the name and copy to the clipboard or
recall the last ESP tool command. This time erase flash has changed the right
flash hex, zero specifies the starting address to right type download slash for
the downloads folder.
And then just paste them the firmware file name from the clipboard. The
firmware is now being written to the SB 32. It's pretty quick, but I'll speed it
up. So you don't have. It verified. Okay.
So the board should be ready for coding. Micro Python boards have a
redeveloped print loop or rebel, which is a simple interactive programming
environment.
It's similar to the Python idle shell on the SB 32, the rebels access to using a
serial connector.

Other boards like the ESPN , which is a very popular predecessor to DSP 32.
In addition to a serial rep will also have a web rebel, which allows you to
imagine program them over the web. this feature has not yet been
implemented on the ESB 32, along with many other features, but new stuff
has been at a daily.
there might be more options for now. We'll stick to cereal, the same USB
cable that we use to program the USP. 32 can also be used to access the
router.

Any serial programs such as putty or screen should work. However, these
programs won't let you manage the SPF 32 file system, which can be used the
story or programs.
Ideally, you want a program that provides a rebel terminal and also can
perform file system commands. I've tried several programs and currently my
favorite is our shell. It can be installed using pseudo PIP three, install our.
This simple program will run on the raspberry PI for its access to the rebel
terminal in the ESP 32.

It also provides file management to transfer, manipulate files on both the PI


and the ESB 32 installation is complete to start our shell type. Our shell
double dash buffer size equals 30 PTAC P dev TTY USB zero. Okay. Our
shell is running and is connected to the USP. The current terminal can be
used to execute file commands.
For example, type boards to list all connected boards. The single board is
returned with ID PI board, which we'll need it. As a reference later, the boot
PI file automatically run a startup and contains low-level code to set up the
board and finish booty. You typically don't want to edit it. However, you can
add a file called main PI.
If you need to run your own code as startup after the boot pie type rebel to
open the micro Python programming environment, the terminal will now
accept Python. Print. Hello, world outputs. Hello world. Let's try something a
little more colorful. The typical first program has to blink an led instead of a
regular led.

I'll use a Neo pixel ed.


This is an RGB led with a built-in chip to control, color, and brightness. It
can be driven using a single data line, and it's very easy to connect to the
ESP. A five-year-old pin provides power.

A one end 4,004. Diode is used to drop the Neo pixel voltage from five volts
to 4.3 volts, which allows Neo pixel to read the ESP 30 twos, 3.3 volt data
output the MP3 to 3.3 volt output needs to be at least 70% of the Neo pixel
supply voltage to register commands.
If the Neal pixel is running at five volts, then the ESB 32 is below this range
at 66%. But at 4.3 volts, it's good to go at 76% a ground from the ESP 32 is
connected to a ground on the Neo pixel. GPL 13 is connected to data in
please note that a single Neo pixel can use up to 60 mil amps at full
brightness.
Therefore, if you want to run a strip of LEDs, I use an external power source
to prevent damaging the board. And a fruit has several helpful tutorials
regarding Neo pixels, and I'll put links up on my website and ESP 32
breakout board is plugged into a bread. One problem with this particular
breakout board is that it's a little too wide and only one row of pins is
accessible in the ESB 32.
They do make versions that are narrower and more breadboard friendly. The
five old pin from the SB 32 is connected to a five volt rail. A ground is
connected to a ground rail. I'll add the Neo pixel ground first it's best practice
to connect the ground. First I, when disconnecting the ground should be
removed last here's an eight millimeter Neo pixel.
It's placed with the flat side on the right. So the third pin ground connects to
the black ground jumper. One in 4,004. Diode is placed between the five volt
rail and the five old pin on the Neo pixel. Again, the diode has a voltage drop
of 0.7 volts, which ensures the Neal pixel can read the ESP 30 twos, 3.3 volts
output instead of a dial.
You can also use a level shifter on the data line to convert between 3.3 volts
and fighters. Finally the data in pin on the Neo pixels connect the GPL 13 on
the ESP 32. Okay. That takes care of the hardware. Now let's write some
Python code, minimize our shell and run idle three. Create a new file from
machine pin is important.
The pin library is very similar to the raspberry PI GPO library lets you
reference it and control the ESB 32 GPIO pins from Neo pixel import Neo
pixel. This library drives Neo pixel LEDs and strips. From time imports,
sleep micro Python is a subset of Python. Therefore it doesn't have all the
standard libraries.
For example, an easy way to cycle RGB led colors is to vary the hue between
zero and one. This can be done with the HSV RGB method, which is part of
the Python color system. Right. Since it's not included with micro Python, I'll
just paste the HSV to RGB function into my code from the color SIS library.
HSV is a common cylindrical coordinate representation of points in an RGB
color model. This function simply converts an HSV value, hue, saturation,
and brightness to an RGB value. Red, green, blue. I'm not going to explain
how this function works because it's not relevant to this tutorial, but all the
code is on my website.
If you want to explore it. The Neo pixels instantiated on GPO pin 13. One
indicates the number of LEDs, Neo pixels are also sold in strips of LEDs and
he can control multiple using a single GPO pin. Spectrum is a list to represent
2048 colors. This first range of zero to 2048. And the second is 2048 to zero
to try statement, to catch errors, wraps the main wild loop, which is infinite, a
four loop cycles through the color spectrum range.
He was said to a value from zero one, which is divided into the 2048 steps
NPS zero. Our first, the first Neo pixel led Millie have one for using this trip.
We could reference other LEDs. The HSV to RGB function has passed the
hue 1% saturation and brightness and said only 15% to make it a little easier
to fill MP right sets.
The Neo pixel led to the specified color loop sleeps for 10 milliseconds and
continues except as used to gracefully exit the program upon control C finally
ensures the led is turned off by setting red, green, and blue to zeros. Okay. I'll
save the program. I'll call it RGB pie and put it in the documents folder.
Back in our shell. I type control X to exit the rebel, but I'm still in our shell
LS list.

The contents of my home directory CD documents, switches to the folder


where I saved the Python program. Ellis again, shows the file. RGB PI LS
slash PI board shows the file contents on the ESB. 32 PI board is the ID for
the ESP 32 that we determined earlier using the boards command.
Currently the SB 32 only contains the boot PI five. CP RGB PI slash PI board
copies the RGB PI file to the ESP 32. Now LS slash PI board shows the RGB
file list successfully copied rappel to return to the micro Python rappel import
RGB loads and runs the micro Python program. Back on the breadboard.
ESP32 MICROPYTHON WEB
SERVER
My project are fast paced, but all the code notes updates and more are
available and website, and as always a link will be placed in the description.
This is the third in a series of ESP 32 project. The previous two demonstrate
the basics of installing and using micro Python within ESP 32, and also how
to connect and control Neo pixel LEDs and DHT 22 sensors. I recommend
you watch them. Building on the two previous project, we'll start with a web
page that shows the temperature humidity from a DHT 22 sensor connected
to it. It used to be 32.

The page will automatically update with new sensor readings.


Next we'll create webpage with a JavaScript dial to remotely control the color
and brightness of a Neal pixel RGB D attached to an ESB 32.

All the time tools from the two previous project have been installed on a
raspberry PI three running the latest updated version of Raspbian stretch. I've
also loaded the latest micro Python firmware onto an ESB 30. Specifically,
uh, we most Loland 32 in a terminal start by running our shell to connect to
an ESB 32 on T T Y U S. all Penn tack a to enable ASCII and code binary
file transfers, which currently I find to be more reliable also at TAC E nano,
this enables editing files directly on the ESP 32 with the nanotech status.
Unlike the ASPA 2 66, the SP 32 version of micro Python. Currently it
doesn't remember your wifi settings. The web server will require network
access. So I'll create a Python script on the ESB 32 to automatically connect
to my wifi network on boot and it slash PI board slash main dot PI creates a
new file that will be saved in the ESB three twos route. Main dot PI as a
reserved file name that automatically runs on boot up after the boot.py file
important network loads network library, station instantiates, and network w
land and enables the station interface station active. True activates the
network interface. Station connect connects to my wifi access point. The
method takes two parameters. The first is the SSI ID of my access point,
which is row Tron. And the second is the wifi password. That's all it takes to
enable wifi control owes saves the file and then control X exits nano upon
exiting our shell automatically updates the ESP three to with the edited file
LS slash PI board shows the newly created main.py file I'll type rebel to enter
the micro Python.
Now when I press the reset button, the SB 32 reboots the main.py file is
executed and ESB 32 establishes a wifi connection. Okay. The ESB 32 is
connected and it's assigned the iPad.

He address ten.zero.seven dot 39 for the web server.


All be easy and open source micro Python library called micro web serv
created by a fantastic programmer named John Chris. He's done a great job,
making a very powerful, lightweight web server. That's easy to get up and
running on the and also Python modules. It supports route handling and
posts. You can exchange Jason format on HT methods to implement a full
rest API. It works with Ajax even supports web sockets for real-time data
exchange. I'll probably make a future project just on websites. The library
also provides a Python template language, which lets you create dynamic
web pages.

In addition to regular static, HTML pages, it can serve most of the popular
web mime types, such as HTML, CSS, JavaScript, images, PDF, CSV, zip
XML, and more. You just place your files in the web path and then they can
be requested by a web browser. I'll scroll up and copy the repo address to the
clipboard. Minimize the browser, then open a new terminal window. In the
home folder type good clone and then paste in the microwave, servant dress
from the clipboard. Okay. The library has been downloaded. LS shows the
Michael Webster folder CD into the downloaded folder at Les tack.
It shows all the files that came with the library. These need to be copied to
the ESB three to the first. I'm going to delete some unnecessary files to save
space and expedite the transfer. RM dot get tack RF deletes the good folder.
We don't need the license file or the read me file.

Or the config dot Yammel file shows what's left since we already have a
main.py file to handle the wifi connection, I'll use MV to rename the main.py
file to start that PI this is a web server example that demonstrates many of the
libraries features. Let's take a look at it. Idle three, start up pie opens the
example file for editing micro web server,
which is the main web server libraries imported a function called HTTP
handler test. Get handles a get. Gets our web requests that return data, as
opposed to posts, which are used to submit data such as a form, content is set
to a string of HTML content, which includes a placeholder for the client's IP
address below the IP address is a simple form with the first name, last name,
and a submit button HTP client.
Get IP address dynamically populates the client IP address, please. HTTP
response, right? Response. Okay. Serves the page. There are no headers
content type is text HTML Carr said
is a UTF and the content equals the contents during above there's another
route handler called HTTP handler test posts.

This handles posted data from the simple form above when the user clicks the
submit button form data is retrieved using HTP client read request, posted
form date.
First name and last name are extracted. A content string is used to display the
posted names. HTML escape is used to ensure the return strains are safe to
display, which is a good security practice. Again, write response. Okay.
Returns the response to the browser. As in the previous get handler the
following four methods demonstrate WebSockets, but I'm going to save those
for a future project.
The two route handler methods that we just looked at above are defined.
When a user browses to the route test. If the request is a get than the HTP
handler test get will be fired. Otherwise, if the test route is hit by a post, then
the HTP handler test post method will be fired. A microwave servers
instantiated and pass the route hand.
The library was originally written for the Python module, chooses a slightly
different route path and ESP 32.

Therefore I'll add the web path argument and set the value to slash www
slash. This just tells the library that our web files will be stored in a folder
called www on the ESB 32, the next three lines of this example, handle web
sockets.
And finally start as used to start the web server threaded false to turn off
threading, I'll save the one change to the example. Okay. Now let's copy the
contents of the microwave server library and examples to the ESP 32. It looks
like I forgot to remove one file. RN, boot dot PI deletes a sample file called
boot dot pie. We definitely own a copy of this to the ESB 32,

because it would overwrite the existing boot.py file, which usually you
shouldn't modify unless you know what you're doing. Okay. Now everything
looks good. I'll close the second terminal and return to our shell control X
close to the rappel, but we're still in our show.
CD micro web serve switches into the microwave serve folder. Well, it looks
like our shell doesn't support uppercase a, which stands for almost all,
apparently lowercase a for all woodwork, but it doesn't really matter since I
already deleted the hidden get folder. Ellis alone shows the content which
will now copy to the ESB 32, our sync dot slash board sinks, all the files and
folders in the current directory to the ESB 32.
LS slash PI board says that all the files, including the www soap folder have
been successfully copied for apple starts the micro Python rappel import start
starts the web server or not. Apparently I have a bug in the start.py file
online, 80 a problem with an RX. Okay, control X exits the rappel back to the
main our shell terminal edit slash PI board slash startup PI opens up the
startup PI file residing on the ESP three two for editing there, 86 lines.

So the bug online 80 should be close to the bottom. I'll scroll all the way
down. I see the problem. A dash instead of an equals.

It should be web path equals slash www slash control. Oh, saves the edit and
control X exits nano and updates. The SB 32 with the file change. Back to the
rappel. Since the web server library crashed upon the last import, I'll press the
reset button on the SB 32 to start with a clean slate.
Otherwise there could be conflicts import start again. Now it's working
correctly. A web server is running on the ESB 32. I'll switch back to the
chromium web browser and browse to the ESP 32 IP address HTTP colon
slash slash ten.zero.seven to 39. Followed by the path test. This hits the test
route, which fires the corresponding get handler.

The IP address of the raspberry PI is displayed along with the simple form.
I'll enter a first name, last name and click submit. This hits the test route
again, but this time it fires the post handler, which simply returns the names
from the field. All right. We've got a working web server. In addition to the
routes, the micro web server library can also serve regular HTML files and
most common mind types.
Switching back to the micro web server GitHub site and listing the www
folders show several example files, index dot HTML.

As a basic webpage styles are loaded from an external CSS file. There are
common HTML tags and some sample text upping images displayed, and
there's a hyperlink to download a PDF file. The next example file is tests dot
PI HTML. This demonstrates the Python templating language double braces
designate code blocks high is used to define a function test function. You can
use loops. You can use if statements you can call defined functions. All this
code is run on the server when the webpage is requested and the results are
returned to the browser in the address bar all type HTTP colon slash slash
ESP three.

To address slash index dot HTML. The sample H mill files returned. There
was an image style text, and a link that when clicked, downloads a PDF file,
changing the web address to test dot PI HTML loads, the Python template,
and example the white text on black show. Some foreloops there are function
calls and only the third LF was true.
The included examples provide a wealth of information to help you get
started. Now let's build on these examples by adding a temperature humidity
sensor, and a Neo pixel led to our web server, the DHT 22 temperature
humidity sensors connected to the ESB 32 3 0.3 volt powers provided by the
ESB 32.
Along with the ground. The sensor data line is attached to GPO 15 and Neo
pixel led is also connected. Five old power from the SB. 32 is stepped down
at 4.3 volts using a diet. The grounds are connected and the data inline is
attached to GPL 13. Here's what the components look like on a small
breadboard.
I've already gone over Neo pixels and DHT 20 twos in the prior two project
of this series. If you're interested in more installation details, please check
them out. And my website also has the wiring schematics and additional
pictures back in idle. I have a blank Python file from Michael F serve import
micro serve for a machine import.
From DHT import DHT 22, the sensors instantiated for the DHT 22, a route
get handler method is defined called HTP handler DHT.
Get a try statement, wraps the sensor measure call TNH are set to the return,
temperature and humidity. There are checking confirms that all instances are
float values. If so the variable data set to the format of temperature and
humidity, Elson and valid reading errors recorded and accept throws at the
sensor cannot be right.
Right response. Okay. Returns the response headers is set to no cash because
we always want to display the latest sensor readings content type of set to an
event stream because I'll be using server center fence to ensure the sensor
readings on the webpage are updated. This is a simple alternative to web
sockets and is a good fit.
When the updates only go in one direction from the server to the client,
although server send events do have limited browser compatibility compared
to the more popular web sockets Carr said is UTF. And content is said to the
data, which is formatted for the server center fence. A single route handler is
specified for the DHT route upon a get request.
It'll fire the method bub to return the DHT 22 sensor data micro web serve
web servers and stains and created and passed the route handler and the www
web path.
The start method starts the web server. I'll save the Python while and the
documents folder and call it DHT underscore web dot pie. I'll close the idol
exit out of the river.

And exit out of our shell CD to the documents folder, where I saved the DHT
underscore web Python file. Now let's create an HTML file to periodically
pull the DHT route nano DHT dot HTML creates a blank HTML file to save
time I'll paste in all the code.

We've got a basic boiler plate HTML file with a few additions. A single div
with ID result will be used to display the sensor. This grip will pull the DHT
route, approximately every three seconds, which I believe is the default for
server sent events, error checking ensures that the events sources supported
by the browser. If so a source variable set to a new event source and pass the
host name, which will be the IP address of the ESP 32 followed by the DHT.
Source on messages fired when the events source receives new data from the
server, it populates the result. Div inner HTML with the updated temperature
and humidity readings. Again, server send events may have browser
compatibility issues. This simple code is just for demonstration purposes
control. Oh, save the HTML file and control X exits nano I'll reopen our shell
Ellis shows the DHT dot HTML file and the DHT underscore web Python
file. C P D H T underscore web dot PI slash PI board copies. The Python file
to the root folder of the ESP 32 CP DHT dot HTML slash PI board slash
www copies. The HTML file to the www web path folder on the SB 32
rappel returns to the rappel import DHT underscore web starts the web
server, no errors this time.

I'll open chromium on the PI and browse to HTTP colon slash slash
ten.zero.seven, 9 39 slash DHT dot HTML.

The webpage shows 27.2 degrees Celsius and 33.4% humidity and the data
updates every few seconds. Since the low end 32 has a battery check, the SB
32 board can now be placed anywhere within range of my wifi access point,
where I want to check temperature and humidity via the web.
For the last example, I'll create a webpage to control the color and brightness
of a Neo pixel led control. See stops the web server and I'll press the reset
switch to get a clean start and then press control X to exit the rappel back in
idle. I have a new blank Python file. The first two inputs are the same as the
previous example.
Then from Neo pixel important Neo pixel and import Jason to manipulate
Jason data variable, NP instantiates, a Neo pixel on pin 13. One indicates a
single led a route handler called HTP handler led posts will handle Jason
posts, content and sent using the HTP client read request content method, a
color sticked will store the posted color data.

Jason load converts the Jason color con. Blue green and red are extracted
using this comprehension for the color stick MPA, zero sets the Neo pixel to
the specified RGB color. I'm not sure if there's a bug in the Neo pixel library
or if it's just my Neo pixel lad, but the argument order is currently green, red,
blue, instead of red, green, blue, as it appears in the doc.
NP right. Displays the specified color on the led HTTP response, right
response, Jason. Okay. Sends an okay response back to the browser. A single
route handler handles the led route for posts and fires, the above route
handler method accordingly the micro web servers and Stan shaded with the
rod handler and web path, then star is used to start the web server.
I'll save the file and the documents folder and call it led_web.com. I'll close
idol and open a new terminal window to control the color and brightness. I'll
use an open-source JavaScript hue color wheel for HTML five called hue
wheel. It provides a donut shaped control that affords color and brightness
settings for both mouse and touch support, click hue, wheel.men dot JS, then
click RA and right click to save the JavaScript file to the documents folder.
Now let's create an HTML webpage to host the color wheel and interact with
the Python led right. CD documents. LS shows the downloaded hue
wheel.men. JavaScript file nano led dot HTML opens a blank HTML file for
editing I'll paste in all the HTML code, which is similar to the DHT example,
the hue wheel.men digest files imported also underscore dot JS is imported
from a CDN.
It will be used to throttle the Jason posts. The body has a container div, which
holds a diff for the hue wheel and an info.
The script defines a throttle set color function, which calls the underscore
throttle method and passes the function set color, and 400 milliseconds for
the wait time. This prevents a page from overloading, the web server with too
many posts.
HW is set to a new hue wheel when the wheel changes color or brightness,
the unchanged method is fired and cause the throttle set color function. Most
of the other settings are just defaults. The set color function will post a
specified color to the web server. The info div displays the current RGB
color, red, green, and blue color.
Jason stores, the RGB color data, red, green, and blue in adjacent compatible
format. X HDP is set to a new XML HTTP request. XH PDP open sends the
post to the HTTP colon slash slash followed by the ESP 32 IP address
followed by the led. Set request header since the content type to application
Jason X HCP send post the color Jason data.
This will fire the led route handler on the web server and change. Neo pixel
led color control over to save and control X to exit back in our shell LS
shows the led underscore web Python code, the wheel JavaScript library and
the led HTML file.
CP led underscore web dot PI slash PI board copies. The Python file to the
ESB 32 root directory CP hue wheel.men dot JS slash PI board slash www
copies.
The JavaScript file to the ESB 32 web path folder CP led dot HTML slash PI
board slash www copies. The HTML file to the SB 32 web path. Rappel
opens the rep. Import led underscore web starts the web server, although the
webpage and my mobile phone, as I slide the touch dial, the Neo pixel led
color changes, pressing the brightness ring changes the led brightness.
CHANGE ESP32 WIFI
CREDENTIALS FROM MOBILE

You can change the S with a D to wifi, SSL ID and password from the
mobile app. After changing the assessor ID and password, I will turn on and
off led to show you this project is running successfully to access the internet
via ESP today.
Do we need to connect it to a nearby network? Suppose I have to connect
ESP to my home router.

A simple way to provide router access ID and password is wire code. If you
are using this technique, then you know that whenever you doubt your
password changes, you need to make some changes in code. And as your
code changes, then you have to reapply code the code.
That's why I have developed this project where you can connect us with a D
two to any network using mobile app. I'm going to use the Bluetooth function
of ESP to change wifi name and password. Let's start with the catering
ceremony, opening the Google browser search for things we don't pump.

I have already account. If you don't tell them, create first to your email and
password. And signing. I have created DeGeneres before create new tenant. I
signed any name I'm going to assign yes. With they do best. Make sure field
one boxes checked, scroll it down. And save cannon
to make sure what is running successfully or not click on API keys from API
keys. Copy. I tell food.
Control C open new tab based here, change field one value to any of new
medical value, like 99, enter, open your things speaks or what, but I will view
you will see same or lose in period level. Mentors or what is working now
close that no, Deb next step is to create mobile app or creating a web open
new tab search for MIT app inventor.

Create apps, start new project assigned name. I'm going to assign ESP to test,
press. Okay.

This is the homepage of MIT app inventor from user interface. Take list
picker, change properties change wit to fill parent, please. Okay. Jenny fold
change font. Change font size and now change text Jen specs to connect to
Bluetooth. from layout

change, parameter change to feel better and do same procedure. One more
time. Dan take one, one more. and change a bit to feel burdened from user
interface. Take level lazier. take one more level and place into the next next
box. Less text book one and text box to change. Parameter of level one
change with, to feel parent fund and on-site.

Then speaks to society. Select text box one select phone to work on-site is 20
with which is feel pattern. It is hint. do same thing just with the next box
change, take sides, font, and wit, and text to password. Do same procedure
with the X-Box too. Okay. From layout. change parameter to
take label and take change with it. It is text. I'm not going to use this label
change button barometer with, to fill parent foreign sites. It's 20 use font,
bold and change text two. And that
from layout take coriander regimen. Change parameter with, to fill parent
same from layout, take vertical arrangement. Um, I'm going to do this, put it
under regiment five. Okay. Lit select vertical arrangement change with two
full parent. This. Okay. Take two and take one more, more than three and
place below, but then too, Jenny parameter of going to change with two will
parent risk. Okay. Change font size to 20. Change change X to L E D on
those same procedure with button three,
instead of led on 10, takes two led of From connectivity, select Bluetooth
plane mode will appear at below.

Now half part is done. Next part is connection log Magnum. From block,
select variable. First take initiative, global name and change variable. Name
to S ID and second variable name to password. Select from text, we're able to
condition a done now from list picker, one select list picker, one dot before
picking, and let's pick one after picking. so let's, let's pick her one and say list
we one, not eliminate to block from Bluetooth. Plant one, select Bluetooth
client, one dot address and names. From the speaker one select block. Okay.
Set list. Bigger one dot selection to block. And from Bluetooth client one
select call Bluetooth client one dot connect. And select address from let's pick
out one blog, these pick bigger one dot selection. So like button one, button,
one click function. When button one is click, we are going to send. As his ID
and password said necessarily take a society from textbooks. One dot text.
And say global password from X-Box dot texts, textbooks to dot texts from
Bluetooth client one select. Call center call due to plan one, doc, send text
going stream.

they can distinct assign in middle. Now get what the variable for two variable
is a society. And second variable it's password safe, globalized society, and
get, get globalized society and get global password in middle tech comma.
We are going to send this to everyone to Now, when we turn to it's click. This
is led on button. Now we have to say URL first set. We have one dot URL
from text, take empty string in this thing. We are going to copy you, Aaron.
And from one call with one dot get function, button to function is ready. We
need this URL. Copy this URL from things. Speak server,
click on API keys. Copy this right. Jennifer URL, copy control C and based
here. Control V. Jen filled one value from zero to one. This function is ready.
Now make a duplicate of this function,

instant of button too. Right. But then three, this is led off function and change
string failed one. It will do one. Two failed one equal to zero.
What entry function is also ready? What block diagram is ready now,
download the app from build and save Epic and fire to my computer.

I'm going to save on next door. I didn't see many mites.


Now you can see they pick a file more this, a bigger file to your mobile copy.
Open my computer, opening their mobile. Internal storage and based in any
Florida install this app and your mobile open file manager, open Epic FIS it.
We'll see dot APK. Yes and open mobile app is ready.
Now, next part is to write ESP 32 code from file. Create new file closed
previous one. Okay. No, save this file. First use any folder I signed name
same. Now write the code to save time. I have already died this code. You
can download this code from Udo description. Control a copy and paste here.
We need to make few changes before install this code.

First channel number copied channel number from things with server open
things, speak.

click on API keys. You will see channel ID

control C copy, open ID DoubleClick, close update, play and control V.


Now next it, that API key, same copy from things with et cetera, open
Arduino ID. Okay. Double click and paste. Next part is your router, SSL ID
and password. First you can assign any . Afterwards, we can change this SSI,
then password from mobile app. This is the password. Don't change the
meaning part of the code connect ESP hundred two to your comfort.

From tools, select board I already selected board is ESP 32. They model and
same from tools,

select communication poll compote. In my case com port is 12. Now upload
the code.

It will take some time. Code is uploaded. Make a connection. As per the
circuit diagram, you can download the circuit diagram from the description
below with the alphabet board,
I will develop this circuit diagram. There are two LEDs and one switch
switches used to change the password of the router. Green entity is used to
indicate we are in Bluetooth mode and ready, ready, ready? It used to on an
awful purpose, I'm going to power this circuit using compote. Final output.
First, I'm going to turn on my mobile hotspot. If you see SSI ID and
password, this is the same, which I have used in program this. Okay. Now.
Open mobile app. I said the circuit.
Now, if you press on the red led will done on same. If you press done led,
we're done up now. I'm going to change. Password off router. I'm going to
change SSI society to any name like M M M five times M. And I'm going to
change password any number like eight times nine. and press okay. Now
open mobile app. Now, if I turn on led, if I press led on led will not turn on
because our ESP 32 is not connected to any network. Now what I'm going to
do, I'm going to change password first, down on Bluetooth.
You will see here because I already paired with this with a do. If you are
using, if you are, your device is not where your device is available in
available devices.
Open app one more time. And if you press connect to BT switch, you will see
ESP t-to device here.
No. Now first pressed switch to enter into the Bluetooth mode. Green green.
Ready? We'll turn on to indicate we are in Bluetooth mode now please
connect to Bluetooth switch, press ESP 32 and now type SSI ID and
password, and now type new SSI ID and password as society is five times M
and password. Is it eight times nine? Right. Green led will turn off when this
access ID and password is successfully.
The seal now plays led on led will turn on and press a lady off. Uh, Lily will
turn off, turn off. You can change password as many times as you want.
Download the MicroPython
firmware
We'll be discussing how to install microbiomes and framework to ESP 32.
Same way. You can also install two ESP ADU, double six. For that you need
a framework open any of the browser and go to micro biden.org website. You
can go to downloads under download tab.

There are so many boards and it's frame where you can download out of that.
You have to find four. Expressive ESP based bots. It is categorized based
upon the board, which you have. You can download the frame where in my
case, I'm using ESP 32 Borneo. So I'm clicking on gender ESP 32 module
available here. these governments are very important commands. These
commands will be using on the coming week.
So just come do the frame where right now we have a lot of options
available. So these first few it is showing is unstable. That means let us
torsion that they're working on it. So if you wanted to work with the latest
one, you can choose any of them. If you under the use with the stable version,
you can go with any of this. So I am just trying with, uh, the latest one. I'm
going to use this unstable one for right now. So I'm just going download. I
can save to download folder name. You can change otherwise, just keep it.
Yeah. The extension of this file is being filed. I'm just saving this. If you are
using USB a two double six, you can go to download and under expressive
baseboards, you can go to ESP ADW, six module. From there, you can
download the latest versions so you can download this and you can use it.
FLASHING MICROPYTHON
USING THONNY IDE
We'll be looking at how to flash micro Biten Fenway to ESP 32 for that.
Yeah. The open Toni ID go to tools. Manage plugins here. We need to install
one plugin called ESP tool. So type here, ESP tool search. My case USP tool
is already installed.

This is satisfied. Otherwise there is an option to install with gum. You can
click on that.
After this go to tools, options. Interpreter default, interpreter will be Python
in Roberta. You can change to micro Python interpreter here. Two options
are there mainly. Micro Python, ESP 30 and micro Python, ESP ADW six.
Mostly we are discussing about these two boards. The other boards also are
available here. I am using ESP 32 board here. So I'll be selecting this one and
you had to choose a port already. We have downloaded and installed the
driver. Make sure that you are using a short USB. Otherwise, there is a
chance the port will not detect.
So if, if it is detected, it will show exact board. You have to click here, same
board, you have to navigate to where it is the frame where is downloaded.
Make sure that erase flash before installing click on browse. And here, this is
a bin file, which we have already downloaded.
Select that one. Click on open. Now you have to click on install before
installing. We wanted to know about something. Two buttons are here. This
one is enable button, and this one is booked button, press the boost button.
You must press the boost button. I'm keeping like this same time. You can
click on install. So I'm going to click on install. And just release that boot, but
now you can see erasing flash is the raised the flash

no it's doctor uploading the new framework, this uploading 5%. That's done.
Just wait for a few minutes. Now when you successfully flat micro by frame,
where to ESP 32 board that is asking to click on hard reset button. Hard reset
button is Ian pin over here. So before disconnecting the power, you have to
click on reset button on this one.
This is the mode one. This is a reset one, press. This one. So, this is the way
you can reset. Maybe you can try one or two times click on. Okay.

You have successfully uploaded your micro by 10 frame where now you can
disconnect close Tony ID open again, Tony ID and reconnect.
check it is detector from port click on that click on. Okay. And click on reset
button. Yeah, before that it is get lauded. As you have to click on reset
button, you can see here, these micro potential is loaded. I'm just trying with
a brain comment in Biten three's index. The print command is if it is a string
in the double codes, you are able to type what do you want it to get it? Print?
I just given just hallowed is up in command. So I'm going to print it. Here,
this is working under shell. So if I end up this quarter, we'll go to ESP 32 and
it runs over there and it responds will be available in the shell. It is blended.
Hello world, the responses. Get him back to our shell available here. Also
connect with Patty. Let me close this.
Open the application. This case we are using CDL communication. So click
on CDL communication, and we know that gong, it is six default. The board
rate is double , double zero. Is that the foldable rate? So you team the default
board rate here and then after that, just click on enable preset button.

Now you can see micro Python is lauded using party application here. Also,
we can try the same. I'm going to endo. So it doesn't reflect the bipolar. Also,
you will be able to kind of do ESP. This is the easiest way you can apply
micro Python fan, where to ESP 32 as well as ESP, ADW six.
FLASHING MICROPYTHON
USING ESPTOOL
We'll be checking using ESP tool or hub to flash micro-biome undo ESP 30
to go to micro pattern website, click on downloads, find out what board ESP
dirty too. These commands are very important here. These comments are, we
are going to use make sure that ESP Dooley's already installed.

Let's check ESP tool is installed or not open command prompt, just type
CMD, three installed ESP tool. And this case, the requirement is satisfied.
We have already downloaded the frame where if you haven't then go and
download the frame where this is the command to erase that. Data in ESP 32
bays that you have to change the boat name here it is showing the board name
of the Linux for the windows.
It is comm six in our case. So how to check, go to device manager under
device manager, check on the ports. You can find it is connected to column
six, go to command, prompt change. It does calm. Where calm is in Capitola.
Does you have to press the boost button in the ESP 32 and ender and just
release the board button within one or two seconds.
Now it started raising the fresh successfully raised. Now it is asking to reset
that heart reset. You have the press Rhonda enable button or reset button in
the ESP 32. Next step is to upload the framework. I'm going to create a folder
under you might do that. I'm going to say, see, use us under you might do.
I created ESP 32 folder. Inside that I have saved this bin. Fire that to come to
command prompt, just copy the next agreement over here and paste here. Do
things you wanted to change.
You have to change the board, us calm six, which we know calm six. The last
one is a bin file name that also you have to replace with that. Let us
downloaded one. Just copy the file name. I have copied,

I just based it all over here. Press the boost button and end up just release. .
It's not working. Okay. The issue is the folder, which I selected is wrong. So I
have to go to ESP 32 folder command is CDSP 32. That is a folder, which I
created and just list those things just . So I can see all the frameworks, all the
files over there just paid the same command.
Only. Just change the bin file name. By copying from here,

this space here, enter before that you must press boot button anda and release
the boot button in one to two seconds gap. Now it is start to writing now it's
80% of Java
now successfully flat. Micro-biome frame where you have to reset by
pressing enabled or reset button in that ESP 30 to just open party redefined
ESP 32. You can open.
Now the shell is loaded here. just check with bring command. And this
command is working successfully in case if we haven't installed ESP tool
properly.
Then we have to set that ESP to part. So we'll check how to set the part off
ESP tool. First, we have to check where it is a USP tourists installed go to
command prompt,
just typed up command peep show hyphen F ESP tool, which shows that
follow where it is installed. This is the part of the ESP tool where it is.
Installed, just copy the spot control.See right-click on the specie. Go to
properties, go to advanced system settings there. And

when Mendel variables is there, click on. And when burials go to bat and
click on new, already have set the pot. You can click on new, if it is not set
and. Based up path, which you have copied and click on.
Okay. So if you do that, you can avoid these kinds of issues. Like ESP tool is
not recognized.
FLASHING MICROPYTHON
USING ESPRESS-IF TOOL
We are going to flash micro Biden to ESP 32 by using another software from
Xplosive open any of the browser and go to expressive website so we can
search explosive. Explosive is a manufacturer of ESP 82 and ESP two double
six chip Ganga, two softwares.
You can go to support. Under downloads, you can go to tools. Okay. You can
choose. Yes. 32. It's already showing itself. That is flashing downloads.

This is the tool we under the use here. Flash download tool for USPA two
double six, ESP 32. And it's let us associate that is ESP 32 S so you can
download the software.
I'm just downloading the software. There is only work with windows
operating system.
Download ones, download, go to download. Application is downloaded. Now
you can go to download folder. You have to extract this extract here option,
or this option can be used. I'm using this option
extractor on the Fordham, open inside flash download underscore tool. This
is the application.

Click on Vernazza administrator can give on developer mode here.

We have different options based upon which is your development board. You
can choose that if you're using ESP eight double six, you can click on that.
If you're using ESP 32, you can click on that. My gaze I'm using ESP 32. So
I'm clicking over here.
There's the interface here is a area where we wanted to upload our frame.
Where is a area we want to do, where we want to do say the code, the
location we have to give first, you are to come over here. Select compote six
default board rate is double one, double zero. This is the first option, not the
last option.

So these two things are selector. And first we can erase click on the board
button in the ESP 32 and click on erase after two seconds, you can laser
board button. So I'm going to click on your highs and what button is already
pressed and released.
So it is showing it is finished. Right. That is successfully. It is erased.
Now we'll check is have any framework using party default settings already
there ESP 32, which we have done. And last time and pecan. Yeah, you can
see a random areas are coming. That means the frame where we erased. So
just closes.
Okay. Then here we have to click on this three dots, go down, download
folder where it is already downloaded, select this been fired, and

we cover here which location we wanted to save for that you can open micro
Python website micropattern.org.
Go to download.

What our board ESP 32. And here we look at this, the program female
location is this one. Okay. Just copy this location. That is zero X one to build
zero based that here.

Done keep remaining. Same press on booed button in the ESP 32. And here
you have an option to start so you can click on start.
Same time. You have to press on boot button and hold for two or three
seconds. After clicking on the start button. I just released. Now you can see it
is just started uploading the frame.

in the command prompt. It is showing that Bates also it is successfully


flashed. Micro-biome where to ESP 32, you can even check by using parti
and click on a reset button. Don't forget to click on reset button, always the
frame where will not save, just click on frame, reset button that is enabled.
But. On ESP 32 and open. See it right now. Micro Biden is loaded. It's
Shelly's loaded here. You can drive with the brain command stri. All right.
The sprinting that means successfully.
We flashed microbiomes in a frame where two years, Peter ditto, the same
way. You can also apply a frame where to ESP eight to double six. This
application is only able to work with windows operating system. Make sure
that before using this application, you have installed ESP tool properly. How
to check that I'm disclosing them.
Go to command prompt. If you under the install, if you haven't installed ESP
tool properly, like Amanda install, ESP tool pro is PIP three, install E S B.
There's is like a man you can use to install the USB tool. Then only that
particular application will work.
So this is already satisfied. Other way you can check ESP deal is installed or
not list command. So USP tool is one of the thing that is ESP. Two 2.8 is
already in installed. So first you can use this command list to check puppies
installed properly, but it's not installed. You can use this command to install
that ESP.
DEVELOPING AND
DEBUGGING ESP32 IOT
APPLICATIONS USING
ESPRESSIF ECLIPSE PLUGIN
Expressive, uh, is most well known for the ESP 82 66 and ESP 32 wifi
enabled microcontrollers, which offer a very accessible way to start an IOT
project. Uh, these chips are used in consumer devices, such as smart home
devices and appliances and some industrial applications, uh, for example, in
data collection gateways and so on.
Especially if itself is based in Shanghai and has offices in China, India, and in
Europe, in the Czech Republic with employees working remotely from, uh,
seven other countries as well. Uh, if you aren't yet familiar with the specific
products,

I'll briefly introduce them, uh, on the next slide, wifi and Bluetooth enabled
microcontrollers or systems or chipped or SOC, uh, as we call them are the
specific, main product I'll show the comparison of the SOC.
Uh, we have right now on the next slide, but. Uh, the ones that, uh, we need
to keep in mind are the ESPN two 66, ESP third shoe. And ESP urge us to
based on the SOC is expressive also designs modules, which integrate
additional components, such as SPI, flash, and Ram, and some passive
components. These modules, uh, go through certification process, uh, and do
not require too much effort to be integrated into products.
Next the development boards. Uh, these are based again on espresso chips
and modules, and they include other components such as power supplies, um,
and debugging interfaces, uh, USB connectors, and so on, uh, shown here is
the ESP 32 cutsie, which is a very common and simple design. Um, there are
also many third-party development boards, which are based on a single form
factor.
Other development boards, uh, include displays, sensors, audio, codecs, and
so on. Next on the software side, especially it provides free software
development kits, which can be downloaded from GitHub for all of our
products. Typically these SDKs are built around a real-time operating system
and they include, uh, other approved curriculum, library sessions, book, or
peripheral device drivers, wireless and TCP, IP stacks, uh, false systems and,
um, some high-level protocol libraries.
I'll tell you more about one of the SDKs or the ESP idea in a minute, the most
recent addition to expressive software is the cloud solution. ESP Rainmaker.
It provides end to end connectivity between an IOT device, the cloud, and the
smartphone app, making it really easy to prototype and deploy applications.
Uh, we're not going to go into the ESP Rainmaker in this talk, but if you're
interested, check out a specific website, what details.
Let's have a quick look at the ESP 82 66, uh, the ESPN and ESPN 32, and
how they compare to each other. As you see the, all these microcontrollers
have on order of few hundred kilobytes of Ram, a 160 to 240 megahertz CPU
frequency and a variety of different peripherals.
Uh, the code is typically stored in external SPI flash memory. And, uh, also
additional external SPI Ram can be connected to the, uh, ESP, ESP 32 and
ESP.
Yeah. Uh, here are some more details about the ESP 32, a stew, which was
launched this year. Uh, compared to the ESB 32, it has improved
cryptographics accelerators and physical security features. Uh, it has larger,
uh, OTP, key storage. Uh, it has hardware, digital signature module. In
addition to the flash encryption and secure boot, which were present in the
ESB 32 is, uh, used to be threatening.
Uh, the microcontroller has a wide range of peripherals and these can be
multiplexed to annually 42 general purpose iOS. Uh, especially if it has a
couple of development boards, which make it easier to start a project based
on the ESP 32 S two, for example, here on the left, you see the ESP 32 is to
sell a one. Okay. So that's, uh, that's it for the hardware part and the
introduction let's move on to the ESP idea,
the specify OT development framework. USPI DF. Um, has been in
development by expressive since 2016. As I mentioned before, it is built
around free artists real-time operating system. Um, the framework redundant
CNC plus plus contains more than 70 libraries.
Uh, we call them components. These components can cover many areas. Uh,
for example, drivers security, fall systems, utilities, networking, provisioning,
debugging, and probably some others. Uh, there is a large number of
examples and we have online reference documentation USPI of major and
minor releases are maintained for three months and we do prepare the bug fix
releases.
So what's inside. ESP idea is ESPN is built around a set of command line
tools, uh, such as system, uh, K conflict configuration tools. Uh, it's the
same, uh, tool set that is used in Linux kernel and other real-time over
insistent projects, such as, uh, not excellence zipper for configuration, uh,
GCC Kampala, new debugger, and also multi-view Python scripts, which are
either driven by CMake.
No, for example, for co-generation or invoked by the user directly, uh, like in
the case of flushing the application to the development board or setting up
some security related features or doing tracing or debugging, uh, and the goal
is to integrate all these tools into the ID.
These tools were all built with command line interface usage in mind.
Um, but eventually we want them to be a natural part of the integrated
development environment. Um, on this diagram, you can see, uh, the
different tools that we have and how they relate to the integrated development
environment. On the left side, uh, there are tools related to installation
configuration and the build process.
Uh, the integration between ID and see make is pretty standard. But for the
other parts of the SDK, we had to introduce new user interface and who could
into the build process. Um, then on the right right side, you see the parts that
are related to running the program on the development board and to
debugging, uh, the GDB integration again, uh, ease the existing part, uh, we
are using, but for other aspects like, uh, size analysis of fleshing, uh, serial
monitor, Tracing, we have to implement some custom logic and the UI in the
plugin.
I'd like to finish my part of the talk by mentioning a few challenges we met
when adapting the CLI tooling to, uh, ID. Okay. Uh, the first is that the
command line tools, uh, had to be augmented with a machine output mode,
for example, to produce Jason output instead of a human readable list or a
table. Uh, this is especially tricky if the tool is running some lengthy
operation because, uh, progress reporting needs to be implemented.
Um, and the, the other, the other case is propagating errors from the COI. To
the user so that these errors, they, uh, they can be, uh, found in the ID
perspective.
The second one is, uh, related to users expectations about the installation and
onboarding process. Uh, when we work with CLI tools, uh, multiple
installation steps are required.
For instance, uh, we get some prerequisites and store clone, a get repository.
We were on a certain script. Uh, we install drivers, we set up environment
variables and so on. And ID plugin takes over many of these steps, but at the
same time, users get less visibility into the underlying process. Uh, and it is
harder for them and for us to troubleshoot, if anything goes wrong.
So when an ID or an installer attempts to sets everything up, expectations are
higher and we need to be mindful about collecting enough information about
enough logs and data about the system, so that in case anything goes wrong,
we can find the reason. And, uh, the final one is related to automated testing.
Uh, automated testing, I think becomes more challenging for, um, an ID tool
kit compared to a set of command line tools. Uh, of course having this, the
test for the underlying tools in the first place gives us more confidence that
the tools themselves work fine, but due to different release cycles of the SDK
and the ID plugin, we may need some regressions due to the changes in the
argument's interfaces and so on.
So testing becomes very important, um, for an UI UI based application, it is
often less straightforward than for the command line tools. And this is the,
uh, the other thing that we are seeing. Uh, this concludes my part of the talk
and I pass it onto conduct to tell us more about the ESP RDF plugin for
eclipse and show how to use it. Thank you. bHi, everyone. Come to the ESP
idea of eclipse plugin session. Um, as I went, I already spoke about ESP idea.
Uh, I'll give you a brief idea on the eclipse login, uh, for an ESP idea, and
then we'll get into the demo part. So eclipse plugin is, uh, developed based
upon the eclipse CDT, uh, eclipse. It is one of the most powerful ideas for
developers it's been used for years, and it has a lot of features which are
required for developing and debugging the applications.
So what we are trying to do here is hands the eclipse CBT, um, providing the,
um, the required features, uh, especially for a specific, uh, ESP developers.
So this plugin is our label for windows, Mac Reyes, and the Linux platforms.
And it's suppose for ESP that they do an ESP, that is two obligations. Uh,
here's the current status of this plugin is an open source.
Uh, it should be able to access directly from the GitHub page. So if you guys
would like to contribute anything back to the, uh, to the plugin, that would be
great. So we have already released, uh, the one major version, um, So when
that full, currently we are running with the one dot two dot three, I would say,
which is just a lazy day back.
So that's suppose, uh, uh, eclipse 2019 September version, which is a four
that 17 version. And if you want, if you guys wanted to access the update and
eclipse CDD, you should be able to use the update site, or it is also available
in the eclipse pocket marketplace.
So here are the set of features it provides, um, As what we are trying to do is,
uh, as ESP idea fees, having, uh, um, doesn't set up features.
So we are trying to simulate all those features, using an aid in the ID so
quickly. Let me, uh, get into a demo part. So all eight. So I'm already having
the eclipse CDT, uh, which is for that 16. So once you, how, uh, eclipse led
what the next step would be, uh, you need to install the, uh, idea of eclipse
plugin using the update side.
So once that is, then you should be able to see all the specific features or
plugin features within your eclipse eclipse. Uh, the first thing, what you need
to verify is you need to make sure that you are in the CDT perspective. So
this I can represent CC plus plus then you can go to, uh, help you wanted to
download and configure ESPN.
So, yeah. So, all right, so this is the, uh, this is where you can choose whether
you wanted to install the new ESP idea of, or you wanted to select an existing
DSP idea of directory. If it is already installed. So, for example, if you want
to do, uh, install the new one, you can choose anything from this list.
So just lack of time, I already installed the, the master version of ESPN.
Yeah. So I'll just go with an existing one. So for that, you just select this use
and existing ESP ID of directory from the trial system, then going brows,
your ESP ID of the fleet. So here's the one, this is my ESP IDF, which is
already installed.
So just click on open and finish. So what this did, was it just configured your
idea from this code path to the selected ESPN directly and based upon that, it
is trying to ask you, do you want to install direct flight tools for the selector
DSP idea? Uh, since the tools will rally for ESPN, ESPN, your version.
So we might need to install the, the tools required for that. So I'll just click
yes. Find.
So if you want, you can choose a good and Python executable. So what I can
do is probably I will set up the, uh, the Python three, so clicks installed all.

So I'll just make it large. The visibility fine as I can see.


Uh, so what this does, is it invokes some of the commands from the ESP idea
of as a good, see, it is trying to invoke idea of tools, install our command. It
will install all these quiet tune chains, which are required for, for ESP idea of.
And, uh, after that, it also, uh, configured the Python environment, pot, the
ritual by Don environment, with the pot, which you are given.
And, uh, finally the, it expose all your tune parts to either keep CDD bill
environment. So as you can see, uh, the configured CDD bill environment
variables, you can check the preferences here. So if you wanted to see
whether all my environment variables are configured or not, you can just go
to, uh, and just go to preferences.

So in the CC plus place the bill. And environment s


o eerie could see all the parts which are already configured. So my bot
contains all, all the tools, information along with the, uh, like Python, what
are the excludables, which are required to run your DSP audio commands.
Dogs are configured the see, make pot cool spot.
Uh, since we support like ESPN do on ESPN two S two, we are configured.
Uh, so these are automatically configured as part of it, but also check the core
build tool chains where under the Caldwell tool chains for
So that's pretty much from the preferences. I'll just go back to the, the reason
it took very less time for this, since the tools are already installed it, just
trying to verify whether it is installed or not, if it is already installed, it just, I
know I just keeping the download part of it. So that's the reason we could
able to install very quickly.

So next thing is I will, we'll go ahead and create a product. So create a new
project here. So let's go with a simple example. Like maybe we want to play
it another way. And for now we will select one of the Hallowell template
from the existing list, which we get it from IDEO. Fine. So just click on
finish.

So this creates the simple Hallowell application.


Uh, let me open the file. As you could see the, the structure for the CME
ESPN product. So we'll also have a build folder. And currently it's an empty
and under the main, you should be able to see all of the source content.
So we're here. Uh, here's the simple, uh, Hallowell example, which we
wanted to run and build it.
Uh, please ignore this FSTs will be resolved once you build the application.
So once you created a product, the next logical step would be, we need to
decide to which, uh, built or gate which board we need to build this
application.
So here's the one you need to select the launch target. What I'm going to do is
I'm going to play it a new launch target, just kick on new launch target,

click on ESP dog gate USP, 30 to finish.


Fine. You can just go ahead and click on bill.

So this is going to take a couple of seconds.


So the bill is completed, uh, as you could see, uh, the moment the bill is
completed, all the risks are resolved, uh, for your project.
So the next thing is, so this icon represents a bill and the next icon next to the,
uh, this bill represents a flash. So it'd be, let me check with, uh, I selected the
light, uh, uh, the CDL port.
So this is the, uh, the serial port for my device. Uh, here is my device, which
I'm trying to, uh, program it. This is ESP. fine. So click on finish, and you
can just click on run. So this will actually flash it to the new eyes.
So it's going to flash it to the device now. String to connect to the serial port
and writing our app to the, to the board. So this is done once this is done,
maybe you wanted to see how my program is getting executed. So for that,
uh,
you can launch the, um, serial monitors. So here's our Cedar monitor ESP
idea of CDL monitor.
So by default, your CDL port and board rate is selected based upon the
existing . So click on finish

it's just trying to restart a 10 gets here, uh, in this loop now. So once this is
done, it will restart the boat. So as you could see, it's getting this started
again. Fine. So this is about the, uh, the flashing into the device and, uh, We
also have other sort of features like you wanted to see the memory obligation
usage for your application.

So that is our level as part of the obligation size analysis. So click on this.

So this will launch the obligation size analysis. As you could see in the value
section, it gives an Hy-Vee a high level overview for your DDM flash food
and the static data usage. This is the pictorial representation for the same.
And in the detail section, you could, you could also able to see how each of
the file are each file as getting used. And what does that mean? What do you
for each one of the, of the symbols? So it should be able to even, you know,
sod this memory usage, and also it should be able to even search a particular
file from here.
So that is about the application size analysis editor. Um, other important
editor, which we provide is as DQ configuration editor.
So using an as degree conflation editor, it should be able to configure any
project or chipped related settings. At the board level settings, for example,
now we are using an ESP 30.

Do you want it to make any ESP specific settings? So we should be able to


do it from here. So all you have to do is just to make a change and click on
save, and it will be saved to the, uh, to the, uh, uh, application.
Um, you can also see the preview of this changes. Um, as you can see, these
are the set of change. Uh, the moment you make any changes, it will be
reflected as part of the preview app. The other feature, which we added
recently was ESPN channel. So to access the ESP ID of tenants, select the
project and click on the, the terminal icon from here.
So choose the ESP idea of tenant from the list of tenants click on. Okay.
So this will be launched by default in the hello world. Application has, you
can see this is launched at the root directory of follower. This Verde followed
comes with all the environment variables, which we already configured for
the earlier project.
For example, if you want to check, click on EMV, as you could see, the pot is
configured with also Delphi environment variables, which are required to
then, uh, some of the commands from the terminal. And as you also could see
openness, it scripts, IDO bot, everything is configured as part of the internet.
So the reason why we introduced this ESP Turner was to, to access some of
the, uh, ESP ID of commands, which are not integrated as part of the
initiatives.
For example, ESP called down DDB subdue working. So these features are
not integrated as part of the eclipse tidy, but it should be able to access those
features directly from the ESPN of 10.

So the next feature which I wanted to talk is, uh, the open OCD debugging.
So let's get into Reno city, click on the Hallowell project.
So on the light leak, you will see the debug grass click on the debug
confrontations.
So here's the one USP idea of GDB open hostility, buggy. So this is the
customized, uh, ESP idea of open non-city debugging, which comes with the,
uh, the three configurations.

So click on the new configuration, as you could see by default, this Hallowell
configuration is created with all the configuration settings.
The project and the XQ executable file Hallowell dot LF,

and in the next tab, as it would see the open OCD and the GDB clients set up,
everything is by default configured. So the only thing which we need to take
is controlling the interface, interface files for your specific board. Currently
I'm using my, uh, ESP roller kit.
But if you're having some of the board, you need to configure the, uh, the
interface and the board configuration related.
So in the startup, in the startup already, the insulation con configurations are
already configured. And all the settings, which are required to debug your
application is already taken care. So by default, uh, we will hold it the big
point of the app and the school mean. So this is the post break point where
the application will be halted.
So what I'll do, we'll just click on the, um,
Yeah. So it is asking us to switch to the debug mode, click on switch.
So the first break point delegation got halted at the app and the school main.
So let's click on FBA eight.

Yeah. As you could see it as holiday, the next break point between added in
different loop. So where we are just trying to, you know, uh, look for not a
thousand milliseconds and now we can able to debug kind of step-by-step I'm
just taking six. Um, all right. So, uh, this is about the debugging launching
the debug configuration.
And, uh, now, while you're debugging, you might need a couple of other
reviews. So those are already, uh, as part of the eclipses D for example,
debugger console. So this shows what is the big point, which is getting
executed and it, what line and it, what, which thread is getting, uh, in working
this particular, uh, this particular break point.
So as you could able to see all those information as part of the debugger
console, And this also have the registers view.

So you can see the Denver post registers and the values associated with that.
And the other one is, um, the, so as you could see here that some other views,
the variables view, where you will be able to see the variable values, which
are defined that you are in your program and the big ones where you will be
able to see the break points, which are configured.
And in the expression view, you should be able to add the expression. If you
want to do it, will you would set an expression. I wanted to see the value
audio and also a able to see the assembly level instructions in the, uh, in the
December, this assembly view. So here the assembly, they will instructions
for your application for your program, uh, is shown here.
So while you are executing this. So as you could see the assembly
instructions are, so it's getting changed and how it is, you know, switching
between the context. So everything will be shown as part of the assembly
view. So, yeah, that's pretty much, which I would like to show us for the
demo.
PRINT FUNCTION
We'll be discussing about biotin threes index. Those who already know by ten
three, you can skip the session. Otherwise you can learn the basics index
from the session. Make sure that you have connected your ESP 32 to your
laptop or desktop using a USB cable. I just connected right now. Then open
our ID. You can see the microbiota essentially is loaded here. First, we'll be
starting with the brain function. We will be able to print something in the
ship. If you wanted to come in something, you can use hash. So after hash
something you have written that will not be execute.
Start printing something here directly. We can use shell here. So I'll be just
using the print here to bring something. Print normal opening and closing
baskets inside. I can give anything. So here I am going to print something and
number just, I'm going to print a number three if I end up and the number
three will be printed over here. This code is actually running in ESP 32 and
it's executed over there that replays getting into micro potential here, print
three. So this is just to bring them numbers.
Now, if we wanted to bring some string, then the command is print. Then in a
single code or double code, anything you can use, if you use single code, you
have to use single code.
If you're using double code, you have to use the double codes. This case. I am
just using double codes. Hello, then close this one.
Now let me run this here. You can click on rank. Oregon, press F I, so I'm
just speaking on brand.

So it will be asking to where to save. There are two options you can save in
that computer, or you can save directly do micro by 10 device.
That is ESP 32. In my case, you can also use ESP 82 double six. This case I
am just saving to this computer, keeping in the desktop. I just creating one
file and folder.
Micropipette coasts instead, instead that I can save this. 4.1 brain function.
You can save this, make sure that this is as a dot P Y extension. Cause you
must save it as a Python file and save this. You are getting to output second
line here it is. That is to bring three and this line to print. Hello world.
Now we will be using variables to print something so variable. It can be
indigenous. It can be flawed. It can be string and things can be there. Now
let's start with KB. I wanted to bring my name. First name is a second. Name
is ed or last name is ed. I'm giving two variables. You can name variables,
ABCD, anything you can name.
You're giving like variable. First name mine. First name is Harish. The Heidi
issues are saying to ABA, they will call the fastening. Now last name he
called to conduit. So now it is assigned us conduit to last name and how to
print it. So, if I wanted to print first name, I can use like print that is available
directly called available in this console in the shell, you will be able to get
Haddish after fast to let me run this by using FIP, Harish is in defined.

Okay. I forgot to put w codes because this is a string. So you must be in. You
must give in double quotes or in Google's both will work. So now the hardest
string is able to first name variable and last name variable.
Now let's run. Now you can see the first command that painting. Three
second command over here, printing hello world.
And this is that last one. We are asked to print the first name. So it is printing
the name. Harish here, put both the names will be using string can Ganden
nation string and get any relation. Simply we can use by putting a comma
let's check print, normally opening and closing bracket. So I wanted to get it.
My name is so here. I wanted to give in coats, double codes. My name is.
Okay. One this much. I wanted to get brain first after that, I wanted to add the
first name and the last name, how you can add the first name and the last
name. So after the, you can protect karma. This karma makes string Ganga
nation. Now, what is the next one? I wanted to print my first name. So I have
the call, the first available that it first. Name again, after that the second name
have to come. There is a space is required. That's why I'm putting a space
then protect coma, then LA awesome. Using a coma. The string can guide
any nation.
Let's check how it behaves. Now you can see my name is so everything is
coming in double coats. This is a string. After that you are adding another
variable and one more variable. This border actually string. That's why there
is no, it does are coming over here.
So it is pending. My name is Harish conduit. So this is one window you can
print and combine two variables. If it is string, now it will be using another
Mudder dot four. My mother let's check. My name is. After that, what are the
vehicles have become where the places are they're there. You have to put in
opening and closing curly bracket, wherever the opening and curly closing
curly bracket is coming there.
We will be discussing that in detail. And after that I need a space. I need the
last name then again, opening and closing curly bracket. Now what I have to
do, I have to close. Double codes. Once he disclosed the double codes, he can
put dot format. Now, here, you can give whatever the variables have to come
in between the opening and closing curly brackets.
So first I need that first name, first underscore name. This is the variable.
Then you can protect coma. Then next one. Last underscore name, that his
last name we have done. It had a lot of advantage, mostly in Python program.
Nowadays you will be seeing like this. So make sure that okay. I forward to
those one more closing bracket here.

Yeah, that's done now. Let's run. Now you can see it is also printed by dot
format. Hi, my name is Harish country. Now in these places, I actually, by
default, the foster name will come on the foster place and the second place
here, the next available that will be loaded. That means this is counting us
faster, available.
That is we call it us indexing women. We are considering indexing zero
index and this index number one. So here, what will happen? It is default.
Index number zero index. Number one in the available. This is index number
zero, and this is index number one. So index number zero will be load here.
Index number one will be load here.
Now, what is that doing? Is I wanted to print something like last name, then
the faster name. I can do a small trick. I'm just copying this.
You don't want her to pay change over here? What are you can do? You can
change the index number inside the opening and closing curly bracket by
default but we can change dusk index. Number one.
Now the last name will bring fast. Then here I can give index numbers. Yeah.
Now what will happen? Faster. Name will come at the last. Now let's see. Let
me print. Now. You can see the difference.
TYPE FUNCTION
We'll be discussing about defunct ion Antoni ID. You can see on the left-
hand side, there is file system. I can navigate to the main file system where I
can see all the code, where it is saved. So I just changed the location of the
codes, where I wanted to save time. I'm changing for the F in my case, first
accord is already there. So I'm just closing this. I'm putting a variable, a.
number three, I'm giving B equal though. Any Florida value in D and
available C equal do string I'm giving string. You can give in double gold
source in good courts. It's not an issue. And D I can give you a bullion and E
is available. I'm giving something else. That's a double am, giving single
quotes or double quotes. I can give this time. I'm just giving you that single
quote.

Let me run this. I can say it to my computer, or I can say it directly to that
device. This time I am saving to my computer and share it is taught by and
save. Now you can't see anything on the shell because it is not printing
anything, but the code has run over. So how I can check, I can check here
type what is available? What is that type of variable? A I can check here now.
This isn't indigent. We can see over here again, also check for the other one
type the variable B. Yeah. This is a float type. Then let's check the case of E
it's set up so like that we can identify each and every debatable. What type is.
So it helps in program. Now I wonder to print everything one by one in a
single step.

I'm just copying this print, the diaper off all the variables, a B, C, D, and E
let's say van Brian by clicking here, or you can click on a file in this case, I'm
just clicking on a fight, pressing on a fight.
I can see the first one is an individual. Second one is a flawed. The other one
is a stream. And for the one is a bullion and the fifth one is a tablet.
INPUT FUNCTION
We'll be discussing about input function. If you wanted to get an input from
any user, we'll be using input function, you can click on new, make sure that
your device is connected to ESP 32.

Go to tools, options. The interpreter should be micro by 10 ESP 32.


It is connected to a proper. I grew up with Dennis Lauder in the ship. Plus we
have to create a baby. I'm going to get a name of any of the person creating
an variable called a name. If you're considering other language, we have to
mention what type of vulnerabilities, but here we don't want it to mention it
automatically understand. And it detects itself the command here. It is in.
Opening and closing brackets. So in my case, I am requesting to enter your
name so I can put like double quotes and or your name to make it looking
good. Again, put a full call in here. I closed this one. Let me run this.
make sure it is dark. Now you can see on the terminal, it is asking under your
name. We are not getting any response or you're not getting any output.
Why? Because we haven't asked to print something. No, whatever the name it
is getting that will be saved to a variable called name. Then we are asking to
bring that variable. So the print variable, it is my, our name is ed, so it will
get printed. Now let's again, run just right, Joe. Joey. Okay. Now it's printing
joy. Why? Because it is saved in the name. And we asked to print it. I wanted
to ask that age also and putting in another variable age equals input gets set
for that age.I'm just running this.
and the age that is just starting now, let's check the type of each
type of the name, variable that is a string then type of the age. That's also
straight.

We actually given a number, but it is showing like string itself. Now, what is
the problem? Whenever you use an input function, it always take all the
inputs are string. So if you want to do give it us number, then you want it to
convert it as number that is very important for that. We will be using another
trig and creating another variable age underscore one. Let's try. My name. So
just right now, it's starting last year, age is 29 now check bot using Thai
function. I'm just checking current age. That is age. That is a string.

Now check the diaper. Last year, age by using eight underscore one.
So let's check the difference. This is right now indigent. So this is a way you
can convert the string value into any leader if you're giving any numbers.
Okay. So I'll be updating those things here, sprint everything together.
Ask him to end up my name, my current age last year, H I C the first
available that's a string.

Second variable is also a string because we haven't converted here. And the
third one, it's an indigent.
HELP FUNCTION
We'll be discussing your bone health function. How function is very
important function, and it is very useful function. Click on new here. I can
run the help function directly in the shell. Let's check. What are the modules
before modules are available in that ESP 32. Similarly, you can also check
the case of ESP 82, double six. There are more modules available in the case
of ESP. You must check that I'm right now using ESP 32 command is help.

These are the modules we are going to use for the coming You can see some
of this USP 32 module and very important module is machine. Inside the
machine, there are a number of functions. Are there out of this? I wanted to
know one of the module and what are the functions inside the model? In that
case, you have to input that particular module. So how to import the
command is board. Okay. The module name. I'm going to use the module
name machine here because the machine is, we are going to use the most. So
I am going to import machine. Now you can see, there is no EDA. The
machine is important in the shell. Now I want you to know that what are the
functions inside the machine, how to know that help. Hey, you don't want her
to put the single or double coats? Just type the module name here. The
module name is machine and just end it.

Now you can see these are the functions available in the module,

colder machines, you can set four frequency reset, unique ID, sleep mode,
light sleep mode. Then why stop timer? Timer is Deckard to connect. Then a
lot of things to pin, mostly we are using pin one of the function, then analog
to digital converter. That's bad ADC. And DCA I to see PWM now we drive
it to somewhere. That is, we are going to use my T3 in here. This comes
under school. There is the one underscore third. So just I'm copying this first.
I have to import that otherwise I will not get so in board. Okay. The module
name. I just import thing. So that particular module is important. Now I under
the, see what are the functions inside that particular module, how it is help
the normal bracket.

You have to put that module, name, these other functions available here. Out
of that, we are going to use this particular function to start a new. In one of
our coming project So these are the files, which is inside the micro-biome
and device. That is in my case, ESP 32. These are the files, say everything
that laptop or the desktop. And if you under the know the variables here,
you can go to view that a lot of things you can and showing our interface, the
ID. If I wanted to know about the case of variables, I can recall. So all the
elements we'll show here.
CONDITIONAL STATEMENTS
(IF,ELSE, ELIF)
We'll be discussing about conditional statements like Eve S and Eleaf data in
your file. Let's start with the basic one. We are going to get a number from a
user from a range one to five, and it is checking and we are going to predict
taking at a friend's number. So I am putting a variable color. Value it's
available. And by default, I am giving it a reference that is for then I wanted
to take an input from a user variable, call the value. Then we know that we
have to take the input, uh, that number it is there. So I wanted to convert it as
a number. Then we have to use it inside the end. I can use input function.
And there are a number in a range one to five. Now we will be checking is of
value is equal to the reference value for that we will be using if inside the
bracket we have to give that condition value is equal to equally equal to
means it is checking is the value is exactly the same. Once it is given, you
have to put F free card. Then you have to give under here. Intonation is very
important. You can see there is one dab. It is an indentation. The other
language, you mostly have it opening and closing curly, but. In that biotin's
index, actually, this isn't intonation international is very important in the case
of Python programming language. So you make sure that in the nation is
followed. So remaining codes are coming under that. If condition now, if
both are seen, then I wanted to print something. It is matched.
Now let me run this again, save to computer and say this. Oh, it is asking.
And then the number in a range, one to five, let me end the F for itself, then
check the output.
Now you are getting the output Mazda value and that means it is matched.
No, again, I'm just running that. I'm going to end up another way. Let it be a
do now. You're not getting any output. You had expected some output, but
you are not getting any output by. We haven't said like, if it is not matched,
then what you should have to print or what we want to do show to others.
So that case we are putting something called here. So as he's actually coming,
once it is checked, the if, then it will be jamming ELLs.
Now, if it is not mass, that it is the number is not for the remaining all the
condition I can run with it. And so under Ellis, all the remaining conditions
come so that why you don't want to put any specific condition here.
You have to put a full call in here, gender. Check the intonation here that
automatically comes, but check from your side also international always.
Then let me bring it is not matched. Now let's run a fire. You can use asking,
do enter a number. Let it be three. Number is not matched again, running for.
Now the value is matched.
So this two way we can understand how to use Yves and ELLs that are
possibilities, like one to five. So if you ended one, it wanted to show you in
that. Number one, if you ended up to it, wonder if you ended up number two
and if you're entering something out of this range, it want to show. Then no, I
lose out of range in this case, make sure that you are not giving any input 4.5
or something.
Why? Because it gives some eras over here. So this eras we can use, try and
accept doubt, but this time we are not discussing with that. So you try to
always give the numbers a one to five or more than that should not give any
Florida. Now let's check with that next one, taking one by one condition. And
one of the condition is satisfied.
It will trend for that. We are using Eleaf so fast. We wondered check one of
the conditions because this condition will work. So that's why I will don't
wander. Repeat that Eve. Value equal to equal to number one and four. Colin.
I wonder the print and a third number is one that is another possibility. The
number can be two this case instead of using, as we will be using something
new called if condition we wanted to give value, supposed to be equal, to
equal to two.
And that values too. Now, similarly, I have other options, the four or five like
that.

Now we can get all the possibilities from one to five. If I give one supposed
to be a number 10, then it is not coming in this, uh, Eve and LF. So the other
condition comes. So what I can do, I can S uh, meaning all the possibility.
I can print and our number is not in the range. Okay. Now let's try asking
them to end on a particular number. Let me check this part also will work.
Let me end up to now it is saying that number is not massive because in this
area we are taking the reference number is due and does a part is showing
like, and that value is to buy because I have given a number to that mirror.
Again, I'm giving for now ma'am as the value in dirt and ended values for,
because it is coming over here.

Now once again, I run, I'm giving you a value of something like eight that is
out of our range. Then let's see. Then their number is not in that range. So this
program is successfully working. You can see each and every variable and
the value presently.
While loop
That is an infinite loop. It is very important. Most of the programs we are
using, why loop start a new file, why true and full coding instead of true, we
can also give other conditions. If that particular condition satisfied it will run
condition is always true. That means it always run again, again and again. I
wanted to print something. Hello? Okay. The code is done, but there is a
problem. If I am not giving any proper time here. Now, my interface may got
stuck because in a fraction of second number of times, it is going. But in
hello? Hello. Hello. So that's why we have to give a small delay over here for
that.
We have import something called a sleep. The function sleep from the
module called a time frame. Module name is time import sleep after print. I
want to wait for one second. How we'll call sleep the time we can give in
seconds. Time also, you can see in milliseconds and microseconds by
changing a little bit over here, but now we are looking into second twice.
So here I am just giving one. That means it is for one second. Let me upload
this code.
you can see in the shell, it started printing. Hello in each and every one
second gap. It's still continued printing. I undertake. The sprinting, all
interrupt the program.

There is a shortcut that is keyword interrupt. That is control. Plus C I can see
the program has, uh, interrupted in between by using and keyword interrupt.
You can see now it is not printing, right? I'm going to change that. Something
like two seconds that may again, renders. Now you can see each and every
two seconds it is printing. Hello, soft reboot. This ESP 32. There is another
sharp guard that is press control. Plus B in the keyboard. I can see it is soft.
Rebooted.
FOR LOOP
We'll be discussing about follow open a new file, a particular set of program
under two, ran for it. Certain number of times like five times, six times,
maybe 10 times, maybe 50 times we can use actually for loop for any
variable, any variable name we can give XYZ. Even you can give name
anything, counter any name you can give for the variable. I'm just giving the
name of the variable as X giving in. Yeah, the function is range by default.
It's starting from zero. I am giving a range, then start from zero. And the
value which I given that will be excluded, that means maximum.

It will go up to nine. I ended up bring that back. X-ray now. So it is going to


increment each and every time by one by default print X, let's say this. See
now you can see in the shell, it started with zero and ended at night. That way
it is starting from zero by default and whatever this valley is giving that will
be excluded.
Oh, you turned up at a time. It is incremented by. One, one like that. And
each and every time, what are the value of X that is get printed over here? So
it's, that's why I said it can be used to run a certain program to a particular
number of times if you are bringing any lady only for 10. Yeah. Then you can
use this command so that lad will only run for, at that particular 10 times,
instead of printing, you can make the command to bling daily.
We can also use in underway the four loop for variable name. You can
change, or you can keep as it's same, but I'm just changing industry.

Why in range Dodd from two, it ends at night print. Ready? Boom. Wait, let
me up. Yeah, the faster set of program that means. Nine here after that, it is
starting from two and ending at night. So this value is excluded in this case.
By default, it is incrementing by one, but we wanted to change like
incremented value should be two, three, or something like that for we can
give any bad variables is that I'm giving in range, starting value. Let me give
two. Comma ending value. I'm just giving some other values. I'm being like
26 and each and every time that addition value should be supposed to be
three. That is a difference print. It started with to exclude 26 and each and
every time. The difference is three. That means first we will be to the next
available B five, the next evaluate be eight. Like that. It will go.
Let me run. This code can see here it is Springer till nine. That is this
program. After that it started with the two, then three more added five. Then I
gained three modern. Then it is going 11 until up to 23. It is going because 26
will not come here because 23 plus three, that is 26, but this only six will not
be added in this program. So that's why we got delayed 23.
CREATE WON FUNCTION
We are going under discuss very important topic that is make our own
functions. Why it is relevant. You have created a code that set of code wanted
to use in several time. Then again, writing the same goal is not good. That's
why we are creating functions.
That is a key variable called deaf space. What is the name? Needed for other
function that you can give us the next and just giving it any name. You can
give him giving a name, something like symbol, then opening and closing
brackets, and you can protect and you check inundation. I ended up print
something print, Now we have created faster function. So function name is
symbol. You have to call the name of the function. My function name is .
This is a way you are calling a function.

Now let me run this be right exchange. Save this. Okay. Now you can see the
value is printed. Now I wonder the suppose, print it again and again, then we
can use slave function here. How we can use sleep. We know that from time
module, you have to import sleep. No, I can use here. I have to create while
loop here while true. This is what I said, the case of Fido. So you have to give
proper introduction. You can. Single dad then here I can give to repeat again
and again and again for a time. So sleep 1.5 seconds. Now let's check

now I see this is the function, but this function is called here. That is inside it
while true loop. So it is going to print each and every time it's a function is
calling and it is doing. Print function that is printing again after 1.5 seconds.
Again, calling this function and printing like that, it is going okay.
I hope you understood the basics. Now we have to look into some more time
with arguments and or retain. So first we will be looking into arguments. So
I'm just changing this. I don't want to do make it confused. I just removing
this too. Okay now let's see. How do you use arguments? That's inside the
function.
We wanted to pass some values. That'd be actually called the arguments. I'm
creating a on function called add. Now inside this bracket, I wonder the past
two arguments so I can give two variables name here. Let it be variable a then
next to variable, I can give coma. Now two variables I have given as the
arguments C equal to a plus B.
Now this is a condition we have given. We wanted to bring the value print.
Some is shrinking any nation we can use, put a coma, and once it is added,
the value is going to save and see. So I wanted to call the beta. We'll see here
that, okay. Now how to call them. Calling is very easy. How to call ad. We
wanted to pass two arguments.
Now I wanted to add two numbers, like six and five, so six. That is a faster
variable. That is a faster argument that is going to AE and fight. That will go
to B. Let me run this.

why this is not coming over here. Print because I haven't called here. If I got
then the function symbol also will get printed over here.
Okay. This is what we call that passing arguments. I'm creating another
function. Def that is a key word. Any name you can give? I wonder to give
only one variable. That's why I put X. You can give anything that's up to you.
Full colon. Then something I'm calling, uh, it does return, whatever the value
you have paused in X that should be multiplied with two, so I can give it to
you, indu.
X now, whenever I call this function, if I passed five in X is five will come
over here. That will be multiplied with two. Then this value will again, go to
X.
That is the thing will happen here. Now I wanted to print that properly.
Normally how we can call, we know that you can call like M U L what is the
value you wanted to pass here?
The argument anybody can give, let me take the number eight. Um, I wanted
to pass here, but I wonder print also for printing. I had to add print.
Otherwise, I won't be able to see what is the value of coming over here.

Now I can run this C eight is past two X. That eight into two is multi plate.
That value 16 that's 16 is again, coming to yeah. So that return value is
actually printed over here. Function is very important in Python
programming.
ESP32 TUTORIAL USING
MICROPYTHON LETS GET
STARTED

Hey guys, just sitting here on this gloomy morning, waiting for a meeting to
start.

So I thought I'd show you this new application now here's the problem that
people run into. They see all this talk about things like this. I mean, I even did
this on my channel, right? This is. IOT device and internet of things device.
Okay. And you hear all this talk about the internet of things, and then you
hear about this stuff like, oh, you know, the ESB 32, it's this wonderful chip
just for the internet of things has wifi on it. You can do this, you can do that.
Okay. Well that's all well and good. But what you don't hear is when you
have something like this, I mean, I. Touched on it in the project I did on this
weather thing. Um, is that when this takes a reading, I mean, so you've got
your device here and it reads you timid temperature, humidity, pressure
connects to the internet, and then it sends it somewhere. Well, where does it
send it? And that is the key.

See that's missing for most people, like, uh, you know, the viewers on this.
That's the key that's missing. Where do you send it? Okay. So maybe you,
you know, you've gotten yourself an ESP 32 here. We got a little fun board.
We've got lots of ESP, 32 things here. They're all connected to the. So you
get this, you start doing some micro Python, you get pretty good at that. You
can connect to the internet. You can, uh, you can read sensors, you can
flashlights and all that, but then you want to make an IOT device and you're
stuck because what you're missing is that place to send your data. So what
you have to have. Is a server somewhere. So then you got to, you know, get
some space on digital ocean. You got to set up a Linux box up there. Yeah.
You have to get yourself a domain name. You have to worry about, uh,
certificates and HTTPS. And then you got to build yourself an API to accept
your data on and on and on what that's a different kind of programming then.
Right. What most of you guys are doing with this. And so it's a roadblock. In
fact, I got. Uh, rope made the other day and we were talking about this and he
just hit a roadblock because he, he couldn't hit that and do that next part. So
what I've done is come up with an application for you guys to use that does
that part for you. So this is, is a. Place on the cloud where you can take your
data here. You can just one line, just send data up there. I've already written
the software for your ESP 32 and your desk. So just with one line of code,
you can send data up there and it's there and then you can retrieve it back to
here if you want, or you could, you know, retrieve it to here or you can bring
it down to your desktop or
all right. We had a technical difficulty there. All right. Anyway, so you can
bring it down to your desktop, whatever you need to do. Um, so it's just like a
place where you can send data and it can stay there for a little while and then
you can bring it down to another device, whatever you need. So you can
swap commands.
You can send something from your desktop out to here. Um, you could send
something from here, go to there and then to your desktop, you know,
whatever you need to do. So I'm going to switch over to screen record, and
let's go over this thing. Okay. All right. We're starting here on my YouTube
channel. Don't forget to subscribe because it helps me write.
So please do all right, we'll go up here. And now this is a fresh start of
Firefox. I got there's nothing in here. Um, everything's fresh just like you
guys might encounter it.
So we're going to go to E Z I O t.link. L I N. That's all we got to do and it
takes us there. Now you'll see that this is unsecure.
So if you want, you can do HTTP, uh, S and get to the secure link or, you
know, the secure site, but it really doesn't matter because there's really
nothing happening on the website. It's just a landing page. And a place where
you can find the links to the places that you want to go. Okay. So the
website's not really doing anything.
It's just a front end to the server to where the API exists. That we'll be hitting
that API with our, uh, Python tools. Okay.
So the links that are here, well, here's the link to my Patrion account. If you
want to be a patriarch that helps support, uh, you know, pay for the server
and all that kind of. Um, and then the other main link is to get lab to easy IOT
on get lab where all the instructions are, where the files are, the stuff that you
need.
Okay. And then there's a link to my YouTube channel. And here down, down
here is a link to Iowa lottery.io. Now easy IOT is made for us. It's for
hobbyists and developers. It's a place where you can take your device. You
can send data up here, it'll stay here and then you can pull it down to your
desktop.
Or you can send commands from your desktop up to here and then pull them
down to your device and do things. But it's not a full service cloud IOT
location. If you need something like that, where you have indefinite storage.
Um, all sorts of analytics and tracking and, uh, artificial intelligence and all
that.Then you need to go to high audrie.io for us.
This is just a hub where we can send data and use it some other place. Okay.
All right. So that's the main links that we have. So let's head on over to get
lab. Once we get over to get lab. You can see that I am not signed in. Okay.
And you guys don't need to be signed in either. This is a open repository for
downloading. All right. Now the two files that you are interested in. Well,
really the one file that you're primarily interested in is easy. IOT dot P Y.
Okay. This is the SDK or software development. And if you scroll down,
you'll see that it, uh, it has imports for micro Python. So we'll work on micro
Python. It also has imports for regular Python. So it will work on your
desktop works in either place. Okay. So we need, um, we need this. All right.
So, well actually let's just go ahead and hit the download and I'm going to
save the file and. It's done. Okay. So let's go back now. The other file that
you might want is the rebel ACE dot P Y.
And this is a file that you can use to upload, uh, easy IOT dot P Y to your
ESP 32. It's what I use. Um, so I'm going to go ahead and download that as
well. Uh, you can use whatever you want. It doesn't. It does. Oh, here we go.
Okay. So, and then the last thing is the read me file, which is, will be
displayed right here. So the read me file has, um, an introduction to what, uh,
easy IOT is. We've already started talking about that. It's just a place where
you can. Take data from your device, you can send it up to the cloud and then
you can download it to your desktop, or you can download it back to another
device.
So you could swap data between devices, that sort of thing, a brief overview
of what you can do. You can upload data, you can upload up to 1,024 rows.
Um, and then after 1,024 rows, if you upload again, it's going to drop the
oldest row often there. Uh, you get six, uh, items that you can upload. You
can put a group in, you know, like, uh, what group of, uh, IOT devices you're
using. You can put a device name in, and then you got four data spots. These
can take integers that can take floats, or they can take strings. Uh, these first
three days to one day to two and data three, they can tell. Uh, strings up to 32
character as long. So that would be four names and stuff like that. And then
the last one data for it can take a string up to 256 characters long. So that
would be for a place. If you wanted to put up a little bit of a Jason or
something like that, some extended data, you could stick it there. Okay.

Now that seems limited, but it's really not. It probably would take care of
95% of the IOT. Uh, devices that exist in the world. I mean, because you're
just sending little things, that data up there, you're not sending huge amounts
of data. I mean, there are some but most don't, so this will take care of a lot of
stuff. Okay. So you can upload your data and then of course you can get your
data back. Okay. Whatever you put up there, you can get it back. You get
timestamps and you get the IP address. Of where it was sent from when you,
when you get it back and then of course you can delete your data. Uh, I'm not
interested in your data. You put it up there, you manage it. Yeah. You delete
it, whatever you want to do. And then, you know, we talked about passing
data between devices, by uploading and downloading between devices. Okay.
Now things you can't do look easy IOT. It's not for unlimited data. We talked
about what you can. That's not for huge data. Okay. You got to get a better
service. Like something like I honoree, if you need to put huge amounts of
data and keep it forever. And then, you know, user support, uh, you know,
I'm, I'm building this for our community on YouTube to use and it's tested it
works. So just follow the instructions. There's your user support. This is the
user support file or reading right there. I mean, it's just me. Okay, so security,
um, you know, don't use this for personal data. Don't use it for military
secrets. Don't use it for commercial secrets. Um, you know, we use HTTPS,
uh, for the web traffic, but in the back end, we're not storing it in an
encrypted fashion. So, you know, use it to swap data around. Don't use it for
anything that's critical if you need that. Then you need to buy, uh, you know,
pay for, uh, a big, a real IOT cloud service or, you know, make your own.
Okay. And then here here's the documentation. Okay. And then, um, this is
the test kind of the test run stuff. We'll go through this, but this is just
explains how to do everything. So you can do some testing. You can get an
account. This is what we're going to be.
Um, and then here's the different functions. Now, this stuff is rate limited. I
mean, your target rate limit is once per second.
Right. But if you have a bunch of devices and they're sending data, there's a
little bit of buffer in there. So if you know, a couple of them send data at the
same time, it's going to still work. Okay. And then everything is identified by
row IDs and there's just different stuff in there. And then, so this is how you
post it. We'll go through that. This is how you get data. This is how you
delete your data. You can get stats, there's some extra functions for
connecting to wifi. If you're on an ESP 32 or something using micro Python,
uh, we'll go through, get it, getting credentials so you can have your own
account. And then there's just some, uh, ticks, tips and tricks in here. Okay.
All right. So we have downloaded the, um, Two files that we're going to use.
And now we're going to shift over to a directory and a command line and,
and give them a shot. All right, here is a directory I've created. This is just a
fresh directory. The only thing in it is, uh, the two files that we downloaded
now, notice they did change the name a little bit when we downloaded them.
So we'll, we'll, uh, rename those things. To what they should be, which is just
take off the get lab folder. Right? Okay. So we'll use this one. we'll use that
when we load to the ESP 32, but right now we're on the desk. And we're just
gonna use, uh, easy IOT dot P Y that's the software development kit, the
SDK. We're going to use this with Python on the desktop. Okay. So I'm going
to pop it open and then let me adjust it. Now. I'm doing everything new here
just as if you guys were doing it. Okay. So let me get this adjusted where you
can see. Okay, so here we go. Soft wear development kit. There it is. Now the
first thing we're going to look at is this, the API key and secret and version.
Those are credentials and you will get your own credentials eventually, but
these are credentials. It just comes with the credentials for an example,
sample set of data up on the, uh, And we're just going to use that everybody
can use that. You don't have to get your own credentials, but if you use this,
you're going to be mixing your data with other people's data. It's possible to
do it, but you know, no reason not to get your own thing.
Okay. Um, so there's that, here's our base URL that we're going to be hitting
to get it. You see, it's the easy IOT we're using HTTPS. Right? Cause we
want it secure our data transfer to be secure. And then we're going to hit the
API, which is. Uh, the application programming interface. Right. And that's
where the exchange happens, but you don't need to know about that. All
right. Here's micro Python imports or regular Python imports. Okay. If you're
just going to use it for micro Python, you could, you could take out this and,
and use this, this stuff down here, but it doesn't matter. Okay. Now here are
the functions that we can do. Stats. We can get stats for. We can post data,
this that just means send, send some data, send these things up and posted on
the cloud. We can get that data back, um, and we can delete that data. Okay.
And then there's a couple of functions for once you're on your ESP 32 or
micro Python device. Um, these are some wifi functions. You can scan your
basic connect and do. All right. Uh, this is the request functions, which you
will never have to bother with. All right. And then credentials, we can, uh,
get credentials. And this will just guide you through getting credentials for
yourself so that you have your own space on the cloud, where you can put
your own data. Okay. And it's just based on your. And then when you're done
or if you're ever done, or if you ever want, you can delete your credentials
and that will just completely wipe you off the system as if you never existed.
Okay. So, uh, that's it that's, that's it, that's all, all we need to do. We just need
to be able to put data up there and we need to know what data we've got up
there. So that's all there is to it. So we're using this. Initially the example
account. So let's just hit F five and run this thing and let me get it to where
you guys can see it. Hold on. Almost there. I'm going to let it run off the end
a little bit. Uh, it'll just make it easier to see the data. Okay. So the first thing
let's just do stats. Okay. So this is for the example account. So our stats tell us
that this is the size on disk. Um, there's no data up there, so, uh, we'll have to
put some up there and, uh, let's see. So there's no minimum row ID. There's
no maximum row ID, I guess we'll have to put some up there. I thought I
thought I had something running that was putting data up. Um, but then it'll
have a rate limit now that for this example account, you can, it it's rate limited
at two requests per second. There's a little burst buffer and that sort of thing.

And then there's an email over here that's associated with the account, but
that's not even a real email. So don't, don't worry about that. All right. So
since there is no data up there, let's just put some data up there. So all we got
to do is, uh, dude posted. And oops, you got to spell it. Right. All right.
And then remember, well, since we're on the desktop, let's do this and it'll tell
us we can put the group, we can put a group, a device, uh, and then we have
four spots for data. So let's just say, um, our group will be test or testing.
Okay. And our device let's just make it desktop. Okay. How about that. And
then, uh, let's put some data up there.

We'll do 1, 2, 3. That's an inner, we'll do 1, 2, 3 0.4, five, six. There's your


float. And then, uh, how about, um, a hello world for some texts? And then,
you know, we don't even have to put them all in there. We don't have to fill
all the spots, so let's just do that. Okay. We posted data, that's it. We just
posted data. We put data in the cloud with that one line of stuff. Okay. And
what it returns for us is, uh, the row ID of the row that we just added to the
data. So if we get stats now, we'll see that there is one row of data in there
and the minimum row ID. Uh, one and one is the max. Okay. All right. So
let's, let's just stick another data in there, actually. Why don't we do, I'll tell
you what we can do. Let's just do a little thing. So, um, uh, four X and range
10. Okay. Now this is going to burst data and it'll, it'll handle this little burst,
but then, um, So let's just put an X right here and then we don't even need this
and we'll make this since we're on. Uh, since we're on our desktop, I'll use an
F string and we'll put X right there too. All right. Now this is going to do a
burst of 10. It's going to load it up there. Yeah, and it probably won't hit the
limit. Yeah. If we did many more than that, it would hit the limit. Okay. So
every time it posted data, it returned to us the row ID of the data that we
posted. So we had already posted one. So it started at 2, 3, 4 5 6, 7 8, 9, 10
11.

So if we do our stats now, You can see, we have 11 rows of data. The lowest
row ID is one. And the maximum role ID is 11. Now the lowest row ID.
Won't always be one. So let's say after you put 1,024 rows of data in there,
then you put another one in there. It's going to drop row one off and you're
going to have thousand and 25. So this would become two. And then every
time you add, you know, it would, it's going to drop it off. Okay. All right. So
that's us putting data on the cloud. So the next thing we need to do is, um, we
need to get the data back. So we've, we know how to do stats.
We know how to post data, and so let's get some data back. Okay. So for
getting data, we can just say, give me 10 lines and that will give us the most
recent 10 lines. Or we could say, give us some data after a particular row ID,
and then we could add the group or device. So it would match on only rows
that have that group or only rows that have that device. So that would allow
that that allows you to exchange command. So if you, you know, your group
could, you could say the group has command and the device. No, maybe fun
board one. So then your desktop, you could send up, Hey, fund board one, do
this and then fund board one could pull it down and, uh, and then do to
command. Okay. So get data. So here's a little trick we could just say, well,
let's just do a number. Okay. So let's just say get data five. Now that should
return the last five things. And I you'll see it's a list. Of lists of data. So why
don't we do this for row and get data five front row, make it easier to see.
Okay. So the last five pieces of data that were loaded up there by us. Is, uh,
11, 10, 9, 8, and seven, where the row IDs now here's, what's being returned
here. This is your row ID. This is your epic time, right? It's the number of
seconds since January 1st, 1970. That's how computers keep time.
And then this is the epic time, uh, converted to GMs. All right. And then
normally you would get an IP of what put the date up there, but because this
is, everybody's doing this, uh, we're not doing IPS right here. Okay. And then
there was our group name and here is our device, uh, the target device or the
device that posted it, whatever you put in there. And then here's the numbers
we put in there. Here's our hello world. And then you see these two or none
because we weren't posting any data there. Now here's a little trick. So if, if
we bring this down, we can do after. So I want to see the data after row ID
five. Now this one will return all data with a row ID that's after role ID five.
Okay. So there you see it, it started, uh, the, the earliest one was. All right.
So we could do, now here's a little trick we could say after zero now, zero
never exist as row ID. So if you use after zero, it's going to bring back
everything that you've done or, you know, the whole thousand and 24 or
however many you have. Okay. So that brought back all of our data because
everything after row ID a zero. Okay. And let's see if we wanted to, well, we
need to add data. So let's, um, let's post data with something different in it.
Uh, post data and our group can be, we just we'll be, uh, let's just do that.
Okay.
So now let's pull back all that data again and you'll see that role ID tool.
Right. We saw real ID 12 there it's just group two and then everything else
was empty. Okay. So we can do this. Let's do this again. But instead of doing
that, we can actually specify the group. So group equals group two. Okay. It's
only going to pull back one of course, cause we only did one that had a group
name of group two. Uh, but that way you can select, uh, more specifically
what you want to get. Right. So we can do that for group or we could do that
for device either one. All right. That's how you get your data back now.
Delete data. We can delete it by giving it real ID. We can delete everything
before a row ID or we can delete all the data. Okay. So let's, let's try it out.
Okay. So we just do delete data and we can say, well, if we just want to do
one, you can actually cheat, but let's do it the right way first. Okay. So row
IDs equals and then we have a list. So let's pick one out in the middle. Let's
go with row ID eight. It's in the middle of the dataset sort of, uh, eight.
Well, we can do eight. Well, let's go ahead and do seven as well. Okay. So
we're just telling it, delete data, row IDs seven and eight, so they should go
away. All right. What gets returned is the number of role IDs that were
deleted. So it did delete two row IDs now. If we did this and we said, you
know, 800 and 700, it's not going to return anything because those row IDs
don't exist. Right. All right. So now that we've done that, let's pull this down
and we'll see that nine and then it jumps to six. Uh, so those are Dawn. Uh, so
we deleted row IDs. Now the trick that I was going to show you. Is, if you
just have one thing, you don't have to give it it'll list. You can just say, you
know, delete data nine. And then if we pull this down, there you go.

Nine it's gone. Okay. Um, and then let's say we want to get rid of some old
data. So we've read, we posted data. We'd read it. Uh, you know, that's the
thing about that's one of the before and after things, you know, after for
reading and before for deleting it's so that we don't have to pull, let's say
we've got a thousand rows of data in there. We don't need to pull that down
every time that's hard for ESP 32 to process. Um, and it weighs bandwidth on
the server and all that kind of stuff. So we just we'll, uh, we can delete old
data by using before, and we can. Get new data by using after and say, you
know, like saying after the last row ID that I saw. Okay. So we just keep
track of that. So, all right. Well delete data before what let's say before. Um,
three. Okay. So before three is going to delete only two in one. And so we see
that we got, we have two things that were deleted.
And then if we drop this down and try it again, you'll see that two and one are
now gone. Okay. And then let's see. Hmm. The last thing is X all equals true.
So any true value for X all? Oh, that's the wrong thing. That's going to give
you that. I'm supposed to be doing delete. Yeah. Okay. X all equals true. Or
you could do X, all equals one. Anything that evaluates to true. If we do that,
it says it deleted seven rows of data. And then if we do this, we get nothing
back, but no, that's do the wrong thing. We do this.
Do we, can we get some rows? We can't get any rows. There's nothing left.
So see what stat says. Yeah. So for stats, we've got no rose, no real IDs where
we, we deleted all of our data. Well, we deleted all the thing, data in the
example. Okay. So that's all the functions. That's all you need, you push data
up there, you pull data back.
Uh, you can exchange data by pushing it from one place and pulling it from
another, um, all that kind of stuff. Uh, so the next thing is how do we get an
account? All right. The next step is to get some credentials of our own. All
right. What we're going to use is this command right here, get creds. There's
no key words or anything like that.
Right. So let's jump back over here to our window, which I cleared out and
we're just going to do, uh, we have to type the right thing, get creds. All right.
Now I'm going to use my, uh, email address because I need to receive an
email. So. And I am setting up a real account. All right. So what's your email,
what's your, uh, email again? Just to make sure you got it right now. It's
saying, Hey, look, I just checked and I don't know you. So do you want to
create a new account? Well, yes. Yes. And then it's going to ask you to read
some stuff and you should read this stuff and agree to it.
So what is saying, it's saying this is a free experimental service that's for my
Patrion and YouTube supporters. Uh, and I may not keep it forever. I may,
uh, may dump you off there if you're not someone that I know, but for now,
we'll just make it available to everybody. Even if you're not a patriotic. Um,
let's see you shouldn't be sending any sensitive data, right?
We use encryption on the front end, but we don't own the back end. So your
stuff is not stored in an encrypted way. Don't send anything sensitive. Don't
send anything. That's commercial, medical, military, whatever, if it's, if it's
critical data, that's not what this is for. This is for your, uh, IOT experimental
and development devices.
Right? Uh, don't do anything. Uh, don't, you know, this isn't a forever place.
If you, if you need forever, then download it immediately. Uh, let's say, uh,
keep your key and secret, which you're we're about to
get, keep those, uh, keep those hidden. Don't give those to anybody because
they can manipulate your account using those.
Um, and then this just says, Hey, I'll be a good part of the community. Abuse
things. I won't download too much data. I won't try to sign into anybody's
account. I'll just be a nice person on the community. So do you agree? Yeah,
I agreed all that. Cause it makes sense. All right. So then it's gonna send a
code code to your email and we need to get that code.
So I'm going to go and get that code from my email.
And now I'm back with the code and I just copied it and I've got to paste it
right there. Okay. So that just verifies that your email address is good. And
then it says, Hey, I sent your new credentials to your email address. So why
don't you go get my new credential? Okay. Now I have my new credentials.
So let me show you what I'm going to do with them.
I'm going to go up here to the top of the screen. And underneath these, I'm
going to paste exactly what was sent to me, which is a copy. This is the
example account, and this is my new account. And I know I just told you not
to let people see your key in secret, but by the time you watch this project, I
will have already changed.
So don't worry about that. You won't be able to use my account. Okay. So
now I've got my own stuff in there, right? I mean, this is my own account.
Okay. And so I'm going to save that and I'm going to it. And here we are
back again, uh, with our, our new account. Okay. So if we do stats.
We can look and see that the email associated with this account is now my
email. Okay. So this is my account. Uh, you see, the size is zero. No one's
ever done anything in here. All right. So let's post some data, uh, post data.

I'm just going to say. All right, so let's do a get data.


We'll get there one. Alright, so there it is. So my current IP address, you can
see it now. That's my current IP address and here's the epic time. And that's
the data put in there. It's not really a, a group name, but you don't really have,
you know, that's just a signal. Okay. So there's, there's that? Okay. And then,
um, well, I'm not going to delete this now, but if I wanted to delete it, then I
would just do delete creds and then it would ask me, do you really want to
delete this?
And yeah. Because, um, we're about to go over onto the ESP 32 and do it
there. But if we did want to delete it, we could say yes here. And it would just
totally wipe us off the system. Okay. But we'll say no for now. And, uh, just
to make sure that we didn't wipe ourselves off the system, we can get our
stats and there you go.
So we got one row of data in there. Now you'll see that my max rate of Reza,
regular users once per second, that's that's the target you should do is not
making a query or request to pose, to delete whatever.

Don't make a query, but once a second, and that's just for commuters, right? I
have this running on it, you know, it's not a huge server that I, that I have it
running on, so, okay.
So that's, that's all there is to getting creds, uh, credentials. The last thing we
got to do is go over. And get on the ESP 32, load our stuff on the ESP 32 and
try it from the SB 32. All right. So we're back to our folder and we are about
to connect up to the ESP 32, but to get started, I'm going to pop open a
terminal here and let me connect up to the SP 32.
So there we are. I'm going to, uh,
just want to show you. That I'm starting with no, there's no files in here.
Okay. So everything that we're going to be using is in the easy IOT dot P Y
script that we will use that we're, we're about to load it up here. Okay. So
we've got clean slate, fresh install of microphone. All right now let's pop this
open.
This is easy IOT. Now the thing that we want to make sure is that we have
put our credentials in here and here are our, our credentials. Uh,
we could comment this out if we'd want it to. And the other thing that we
don't really need, if you want is you can go down here. And comment out all
of this credit chill stuff, because it just is taking up space that you don't need.
Okay. So you can comment all of the credential stuff out, cause we're not
going to be doing credit stuff on ESP 32. Okay. So that's all we need to make
sure we have got our credentials in here and we, we, you can, or can't it
doesn't matter. Comment out the extra stuff. And then we've got the terminal
open.
So I'm going to get out of this is connected to the P 32. I'm going to get out of
that. Control a control X I'm using Pico comm control, a control X gets us out
of there. And then I am going to load up the, uh, I'm gonna use , uh, to load.
My ESP 32. Now I'm showing you this, just so you'll be reminded if I do this,
it says permission denied and that's because I haven't made it where I can
execute.
so I'm just going to do, uh, James mod plus X making it executable, and we're
doing it on . All right. And now we can do this. So what this is saying is I
want you to, I'm going to run rebel A's uh, this is the port that we're on. I'm
on a Linux box, of course. Uh, so this is the port and then I want to include
easy IOT dot P Y.
Okay. So it is compiling it. Now the nice thing about is that it cross compiles
it for you already so that it's, you know, smaller and loads. Okay, but there it
is. We've loaded it up. So let's connect back up to our ESP 32. Oh, let me just
get out of there. That that's part of the load. So, uh, I'm going to do a control
D, which is, uh, a reboot and then I'm going to import oh, S.
We'll see what's happening. Okay. So you can see the only thing we have is
easy IOT. Okay. So let's just import easy.
Oh, T actually let's make it easier. Uh, let's just do from easy IOT. Okay,
tight, save my life, import everything I need help. Okay. So from easy IOT
import everything now on the ESP 32 different from the desktop, we do have
to connect to the internet so we can do a w remember I included some tools.
So let me pop that over.

Tools that we have for the internet. We have wifi scan and wifi connect, and
that's what I'm going to use. Wifi connect. So let me get my terminal back.
Let's get rid of this. All right. So got my terminal back and I'm just going to.
Why five connect and I'm going to connect to my test network.

Uh, let's see, Darwin net test. That's what we're going to use. So I got a bunch
of wifi networks I can use, and this is my test one, and here's my crazy crazy
password. All right now, of course you wouldn't want to show your stuff if it
was important, but this is just the test network. It's not important. All right, so
let's connect, connect. Come on, buddy. You can do it. There we go. All
right. We're connected. So now we can just do the same things that we did on
the desktop. So let's start with, let's start with staff. Now you'll notice on the
ESP 32, it does take a little bit longer to get stats and, or to make these
connections. Right. So you really don't have to worry too much about rate
limits when you're using your ESP 32. It just doesn't work that fast. Okay.
Okay. So let's see. So from the desktop, you know, we had, uh, here, the rows
that we had, we only had one row that we stuck in. But now we can see it
using the ESP 32. So let's, uh, let's do well. Let's, let's do this for a row and
get data print row. So it takes it a little while to do it, and then there's our
row. So that was the row that we added from the desktop. If, if you
remember, okay, so now we can add data. Let's see, let's say we're going to
use a group so we can say maybe our group is ESP 32. And maybe we're on,
we're using fun board one and let's say hello from and SP 32. So it's posting,
it should give us a real ID too. So if we do this.
We should get back both of them. Oh. I only asked for one row of data.
Okay. Hold on. Let's ask for, uh, uh, let's see, we'll say one row, but I'm
going to get after that zero would be the same as doing after zero, right? Like
that would be the same as that. What we'll just do it like that. That'll give us
all our rows. Okay. So there's all our rows. So the last one we added was this
one. Hello? From the fund or from the ESP 32. All right. Now, if we go back
to the desktop, okay. So this is the desktop and let me do an F five. Get a
screen. Okay.

And let's post data. Let's call it a command. So let's say we were going to
send a command and we want to send it to fun board one. And we're going to
say my shorts. Okay. So we posted that data on the fund board one or two to
the cloud.
Now let's go back over here and let's, let's see, four row and group equals, uh,
command devise equals what. We call it a fun board one. So this would be
how you would, uh, so let's do

make sure we get everything. So let's see what commands we have available
to us today. Okay. So we asked for everything after zero, which has given me
everything where the group equals command and the device is fun board one.
So we, we see that what we did on the desktop has now showed up here and
we could, uh, run, let's say this was a real command, and then we could run
the command and then we could get rid of it. Right. So we can say. We can
delete data three and that's the role ID three. So we're done with the
command. Okay. All right. So we've deleted that and then we could respond
back. Maybe we will, uh, let's see, would be post data. And we could say that
the group would be the response. And this is a response from, from fund
board one. And we could say I did it and we post that data. And then if we go
back to let me find it here. This is our desktop get data. This is going to get
all the date data. Oh, I should've, I should've done, uh, What did I do wrong?
Four row and get data. Right, right. There we go. So let me expand this a
little. Okay. So here's our response back from fund board one. I did it. So that
was, uh, just an example of how we could use our desktop. We, we sent a
command with the desktop and now we get the command back, uh, that it
was completed. Okay. So that's really all there is to it. So. Send commands up
there or send data up there. We can pull data down and we can have a
conversation between our devices. All right. So that's pretty much it. So I'm
going to control a and control X and I'm out of here. All right. That's about it.
It should be because it's a different. I've been at this for a week. Amy got a
haircut. I even changed clothes, but anyway, that's about it. I look, I need you
guys to get your IOT device and try this thing out. Get yourself an account
and start loading some data up there and let's see how this thing works. I
think it's gonna work great. Um, I think we can all use it.
E4HOME AUTOMATION USING
WEBSERVER ON ESP32
SENDING HTML PAGE DNS
MDNS ESP32
you're also going to learn how you can send the HTML pages, or we can see
a simple text messages to the connected clients with this wifi episode. After
that, I will also let you know what is DNS all about and what is this MDNS
and how to use the MDNS onto this ESP to board. And in the end, I will
making a simple home automation project in which I have create a web
interface, uh, so that we can control home appliances, which is connected
with the ESP three, two board from our smartphone.
Or we can say a laptop. So this is all you're going to learn after watching this
full project. So let's get started
open up the Arduino. Okay, so here is the code written by me, or we can say
edited by me. The code says home automation, web server. So this is
particularly edited version of the original code, which is available into the
files, examples into, uh, what we can say, wifi web server, and to this hello
server.
So this was the original code and I have edited this particular code to make,
uh, this home automation, web server.
So I will explain this whole motivation website in detail, and I will be
uploading this particular core on my GitHub account. And you can easily
download it from the link Oliver in the description of this project. So let's just
start with this particular code. This particular core starts with the four
necessary library.
Declaration. First is wifi dot. Add second is wifi client, or as third is a web
server not ad and for this ESP MD and a star test. Uh, first of the three, our
family must be family. We live with you all because first of all, some of the
functions, like by if I don't connect my phone to begin, all the functions are
available in this particular library.
Then the wifi client related functions are available into this particular library
by for server related functions are ever into this library and the MDNS, what
does MDNS I will let you know. But, uh, the emptiness functions are stored
into this particular library. So there's all the necessary library. Oh, let me tell
you one more thing.
Uh, you can use the same core by writing just the ESP two six, six wifi.at
least pick two, six is wifi client. Don't add, uh, likewise, if you don't know
what I'm talking about, kindly which all the third episode in which I would
talk into detail about this particular technique of using the core of ESP three,
two into the two

Okay, so let's move ahead. We have the constant character, which says SLE
name and the password. So he needed to write the routers as a name and
password to which an ESP three, two will get connected to it. Our ESP three,
two is acting as a wifi station. It is not acting as a wifi access point. That
means we need to provide the second name and password to it.
Uh, now that router may not be connected to internet, but still it requires a
central router to get connected to it. And all the other clients will also get
connected with that particular router and then we'll need th is particular
project will work. Okay. So let's move ahead. We have a string called button.
Uh, not this particular thing is nothing but a HTML page. I had been talking
about this particular stimuli page or how this estimate page looked like for
the, in the code where we are using this particular button HTML page. Okay.
So let's just, uh, give it a pause right now. I will discuss it later on. When you
had,
we have a web server or a class was instances declared as sober and it is open
at port 80.
Okay. So, uh, this is particularly actually report number actually report
number is 80 and our server is, you know, and that particular port only. Okay.
So moving ahead, we have a constant, uh, indigent entity, which is not used
in our products. I was just demoted. Rather than I have used the inbuilt entity,
uh, which is, uh, you know, built in this particular yes, Patricia Ward, I'm just
turning on and off the lat using that web server. We'll discuss everything for
them more than the hell.
We have function called white handled road. Okay. So this particular
function. Okay. Let's just discuss about this particular function here. This
function includes this. So for instance, which is nothing but the instance of
our web server class. What does this function do?
server.center. Now this function requires three inputs. First is that quarter, the
STD big quarter. Now I have discussed the atrophy code in the previous
episode, which is episode three of the CSPD received. If you want to know,
what is this all codes about? Now I will clear what is 200 court?
About 200 code refers to a successfully successful communication in
particular, our actual DB protocol. Okay. So 200 is a kind of a success code.
So we need to send this code at the starting. And the first input is the success
code, which is 200. If, if it, if it does that era kind of code, then we will be
sending four zero four, which we are sending here in this particular section,
we'll discuss a letter.
So first of all, the court, we need to send that issue to be code, which is 200 in
this case, then we need to specify what type of, you know, data we are
sending. Okay. So that is defined in this second input. So in this case, we are
sending HTML page and for HTML build, we need to write text forwards
less.
SGML. If we are sending a simple plain text message, then the format should
be text forward slash plain. This defines that we are sending a Blaine
message while this particular, uh, defines that via sending estimate repeats in
the form of data. Okay. Now the third input is the Estabil page itself.

So what we are doing or on the handle load, what does handle route defines
let's just comment here.
So you can get a clear image. What is this dude about route is regarded as a
homepage of that server. For example, if, if in case our ESP three, two has an
IP address called one nine one six eight.one.one forwardness. Now this
particular address is called the root of RDSP two web. So this is not the IP
address assigned to the CSP tier two.
I'm just. Uh, you know, explaining you the simple example. If this was the IP
address of the respiratory ward, then this , now this page is called or is
regarded as a route page of this web server. So whenever we are on the road
based what we need to do, that particular thing we need to define here. So
what the school says, whenever we are on the route page, or we can say the
home bed does send this particular estimate page to the client.
Got it. So whenever we are opening, there's a route page of ESP three, two
episodes will be given particular webpage, uh, in the form of HTML. Okay.
So this is what this handled with functional about one, the head

we have handled, not found. And what this particular functions is. See if you
requested the route page of the web server, which is for example, one nine,
two.one 600, 101.
So that is a road page. Okay. And if you are writing slash page one, now, if
that page one exist in the East between two, then it will give the page one.
But if the page one doesn't exist in the verified web server of the SPT two,
then it is termed as not found. Okay. The page, not from the generally VFC
that added four zero four.
It says page not found, this is the particular addict. If any particular handle or
any particular link requested is not found on the web server, then what we
need to do, then we need to send this particular chunk of code. Okay. Which
says, first of all, it will be printed as file not found, then it will be printing
the, you are right now.
What do you mean by you? Are I let just comment here. I will be explaining
in very, very simple terms. For example, our IP address is one nine, two.one
six eight, got one.one. So whatever written after this forest list is regarded as
you are I okay. So let me type as a page one slash on. Okay. So this particular
term is regarded as a U R I, I have also.
Open that particular thing on the web browser. Okay. So here is the page not
found added, which I requested in this portal. Yes. The three, two board,
which says you are at his lamp to slash off. Okay. So this particular thing is
regarded as a U R I. Okay. And after that, it is printing as the matter, like get
or post, but generally, uh, in this particular code I will using the get request
method only.
So it does the get method and the argument. So this particular thing is, or in
response to the connected client, if there is an added called page not found.
Okay. So after that year, we are sending the four zero four, which is the
status score. Four page not phone. Then we are sending a plain text message
and then we are sending the message itself.
Okay. But this particular function is sending this particular page to the
connected client. Okay. But this is all about the function. What had been, not
found. Okay. Moving ahead.
We have the white setup. White setup says, first of all, the analytics built in
which is, uh, uh, the built in led of the ESP toward.
So we are the guarding of, we are declining it as output. Of course we are
using this led as output, and we'll just remove this particular term because we
are not at all using this led. Okay. After that, we are beginning the serial
monitor at double zero portrait. Pretty simple. Then wifi got more function.
Okay. Vifa got more function. We have three types of modes in the years.
Pedro six is all we can say the years. Peter first is the station more. Second is
the access point more? And third is a boat model. In this particular project,
we are using it in a station mode in which ESP two six is all we can say is
the three door they'll get connected to particular router.
Okay. So this is a station mode. And after that, we are beginning the
connection to that particular router, who is, this is every name and password
are defined here. Okay. This is also pretty simple.
After that, it says waiting for the connection and after then it is establishing
the connection and it will print connected to that particular site name or
particular router name.
And after that, with the function called via fiber to local IP, it will the
printing, the local IP address assigned to this particular ESP to work. Now
you almost been knowing if you are not knowing, letting clear. Every device,
every client connected to the router will be assigned a particular IP address,
which is dynamic.
Okay. So it is made possible at every time we get different IP address. Okay.
So this is not a composer, is that the every time we were getting the same IP
address, we could, it's kind of a dynamic IP address. We just termed as a
local IP address. Okay. So we'll be getting the local IP address from the
Cedar murderer, as soon as it gets connected to that router.
Your head. We have, if condition with says MDNS dot begging ESP three,
two. Now this is the point where I should explain the DNS. Okay. Now what
does this DNS all about? So DNS stands for domain name system. Now,
what is this domain name system? Let me explain you with a simple
example. We all have used the google.com.
It's a great Sargent in, and we are using it in day to day life. Let me tell you
some facts. Every website has its own sower. Google has also, so what, and
every server is basically a computer and every connected computer has its
own IP address. Okay. Uh, and we're using that IP address. We are able to
communicate to the particular computers, right?
So this is one fact, second fact is a computer works on number. They don't
know what is google.com. They don't know what is facebook.com. Rather
they know the IP address of Google and Facebook. And if we provide them
the IP address, then only they can communicate to their server, but we never
provide IP address.
Right. So how they are, how they know, whereas Google invest Facebook.
Let me clear one fag, the IP address of google.com is this two one six dot
five, two one six, dot one six four. So if we are writing this particular IP
address on our web browser, then also we will be getting this Google
webpage, let us test it out.
I will press the enter. And as you can see, we are here with the google.com
only, right? So if we@google.com or if you write the IP address, it is one and
the same and how it becomes the same. This is because of the domain name
system C our human mind is likely to remember names rather than the
numbers while the computer remembers the number rather than the name.
So there is a mediator in between called the domain name system. Now what
the system do, uh, when you, when we are requesting a link, for example, a
google.com. And if a computer don't know about the IP does what the
computer will do. The computer will send this google.com to a domain name
system, and that system contains the domain name.
And on the other side, it contains its IP address. Also. So whenever can
computer request the google.com low-maintenance maintenance system, the
domain name system returns the IP address to the computer, and then the
competitor request that particular IP address. And we get the webpage or we
can get the Google doc.
So this is the process. Once we had ended the google.com and. Computer
bought the IP address the computer, or we can say the web browser stores,
that particular IP address in the cache memory. So next time you fear opening
google.com. It won't be requesting the domain in the system rather than it
will fetch the data from the cache memory.
And we can get the google.com much faster. Uh, as compared to what we
have entered for the first time. Okay. So this is all about the domain name
system. I hope you must be, uh, cleared about this domain name system. And
if we want to know into detail about domain name system, I have attached to
one link in the description of this project, which contains a detailed project
out DNS.
Okay. So this is all about the deal. Yeah. There's a domain name system now,
what is this? MBN is about, right. Uh, he had it as hidden as , rather than
BNS now MD in the stands for multicast domain name system. Now what's
the difference. See if I need to explain it, uh, very shortly, then it can be
regarded as a light version of DNS.
DNS requires a separate server, which is called a name server on with, there
are multiple domain names and on the other side, there is a IP addresses. So it
requires a different store. What and other systems. Okay. It is a domain mean
system. It requires multiple things to do the tasks. MDNS doesn't require the
name.
So server all just kind of a standalone mattered to get this DNS working on
the small tip, like ESP three, two, or ESP two, six, six. So what does MDNS
do? Ambient is makes us back inside this year's poetry to board and in the
stack, we have, I bet on the one side and on the other side, we have the name
using which we can access the web server of this ESP three to now that name
we can decide on our own.
Okay. So that name here is E S B3 two. So, whatever we are writing under
this inside this particular bracket is the guided as a name of that particular
web server. If, if I write a such thing, then it becomes the such in, becomes
the name of this wifi web server, which is running on this ESP three, two
board.
Okay. So with this, it becomes very easy to interact on. It's very easy to know
what this web server is all about. For example, we have two web servers
running on two different ESP, three, two boards. One contains the data of
motion sensor, one condense the data of temperature sensor. So if we want
the temperature sensor, we don't need to remember the IP address of this
particular board.
Rather we can assign a name called temperature, right? And now it's very
easy to remember that on which server the temperature data is store. Okay.
But if it was IP address, then it will be very confusing for a human being to
know on which iPad does the temperature data is stored on which IP it is. The
motion data is stored.
Rather than we can give a name like Embridge to this web server and
emotion to this website. Well, now it's very easy to face the temperature data
and the motion data. I hope I'm clear about those, how this MDNS is useful to
us. Okay. This particular case we are giving the name S ESP three too. So
next time, if we want to go inside the web server, we don't need to write this
it's IP address.
Rather. We need to write. E S P three, two dot local and forward slash. Okay.
So this particular term is equal to writing the IP address. Okay. So dot local is
compulsory. After writing the name of the web server. Okay. If it was such,
then the address will be such in dot local to get inside and CS potato.
Okay. So it's very simple. Now it's really very easy and MDNS is really very
helpful to make a project using multiple ESP three, two boards with running
with the different, different web servers. Okay. But this is all about MDNS.
Let's move ahead. We have started. We're not on now. Watch this function.
Do. This function has two inputs.
It can be regarded as one is a condition. And second is a result. If we got
forward less in response from the client, then we need to send the handle
route. If we got slash lamp one slash on from the client, we need to send this .
So it's kind of a condition and the reserve.
Okay. So, uh, whenever we got this forward slash this forward slash mean the
route page, right? Or for example, If we are requesting ESP three to dot
NOCO forge dash, then this particular function will get activated. And in this
points, we'll be getting this handle road, which we already discussed this.
Okay.
So we are just getting the estimate page in this point, when we're we are
requesting this particularly. Got it. Moving ahead. Somewhere not on. So
whenever we are requesting slash lamp one slash on, then what we need to
do, then we need to define here. So then we are sending simply a 200
response, which with a successful connection response, then we are sending
a text HTML page and button itself.
So every time we are sending the button, HTML page, only how the button
SDM of page looks .
Let me show you. Okay. So he and his dad came a bit, I will simply pop it
this STL page. And, uh, here's one website that has a link in the description.
So let's just click on the run. So, uh, this is the particular page which I have
created XTML page with says the home automation web interface. Click on
the respected button to switch the appliances.
So we have lamp on, on and off, we have lamp to on and off.
So I just learned the basic statement. And after that, I just learned about the
buttons and how to create the buttons. Okay. So this is Mark. I learned about
this particular things. So I just learned what is required for this particular
project, because I need to shoot it as soon as possible to upload it in this
particular week.
We are turning on the led on the next function. We are getting off requests.
So we are turning off the led and we are also sending this HTML page. So
every time we are, we get requests from the server via just sending the
skimmer page. And after that, we are doing the task. If it's four on, then we
are turning on the entity or if it was four off, then we're turning off the led.
So this is kind of an automation project, which can be made easily by simply
installing a via web server program onto this ESP three towards. Let me clear
the thing. This is a local area network based. So this will work only within
the range of the router on ESP three, two board is connected to it. Won't
work.
If we are trying to turn on and off appliances from a different country or a
different area, it won't work. It will work only within the range of the router.
Okay. So likewise, I've created a second page called lamp too. And if the
lamp to VR getting on request, then also I returned this built-in led high
because I'm not having another output, uh, on this particular board rather than
I need to connect the led on the, uh, external GPIO pin.
But I don't have a breadboard right now, so I haven't attached anything. So,
what I'm doing is if, if I'm getting this lamp to and on requests, then also I'm
turning on the, uh, inbuilt reality. And if I'm getting them to offer request,
and also I'm turning on the monster in build, and likewise, you can create
many buttons and many pages like lamps, uh, three on and off fan one slash
on fan one, fan winch left off.

And, uh, you can just, you know, Don on and off the respective appliances
inside this function. And, uh, in the response, you should send the page and
you should increase the number of buttons, uh, here,
That's also, I told you, so I think this is all about the code. Uh, where it is.
Okay. This is all about the court and have the last function with says server
on not found whenever we are not finding any page. For example, if I request
a lamp three slash on, then there is no piece of, uh, of lamp three. So what it
will do, it will just send this handle, not phone function, which is nothing, but
this added a message to four or four and a quarter percent.
And the message would be sent all file, not phone. After that we are just
beginning the Southern word and then the monitor, it will say the more
Deadwood Principe. So we'll start there. And the white lobe, it, it does
handling the client nothing as is done on the white bloop. So this is on a
bond. The home automation, web server code led to select the board
uploaded onto the SP three, two board.
And, uh, let's see everything in action. So I will click on this upload button,
I'll press and hold this boot button. If you don't know, what's the reason of
pressing this button drop the first episode of the series. Okay,

it's done uploading it really opened the CD more than press reset button.
Okay. So it is connected to my router, which is SMS is guard his own local
IP address, but we don't need to remember thanks to MDNS.
So amnesty says the responders started. So MDN is working perfectly and the
solver is also started. So we'll move to Google Chrome, uh, make sure your
device is connected to that same network on with the USB three, two is
connected.

We'll go to the new tab and we'll just type E S P three, two dot local.
Okay on requesting this particular link, we will be getting a web page or
estimate page and response. Okay. So we successfully got the same, uh,
estimate page we, uh, which we have seen here. Okay. It's the same STP as
page. We are getting a response. Okay. Uh, so if I click on this on button, the
light will turn on.
Let me just zoom it now. I think it's specific. I'll look on this on button and,
uh, Yeah, it depends either turned on am. As soon as I click on this off button
that it turns off on and off. And the same happens if I click on the lamp tone,
because I have given the same command on this lamp to function only.
Okay, on and off on that. And as soon as you are clicking on and off, as you
can see the link here is changing. Okay. Uh, let us live on this land bond. So
the link turns to be slash lamp bond slash slash lamp one slash on. If I click
create a, sorry, if I click on this lamp, one off the link changes to okay.
Slash lamp one slash of so. Everything is perfectly working as per the core.
We have written, let me just zoom it out. These, this particular web server is
perfectly working on this ESP T2 board. So this kind of amazing project, I
mean, you can make your own home automation system using this ESP too,
but you just need to attach the relay and on the relay, we can connect the
different appliances and give it a name.
On this web page, or you can say that scramble page and likewise we can
control or from laptop, or if we can even control using a smartphone, uh, you
can even make an application.
BLINK AN LED
Because we are going to control different GPS. Europeans. Don't worry about
this circular door here. It's very easy. The first project we'll be looking at how
to control the default lad.

This is the power in DD and there isn't one more in it. Easier at default
identity connected to GP or pin number two bling.
This particular led that is a faster project we are going to do. Make sure you
are. ESP 32 with a USB cable, press the reset button. The shell is loaded right
now. Create a new file for controlling this GPA or pins. We have to use
machine module. So machine module actually used to control all this
peripheral command is import a module mushy import time.
These are the two modules we want to do for our machine. We are going.
Function pin from time. We are going to use a function sleeve from machine
in port pin. From time in board sleep, you have to create an object to control
this, let Optiv cancer stuff, the pin number, and it should be an input or an
outside creating an object.
Any name you can give, I'm just giving like a Lily underscore or B D any
name you can give. I have given something like this equals. Bin. Now we
have to give the DPA your pin number before the lady is in GPA, pin number
two, comma bean dog out. Where are these capital letters this created and
led? To epi number two, and we are creating that penis actually. And I'll put
pain. Now you can create a while. You have to call the object led underscore
or BJ. That is an led object goat value. If one means that makes it on zero
means that makes it off. So I am giving led underscore object dot value. And
the value should be one that makes led on then after make it on. I wanted to
give a small, uh, sleep time. So one second do it becomes on for that sleep.
One second, after that, I wanted to make the lady object to be off led
underscore or widget or value. Zero. That makes led to be off. How much
time you want to do off again? You can put sleep again. You can give one.
So we have successfully completed the code.

Let's run this, save in the system. You can see on the board right now, but it's
going to happen. The default lad right now just started blinking at one
second. Okay. Delay
again, change the dine or here. And the sleep I'm just going to change the task
0.2 seconds on and off time. And let me update.

No, I see it is blinging very fast with her 0.2 seconds. Delay.
ANALOG TO DIGITAL
CONVERSION
We will be looking at how to use ADC. That is analog to digital. Yes. I have
used a potentiometer. I'll be showing the circle training.

And one terminal of the potential meter is connected to 3.3 volt and another
terminal is connected to ground. And the center at that point is connected to
GP up in number 32, new file import, ABC and pin from machine. This is a
command we use to import pin and ADC funds. From machine module from
time module import sleep, we have to create an object and ADC object.
Again, name anything in easy underscore object. You have to call ADC
inside the bracket. You have to say, what is a pin GP up in number 32 in this
case? Why do you want me to read this for that? I'm using an unavailable
value. The object ADC re. And release each and every one second gap, we
wanted to get it printed. So what we can do, we can go give it sleep.
One second time. I have no discord. Save this code. Now it is evaluate
reading us 673, somewhere like I'm going to rotate this point. Yeah.

Nowadays is to Zillow increasing the value.


By default, the maximum value we can read it is 4,095. Instead of this
potential meter, we can also use ADR like that. We can measure the light in
density.

Also, we can use this method to find the mortgage of a battery or something
like that.
CAPACITIVE TOUCHPAD
That's right button in ESP 32.

There are seven capacity that spins out there. We can use just like a switch. I
have used GPA up in number 27. This is connected. This wire is connected to
GPA up in number 27. When I'm touching on this particular terminal works
assets switch.
Let's see how to code for this a machine. We have to import that's bad and.
We can import the sleep. Also, we have the, that an object that object that's
fine. There'll be number I'm using DB in number 27 in this case as the touch
screen. Now, if I wanted to read the value in that touch screen again and
again, I can use while loop using a new variable where I'm going to save the
value of that.
This command makes to read pin and the value should be saved to available
call the value I'm giving you small sleep time. Point five seconds.
Let's see if I do happen. Let me run. This code have sailed.
Now the valley is coming like around 600 plus at one time touching this
particular pin. Let's see, what is it?

Now, once I test the value is decreased. It is comes around 50 60, somewhere
that that's, the value is less than hundred.
Once I released the value is going around 600 plus. So this change we can
use to accurate any of the task too. I'm going to. Control one of those led to
make it on and off. There's one of those led here I used that is connected to
GPA up in number 25, lets me control GPO, be number 25, which is
connected to the lady too, on and off. When we touch for that, I'm just
changing this portion value. We know that the value, when I touched it is less
than a hundred. If not touched is greater than. 600. So we can take a mean
value, like 600 plus hundred. That is 700 divided by two. That is around three
50. So three 50, we can take us a mean value.
Even we take 200. Also find in this case, I have to create another object for
the Illini led object and lady B number DBA been twenty-five.
I'm using this. Led dot on. This is another way we can make this particular
pin to be on the one of the last project we used the dot value function here.
We can also use in another way that is dot on function. I'm giving a small
time here as I can make the it needed to be off. So I made a small mistake. It
should be capitalized. Can really. off sleep. Now let's see how it will work.
So value is extended. The value is greater than 200. We, I made the lady to be
on. When I touch the lady becomes cough. You see, when I touched the span,
the lady becomes.
So this is the way you can use the capacity that spins.

You can go to the pin out diagram using that you can identify
what all that spins out available. You can use that at spins.
DHT11 -TEMPERATURE AND
HUMIDITY
we are going to use a sentence.

This is a DST 11 sensor, which can measure temperature and humidity. It


uses us one way, communication to power. This DST 11 module. I have used
a 3.3 voltage converter. I see here, this voltage converter converts a voltage
into 3.3.
That voltage is giving the DST 11 here. The data wire is connected to DBA
up in number 14, in this case, that's a good diagram. You can see.
So, this is the way it is connected. This is DST 11. Now let's see how to go
with this. The embody pin and sleep DSD module. We have to create an
object for the DSD module here. DSD underscore orbiter is object B HD dot
B H D 11. Then bin. We have to say pain. Pin number, this case I'm using
DBA up in number 14 for one buyer communication. Now we have created
that DSD object that is connected to the number. Darkly we called to measure
most of the cases. It shows some era to hour that we can use something called
a try and accept that is exception handling. So you don't want to do very
much about this tries the code. If it is not working it, accept the assumption
again, it will try like that it is actually working dry. I wanted to read the value
DSD underscore dot measure. Now, individually, we wanted to get that
temperature and humid. For that I'm using two variables for temperature. I'm
using it. Variable called a temp DST underscore or BJ doc generator. This is
the way you can measure the temperature for humidity. I'm creating an
variable TM dot humidity and you under the printers. There's a way you can
bring temperature and humidity. I can put a sleep here, maybe one second
time. It is trying to sure. And you're just getting the temperature and
humidity. It is trying to print, not able to do that. Then we have to accept that
Iran except us E so this up, if there is any eater and after that, it's again, price
and try to measure them back. And if it is any lot, it is getting if by mistake, if
you have connected in the wrong bin or it is unable to read this, then
everything will come under-do. Yeah. Or let me say, check what we can do
print, fail to read DSE 11.

Well, reset this module.


Okay. Let me upload this code and seeing the screen, the humidity and the
temperature is showing. Now the values can changing. If I blow, then the
value of temperature and humidity is changing and blowing into the sensor to
value is changing so way. You can also keep the sensor very close to USC.
Fan that I'm also, you can see the difference in temperature and humidity.
ESP32 INTERNAL
TEMPERATURE
We will be measured in Danna temperature of the ESP 30 like that. We can
find how hot it is aboard and all. Let me stop. We are using a function called
ESP 30 in bot ESP 32. To print with the delay you can use sleep from time.
You can import sleep. Now, if you want to read again and again, you can use
Y. Reading is very easy. You can create a variable. Here we are getting the
value in Fahrenheit. Command is ESP 32 dot raw underscore temperature.
Now the value is actually saving to the variable Calder, temporary temp.
Underscore F we can print it. We will name let it be two seconds.

Now let upload this code. Save.


Now you can see what is the temperature in Fahrenheit of the ESP third? This
is the way we can measure them. I wrote them rated off the ESP 32.
ESP32 INTERNAL HALL
EFFECT SENSOR
We are going to check the heart effects center in the ESP. I have a device
with me here will have a magnet. Let me ensure that

you can see is that test. That means to have a magnet. You have the import.
Yes, P 32 module. So important sleep. You can use Y loop using a variable
hall effect, sensor value. How to read this ESP 32 dark hall underscore since
there's the command we wanted to use to read the whole lab Qualifacts center
value again, give it sleep time.
Save the score, seeing his coat.

No, you can see the hall effect, sensor values around a hundred, 110, and
something is going, I'm going to keep it discloser.
Kenzie. When I kept it's very closer. Now, the value is reduced to around 20.
It is detected magnetic in density and I am removed.

Again, it will go to that hundred around a hundred values range again, I'm
keeping, oh, it's changing to 20 nearby value.
MULTI THREADING
Multithreading in this case at the same time, the processor can do multiple
tasks using threading function. You may be seeing the turning functioning in
Debra assessors or are AMD patients. Same way it's miniature version. We
can implement in the ESP 34 that we have to import underscore thread
function, name. It does in a different way. I don't want it to call everywhere
trend thread, thread, underscore thread. I can call it as in another way that is
I'm giving like, okay, underscore thread. I can call it just ditch. So wherever it
needs to be underscored thread there about, I can use th in import pin as well
as sleep. I'm going to use three LEDs. That's cute is like this

one is connected though. DBA up in number 25. One is connected to DPA in


number 33. And another one is GB up in number two, that is a default led. So
we have to create all three objects. I wanted to individually control all these
three LEDs blinking at a different blink rate. That's where we are going to
implement that thread.
We have to create that led functions, pin dot out led to that has been number
33 and led three. I'm using us in number two. So these are the three LEDs. I
created the object led one in 82 and the three, all these pins are output pins. If
you want to import the thread, we have to create different functions for each
and every elite.
And we have to call that particular function in that thread. Def is a key word
for creating function.
At 81 now inside, actually we have to pass two arguments. It is connected to
thread function. You have to pass two arguments, it can be anything. So one
argument, I am taking us message and there is a time. So two variables I am
giving over here for time. I'm simply giving us . Wine too. Now I can bring
the message now.
I wanted to make the lady want to be on and off with the time, whatever I am
passing. Yeah. And lady object one dot on then sleep. Yeah, I can pass that
time. A lady, one. off passing the time, variable and pass D.

So I have created the first function. Now I have to create similar way for that.
Other two more began, copy and paste and have to do that necessary. Editing
function. Number two, I can keep it as message. Instead of led one, I can
change the led to and led to similarly I can create one month. That is for
about next one. Third one function name is underscore sorry. Function under
score 83 here. I wanted to control that third Gilead. So here I can change this.
Okay. Now we have created three different functions for controlling three
different LEDs.
Now how to go the thread function. Okay. I show that from here, you can
import underscore, right? you can see here. How do you call the thread is
stop. Underscore new underscore threats. This is the way we have to actually
call them function threat. But if you look into detail after calling this, you
have to pass a typical, let's see how the buses is properly. Then some cases, if
the thread is not working well, now what we can do, we can use, try and
accept my dad to handling here.
So I'm using that one, right? Try what I am trying to do. I am trying to initiate
the first two, how to initiate the fostered. Third underscore thread underscore
threat. We actually calling it us H right now by using this line of code. So H
dot stop, underscore new. Underscore today.
Okay. And you have the bus, some of the things in this bracket, first things
you wondered about the function name to condo, the foster lady, the function
name is this one function underscore led.
so, um, just pass this function, then protect comma. Then you have to pass
up. That is two things. This stuff will actually go into this message and that
made even deep. So DV know that that is our. Message. You can put
anything messages and messages. So that's why I'm putting in double coats
led one, and then you can give then put a comma and what rate did want it to
blink, but I wanted to bring it up 0.2 seconds time.

Okay. Similarly, I can repeat for the other. Two more thread and that's one,
the thread function name is lad underscore two. This one is three. And here
also I can change like two and this is three. You can change anything. And
the second one, I need a blink rate. Let it be one second. And the third one, I
need a bling radius, two seconds. Okay, that is the lady in the 2051 blink with
the 0.2 seconds led in the 33 pin debate 33, that blinks with one second. And
the lady in the DBA two, that brings me two seconds. Now we are trying it. I,
if any urine is coming, there is one year colder that dark era. So we have to
accept that. So how do accept. It's up underscore dog. Then you can get this
under the micropattern.org, the website. If you can find it. Now, if it is found
any kind of eater than what you'd wanted to get print so I can get printed.
This is the message I would like to get into CD Manito here in the shell. Let's
update. And you back that are three LEDs. One is this one, one is this one
and another is a default. I'm going to update this the same.

I'm going to update to microbiomes and device so I can click on micro and
device here. I can give the name.
So you have to give the extension as door. Be wifi. So by default, there is a
file called it would not by his area. Don't do anything with that. So you have
to create something, the name dot P Y extension. So this is going to save in
that ESP 32. You can also save in that device itself, or you can save in your
laptop this time.
I just say showing like how to save into death. Yes, Peter did that.

This particular lady is planning with her two seconds delay. That is the
default lad. And this is plenty with the 0.2 seconds delay. And this one is
blending with her one second or multithreading is working well. into
different speed CDL morning.

You can't eat the festivities blinging and they showing a lady one secondary
lady supposed to be showing a lady two and 30 . This is the way you can use
multithreading does an example of multithreading same way you can
implement for, uh, different applications can simultaneously run by using
ESP 32.
FATAL FURY ON ESP32 TIME
TO RELEASE HARDWARE
EXPLOITS
I focus on hardware and Loevinger ability. So no affiliation. So it's time to
play now.

So few, few months ago I decided to break, sorry. I decide to investigate into
the ESP search tool. And, um, yeah, because it's a system on chips. Pretty
well deployed today. It was raised in 201 6 by a specification guide
company. They sold more than 100 millions of devices in January, 2019.
They became the wireless MCU is SOC market leader and they claimed to
have state-of-the-art security and provide 12 years longevity commitment.
So it's quite nice. Let's see. You can find this kind of platforms in IOT, a lot
of different IOT today's and bidding this platforms, and also on the way. And
it can be used as a wireless peripheral to have connectivity to two previous
system generation. So the target of course, is the following one USP such to
manufactured in fortune and a metallic node packages, CRI offenses boxes,
millimeter for Jade pins.

So it has some, some, some features. I will not describe all the features of
these chips, but here we can see you as an integrated, more than providing
wifi and Bluetooth is to Trello power based on extent, surgical colleagues,
the six disco can run up to a 240 megawatts. He has Rome as Ram, but no
CPU caches, a lot, a lot of GPI O's touch sensor, block ADC.
A lot of features. Also a lot of protocols supported by this, uh, IOT chips for
ISPI three. You aren't even can, but, uh, no USB, unfortunately.
So typically it comes with this, uh, form factors. It's a system in package
module the most, uh well-known is a USP such to w room such to, I mean,
this module is very easy to integrate with existing devices.
You will just have to footprint the module on your PCB E comes with an
integrated flash storage and other chilled for four megabytes. It's FCC
certified and it's really low cost. Maybe one to last to the loss for the tests. I
will use a distance from one kit. It's a dune, an official one, but I mean, same.
You plugged that to the micro USB, you can pull out the antibiotic treatment
kits. It provides a TT TTI USB ports dial to, to USB port to, to, to deal with,
um, with, with the cheap and the, and to program it. And then he has also
some exposed eaters and it's very low cost. I mean, $15
about the software as perceive as develop and, um, Open source the
deferment framework on GitHub. It's based on extensor, ESP, such to LF
toolchain, and they also provide a set of Python tools called ASP tool. And it
is used to manage the configuration of the cheap to, to flush the firmware to
the NPA, et cetera, et cetera.
So quality of documentation is very good. They provide data sheets, they
provide the technical reference manual. They even provide a read the docs
IO. They supported Reno, but I don't use it because it's pre-compiled library
and I don't like it. And this chip is also an official amaze on AWS IOT
platform.
So you can run a free, whereas mangos, Wes and everything you want RTOs.
So judging that today is to focus on built-in security. To do that. I just
grabbed the data sheet. And then at this chapter security, I can see four
points. So we are going to talk about crypto hardware actually, or stores. We
are going to talk about secure boot, flash, encryption, and a witch.

So it's time to start, but before to start, we need a plan. I will spend about
three months to investigate on these devices. During my spare time, my
objectives is to break one by one. The security features previously listed for
that. Of course I use physical access because I mean, it's easy and it's a
possible attack scenario today.
For example, we can fuck. We can think about a supply chain attacks are
even the dude. The final user attacking his own devices to profit. So I will
probably use other techniques. Fourth injection site channel, maybe
Microsoft during PCB modifications, some reverse, and the court review.

So towards the Volvo faulted voltage for injections. Sometimes call it a


voltage equation. So it's a, well-known still efficient and low-cost fault
injection techniques nowadays, a lot of public resources about voltage
unleashing. So I will not detail a lot, so it can go to the internet for that. But
the goal of these techniques is to pet up the power supply, to induce a fault
during critical software hardware operation done by the, by the platform.
So we can expect effects like skipping genes, frictions, for example, this is
typically useful to bypass a CMP instruction. We can also expect a
modification of that. Of course, this is really useful when you have to modify
branch conditions. For example. But we can also found the unexpected
effects because it's really difficult to predict and to understand faults in
nowadays complex CPU architectures to do due to the due to the cash effects,
maybe due to the pipelines of, of the, uh, of the, of the character.

So when we talk about voltage glitching, we have to standardize the power


domain. So yeah. The power domain of the USP, such too. He has a three
separate per domain is the IO power domain. It's not interesting for us. It's
RTC real time clock, domain, and CPU domain. First, we are going to focus
on CPU domain, and we can see it share to power signals, VDD CPU, and
VDR to see this is quite weird, but there are other, this is our design.
So we can see also some low dropout, uh, regulators LDO in between the
secure domain and the, and the external signals. This is to stabilize internal
voltage, and this may be, can have effects against the glitchy. I don't know.
And then in the data sheet, it's clearly specified pronoun detectors is present
inside the chip and.
They say, if the BDO detects a voltage drop, it will trigger a signal shut down
and even send a message on your art. So this can maybe detect some glitches.
So I did some tests and yes, I can. I can see the, the, the message on you.
What about the WTO and the reset of the chip, but this is only effective on
VDD RTC.
So consequently, I will only use VDD CPU to glitch. My ESP searched.
So now it's time to prepare the target. So I removed the shield. It's quite easy.
We can see now the ESP, such two in the center and near to eat the SPI flush.
Okay. The module is not screened, but the schematic side available. So it's,
it's really easy to reverse.
I removed the capacitors connected to the VDD CPU and VDD RTC. If you
consider two images, you will be, you will be a diff it's, maybe six or seven
capacitor misses.
So after that, I have to modify the PCB for that three steps. I exposed the
VDD CP. Trey's been such a seven. I cut this trace and I connect my glitch
that put the VDD CPU and I found a GNG, a point quite, quite trivial.

Then the, about the other setups, I designed my own mat e glitters. It's based
on of 46, 19, which is an analog switch. I add some passive components,
SMA connectors to be able to plug and unplug easily. My cables. I
synchronize this Gleacher by a scope and I triggered this, the glitch by signal
generators. I send USB commands to set the different parameters, like the
delay, like the weeds of the glitch, like the voltage.
So at the end, It looks like that. I mean, it's, um, it's a little setup and it's
controlled by patron scripts and it can run steering data's fully automatized.
So when I sleep, I can reach.

So I need to, they will fight the voltage glitching effects for that. I propped
the, you got zero because the URL is directly powered by DVD D CPU. Then
I glitch and I can see very big glitch effects on the, on the signal. It means
inside the chip, we can expect the same effects, the same low, low dropout
effects.
So for me, the effects looks quite good. I'm quite confident now.
And it's now time to, to make the third test on the crypto call. So crypto coin
is also called a crypto accelerators. Crypto engine sometimes is just a
peripheral to speed up the competition of different algorithms. Like, Hey,
yes, share RSA.
Why it is interesting to porn because it is used by the crypto libraries of
expressive too. They take it the dedicate, the one, but it's also used by the arm
and that GLS, Amber jealousy, the arm cryto library, and a lot of IOT are
using it today. My goal is to focus on the CPU crypto interface. So typically
the crypto drivers, of course, I do not expect to find a pure software because
this crypto library was audited since long time by a lot of skilled people and a
cryptographer keep talking.
But me, I I'm going to look for vulnerability triggered by false injections.
So it's time for code review, but in the data sheet first, they provide the first
step to describe a single ICS operation. So we can see the firstest
initialization of registers. Then you write one to a specific registers to start
the IES.
You, you wait until the end of the competition, and then you read the results
from the ISA Tex M registers. And this, when you look at that, you see a
design weakness because the registers use to store the plain text. Also used to
store the cipher text. This is typically are called Anchorage in place and it can
be risky because if something goes wrong during the IOSCO or even during
the step three, I'm pretty sure I can retrieve the Printex directly.
So this was pretty cool and simple to exploit as a first book. And it's why I'm
going to demonstrate that now.
So we look at the code. It's a crypto driver for a yes. And then we see the
same naive implementation of the steps previously described. So yeah, they
use the, uh, men block, uh, viable an array point, uh, an Arab pointer to store
the input, but also to start the output.
So previous weaknesses confirmed here. We have multiple spots to trigger
and to S to, to inset our fault, we can. Trigger ISDN start. For example, we
can try to fall to the wild condition. We can also try to fault the follow-up. So
it's quite, it's quite easy here. So as a poke, we can see on cipher number two,
the IES output is correct, but on the cipher, number three, the cipher text
output is the same than the input. So this was a very simple proof of concept.
Now the vulnerability. Number two is a about, uh, a set set key is a function
to load the key inside the crypto call. So it has to be secure and here we can
see just the follow-up. It's an unprotected follow-up to load a very, very
sensitive data. Consequently, when you target this follow-up. You will
change the value of the, of the final, uh, cipher text and then using a little
Python script. You said two, zero instead of a, such a, such a, such a, such a
rich play by 16. And then you obtain the same cipher text. So it means the
key was a set to zero. And this is good because the value of this key is now
persistent until the next set key. So it's typically nice to attack a ISC CBC,
for example, this wasn't a, some of the veal knife found in the crypto core. So
as a little conclusion, the crypto code does not improve security. I found the
surveillance in IAS and share as precise as perceive as batch since. Um, bet
jealous. I dunno. I went to responsible disclosure and, uh, yeah, I didn't talk
during one month, but during this time as precede tried to silent patch me, so
this is not very reluctant and the big boon tea from arm and bet jealous is a
fake one.
So you don't receive any reward. So I decided to not share with them. But I
was a little bit in a furry and the ready to point a little bit harder now.
So let's talk about the secure boot of the ESP starts to secure, which is the
protect from authenticity is here to avoid firmware modification because it's
easy to flush directly a malicious firmware into a SPI flush, especially when
you have a physical access and the CRC today, they are not sufficient.
The secure boot, we create a chain of trust from the boot room, which is the
first code executed inside the USP to the bootloader until the final
application. So secure boot is here to guarantee the code running on the
devices is genuine and it will not boot if one of the images are not properly
signed.
So first during the production. The the, the, the developer has to set the
sexual bootcamp as BK. This is burned into issues. Block number two, I will
explain later I choose uses, but it's a memory inside ESP such this secure boot
key cannot be readout or modified because the issues is, are hit, right, protect
protected.
And this key will be used by the Bertram to perform ISA 256 ECB. Then the
developer. We'll create a CDSA KPI. The private key will be used to sign the
up and the public key will be integrated to the bootloader to verify the
signature of the application. So the bootloader signature is the following.
Now we have 192 bytes eaters located at zero zero on the flush SPI layout.
The first. 128 bytes are pure random. And then we have a digest 64 bytes
digest. This, this just is the result of the Ash of the encrypted bootloader. Plus
the CGSA PB key. And this are encrypted by the, by yes. Using the secure
key. And then it's just ashed. To, to, um, to finally obtain the in the spa
fleshly out now on the field.
The good process is the following one, according to my reverse reset vectors.
Okay. T that address at the bottom, then the rum starts the rum loads and
check the boot images using the secure bootcamp. Loading from the OTP
from the chooses, then the Patruda starts is if everything is okay, then the
bootloader load and check the final application using the ECGC PB key.
And finally, if everything is okay, the application is running, using a
executives in place mechanism. Here we have two verification mechanisms.
One is the boot rom stage. Stage zero, which is here to compute the digest
with the secure boot key and compare with the 64 bytes edgy, just previously
flushed at the zero X 80 inside the SPI unwell.
Then we have also a CDSA verification done by the bootloader. And the
micro sec was, is used. It's an open source, uh, erupted Jeff's cryptography.
So. I will focus on stage zero, of course, because the signature here is based
on symmetric crypto. And this is a very, very, uh, uh, big mistake. So, and I
will focus on secure boot.
Key of course, is the IAS used to sign the bootloader and this is a critical
asset, but, and fortunately it is protected because I cannot read out this secure
boot key from the issues is according to expressive
now. I'm going to set the secure boot on the USP search tool. This can be
done automatically by the, by the framework, but I prefer to do it manually.
I'm burning the secure boot key inside the block. Number two, using this
command. And then I set the secure boot to abs done the fuses to activate the
secure mechanism. We consider issues map here. We can see a integration
point on the BLK too, because I cannot read out this key. Okay. Sexual
beauty set, but I didn't, uh, bondage tag.
He chooses, we will see that later because I think debug is always pretty easy
and prettier useful to explore it and to prepare exploits.
So sexual, which action is very simple. I designed a little a coder, so it's a
little water. I sign it using the SBK I make flash and then it runs, of course,
then I unsigned, I modify the code to do an , but I don't sign it.
I have no key. I flush it inside. I compiled a flush and then of course it failed
because the verification in stage zero is not, um, it's not good. And this is
perfect for me because
now I want to bypass the secure boot. Why? Because bypassing the secure
boot will give two workers. Good execution. Good execution of the, on the
devices is the first things to do for when you ask something.
I will force the ESP substitute to execute an insight bootloader, and then I
will load my insight up. I will focus on Butran because it's always outward,
always nice to exploit from vulnerability. And it's always nice to fix. It's
always difficult to fix patrol vulnerability. So I need to reverse the petroleum.

And first I need to then pit. To them, the petroleum. It's very simple. I look at
the memory map. I can see it the first line. It's very simple. And then maybe
you remember, I did them dumb G-Tech if uses. So I connect a little FDDI
border to the USP certitude. I use to GDB. And I have a, now a full, fully
back access Island to the reset vectors.
I can singular. I can single step inside the Bertram so I can also easily dump
the Bertram.
And it's time to reverse. I will not describe all the rivers because it's quite a
painful task, but extend size, exotic architecture has some different, um,
mechanism than arm and, uh, architectures like G-Star windowing.
The lens of instructions are difference. Also they have different lens
depending on instructions. So. Hopefully the instructs, the instruction set
architecture is available for that for the Riverside we'll use either with a
plugin from the mud inventor. Very, very nice plugging from this guy. And I
also grab the secure boot edge inside saggy tub, which is listing all the wrong
functions they deprecated since.
But now I have all the, all the symbols. And I also call a friend to check my
mess. Always go to a friend's agenda. It's not, it's not perfect, but it's clearly
doable. I can reverse. And for example, ear, I displayed the start of the rom
functions.
So, so I dig a little bit inside this, uh, Bertram and I locate the functions in
charge to check the secure boot. And the petroleum it's called check finish.
And when, when the results is wrong, we'll go to the left side and we'll print a
secure boot check failure. We will, we will see on the URL, uh, uh,
previously. So this is decided by a BN brunch, if not equal immediate
instructions. And the result will depend on the eight, 10 registers. Which is
store storing the, the return value of the secure boot check finished function.
So my goal, I want the PC to jump to the 40 zero zero 75 C5 to execute the
bootloader. So these little instructions is my target now.
So it's because I have access. I will validate this. Using a little, uh, G-Tech
script. So I use a piano CD to connect them. And then I launched my, uh, my,
uh, script to GDB. I wait a little bit and then we can see, we can run and sign
the code, using a little patch on eight, 10 registers. So now we stand for it's
time to pawn. For real, because in real life you don't have a geotag normally
available. And I was not able to find a way to export and to exploit this film
by pure software.
So here for the injection is my only way I modify a little bit to the producer
setup, to glitch SIMIT NUSELI on VDD CPU and Alison VDU RTC to have
a maximum dropout. And I also probably the SPI mosey. To have a timing
information about the frames.

GSPI the first attempts they look like that on the, this is a scrub scope screen.
And of course my previous is, it is helpful to find the timing and the, and the,
and the specific windows I have to, I have to insert the glitch. So. I will
locate. Yeah. Yeah. I assume inside. Yeah. So we can see channel one is the
cellular output, providing some printer, uh, information.
Then we have the SPI, um, frames and I will glitch just after the end of the
SPF frame. Okay. Yeah, we can see the glitch was not able to modify the
corridor of the Bertram and then we can see the secure boot check, fail
message at the end.

But with a little bit of time, a little bit of, uh, um, modification of parameters.
We can see here on this scope, screen the message on the UART as the
change. And this, it means the CPU is jumping to the entry point. executive
now.
So as a book from the shell point of view, it looks like that. The the ASP
search tool is an easy infinite loop, trying to look to, to load the, this insane
bootloader.
And finally using a little glitch. I can run my inside code, sorry for the chilled
Mitch we'll slate.

So the conclusion secret with my past exploits. It's I'm done using a neutron
vulnerability trigger by fault injections. This is not persistent if a reset of
course, but the good, the good thing is you have no way to fix without, uh, on
revision.
I went to responsible disclosure. I sent the pecan drink for, I posted on
September one. Then the vendor provide a situated visa. We have September
two. They request the CV and they decide to patch, um, the secure boot
model by enabling all the times the flash encryption. So it means now this
attack is not possible because you will have an encrypted bootloader, and this
will not be correctly decrypted.
By the USP such tool. And then your bootloader will not be executive
because it will execute, uh, uh, trash instructions, uh, for the information
security lab called the rescue founded the same vulnerability than me. I mean,
on the secure board, my job is done now and it's wire.

I'm looking for the flash encryption. The role of the flush encryption is to
protect the filmer confidentiality. And of course it is to protect against the
Beanery rivers without flushing encryption. It's really easy to extract sensitive
data. I, I did a little bit of work at the beginning of it. Yeah. With that pouring
gas on the summer, uh, light bulbs, wifi, light bulbs.
So always was a little job. Fiance. Encryptions is more and more present to
the devices. For me, it's a little bit of, um, security by obscurity, but
nevertheless can be, it can be efficient as precede recommend secure boot
refresh encryption for maximum security.

So let's redo this for flash encryption mechanism in inside the ESP search
tool. We have a flush memory controller and the flush encryption blocks is
done in hardware, doing encryption and decryption. Inside this flash memory
controller, it fetched the key from the excuses and it also fetch some other
parameters and it decrypts an anchor grifter instruction and data into a
caches. And from a software point of view, you cannot access towards this
particular. Oh gosh. It's so yeah, the flash encryption key is the main asset it's
digest key used to decrypt the firmware and it storing issues. BLK one.
So I do the same. I said the flesh interruption, I burn the flesh encryption key
inside bill K one.
I activated the flush encryption. I flush and encrypted firmware insider. I
checked my issue's map. We can see now we cannot read out BLK one and
DLK two. And the firmware I dump. The flash firmware to verify it is
encrypted. So maybe it's not a very, uh, very common, uh, to, to see central
Tinder on this picture, but you can, you can trust me, it's encrypted and we
can see ECB because some, some, some 16 bytes, um, data can be repeated.
So how to break the flush encryption? I did some tests. And I did not find a
particular weakness to access the key by a pure software and did not find a
way to attack by a differential false analysis, which is a kind of fault injection
techniques to attack a yes, my last op was a side channel analysis to target, to
patrol that decryption during the, the, the load.
From the, from the, from the spa flush to the, to the restaurant. But my setup
was a little bit too limited, I think, because SPI plus it producing a lot of
noise and I was not able to control the spa frame properly to, and then to have
nice acquisition for my, uh, for my, uh, offline treatment of, of, uh, DPA
curves.
I tried DPA attack CPA, but I didn't have enough leakage. So. I spent one
week, no results. I am. I was a little bit tired and yeah, I mean,
I have to conclude on that and yes, I lost against the flush encryption, but I
remember to follow some advices. And as photographers we say, if you
watch carefully open-end techniques, you will maybe find these weak points.
And it's why I'm going to explain right now, because the weak point was in
the OTP fuses and the OTP chooses. It's a one-time programmable memory
based on excuses, of course. And if uses is, can be programmed just one time
from zero to one, once it is burned, it is over, you have no possibility to
rewrite it or to ripe it.
The organization of the GSP search to, uh, if she uses array is the following
on BLK zero. You have ESP, such two configuration BLK one is dedicated
to fresh and, and key BLK two is dedicated to secure, but key and BAK three
is reserved for user application, like a custom Mark, for example, or Somoza
data.
According to his perceive this infuses their cannot, they are re right protected.
And so you cannot read out or modify once the protection bits are set and this
infuses RA, they are managed by your issues controller, a dedicated piece of
hardware inside the USP search tool.
Let's go to reverse, to reverse a little bit, these fuses and in the Bertram, I
only find to identify two of two functions. If you read an issues program and
this functions, they are only used during a special boot mode. And this is kind
of interesting for me. The boot rom never touch OTP values directly. It
means only the fuses controller has access to the OTP it's pure hardware
process. And because the boot rums need the sexual with key. This process
has to be set before the Bertram execution.
So let's talk about the special boot mud. The ESP started to as a special boot
mode called Donald boot. It's a management model to flush firmware, to set
infuses, et cetera. And this can be, can be activated by connecting IO. Zero to
GNG and then to pull up and then we will obtain a dis a message on the
UART.
Yes. is the dedicated Python utility to communicate with the previous, uh,
run functions. He has dedicated comments available from UART to deal with
the fuses. So you can, um, you can program it's quite useful.
So let's talk about the issues protection, because when you try to dump the
issues is value on a USP, maximum security, um, set.
You will obtain only zero. So you can see block one and block two in block
three is only zero, but my goal was to identify the right protection bit. And
this I found yeah. On the first word of BLK zero. And these two bits here are
the read protection bit, but okay.
Wait, where is the, I have no view. Yeah, sorry, but I know some stuff I know
the boot room does not manage the issues.
I know the issues controller has to do the job before. I also have some
knowledge about the special boot and. Also the location of the reproduction
bit. My goal, my idea is to bleach the issues controller initialization to modify
the read-write protection. And then I sent them command in special mode. I
read out the BLK one and be allocated.

So I call that photog rich. Then first I have to identify this other process. It's I
did, I do that by a simple power analysis. And then when I zoom a little bit
inside this process and I glitch at this very specific time here, we can see the
power consumption channel three. The results of the glitch during this
activity is the following this.
He's a secure boot key and a flushing cryption key extracted from issues from
a maximum sexual USP such. So when you obtain that, I mean, you're quite
happy.

But certainly the , they are not exactly true values due to the glitch effects or
due to the two due to the, um, the design of the, of the, of the chooser array.
And I know that because I planned the keys, so I know the value. So I do the,
um, I have to do some offline statistical analysis. So I repeat such a 50, 50. 50
times that, um, do attacks to obtain a set of them. But Keith and I just keep
the most recurrent bytes, ER, is for secure with generalizes. And finally, in
the worst, in the worst condition, I have to brute force one bites of the IAS
256.
Key is not so bad. Is it the same for fresh encryption? And I mean, one bite
brute-force. It's not a problem.

So he has the flu fertile exploits. First we have to decrypt the firmware. You
dumped bankrupted VMware using the download mode or by dumping the
flash directly, you perform the fatter leech to extract the keys.
You run the statistical analysis, and then you have to confirm the true flush
encryption by decrypting the firmware. Okay, so you, you set the script and
when you obtain a decrypting somewhere, You know, the key, the key you
have used to decrypt the firmware was the good one. Uh, we have to respect
the bite or the, in the binary file.
It's completely different than the, than, than the, than the bite, the, in the, in
the issue's array. So yeah, it's just, it's just a remark.
And then now FEMA is not decrypted. I know I can. Extract the first 128
random bytes located at zero X, zero in the decrypted, the fume. Well, I also
extract the Petrolia at address zero X, 1000, and then I confirmed the true
secure boot key by, um, computing again, the digest.
So here is the, is the, is the initial digest located at zero X 80 and by using a
digital security patrol document once and the, and the, and the, the keys.
When, when I obtain the same digest, it means the secure key I have used for
the specific commands was the good one. Now I know the two keys I can
write my code.
Maybe you need to learn I don't know. I compile using a fresh encryption
key and a secure boot key. This is a totally transparent now and set it by the,
by the, by the framework of, um, of the vendor. I flushed the new firmware
and it's done
so about the conclusion of that. It's a exploit leading to a key and a fresh
encryption key instructions, your break, secure boot and fresh encryption
because it's based on a symmetric, crypto and attack your can decrypt the
firmware and access sensitive data can access.
IP can access a user data and attacker can sign and run his own encrypted
code persistently. So good luck to detect if the female was modified. It's low
cost, low complexity. If the keys are not unique by devices, you can have a
nice, uh, trouble. It's easy to reproduce, I think no way to fix and all the USP
such diversion of in a row.
So vendors, ration, responsible disclosure. Of course I pop. I sent a poke on
July 24, the images we have previously seen, he questioned the CV for me.
And then I posted November searching and it was nice because they publish a
security advisory on November one. So, I mean, they learn since the, the first,
uh, The faster communication between us.
They are more reactive. I mean, it's kind of nice to see that. So in the security
advisory, uh, they say they have a no solution, but you can be the next edition
of the USP search.
It's so bad for business. But, yeah, it's still millions of aerobic devices on the
field for the coming years.
The impact for beast. I mean, don't worry. You're connected. Devices is safe.
It's not a troll. It's not a program for you for the developers in case you are
using a USP, such to security fees to have previously attacked.
To protect your cigarettes. I'm in, you shall be a little bit void maybe for your
information identified three company using a USP, such to fresh encryption
and secure boot in the project to protect, to protect their business model. I
will not, uh, um, tell the name of this company for the vendor. It's forced to
modify slick on to save his longevity commitment and his reputation.
And the, yeah, my, you just, I just have a question about current devices or
fretful sales.
So final conclusion now, an attacker with physical access can compromise
USP, such to security, buddy. It's best system bypass of secure boot and fresh
encryption. So fix no fix, but form is broken. A new chip fashion will be
released. For me, it's the end, a little general message for vendors. So don't
patch silently than patch. Silently security researcher is not elegant. It's not a
good technique, new results coming soon. Of course. So stay tuned, reference
in credits here. Uh, how long does it take until it actually glitch and you
manage the successful to actually bypass. He's not in the first drag. Yes. I'm
trying. How am I? How much time? Who should I let it run until I get the
result? I mean, yeah, I was in the identification process, so it takes me a lot, a
little bit of time.
But now with this presentation and with, and with the, um, the blog post, you
can reproduce very easily because you have the timing. You have the weeds
of the glitch you have to set up. I mean, for, even for a proficient taco, I
mean, in one week he can reproduce this attack. I'm pretty sure about that.
No, the question was, if I try it, for example, I have some devices that don't
want to hock it.
How much time does it take? If I have a production line to heck. I have to
keep it for how long until I managed to. You said you like English every time
in the first try because usually the bottom litchi, it takes, you have to try for
multiple times until you actually get the results. Yes. Because you have to try
multiple time because you don't know the specific parameters.
Off your off your bleach. Okay. So you have it. You can use almost to every
touch. And with this presentation, you can find a lot of information. So this
will speed up your process. Okay. Thank you very much. Welcome.
Uh, very nice. Reshared thank you very much. For percent in it. It was super
good. Uh, do you know if the new ASP 32 S two is vulnerable to, or that is
the new version that they, I mean, you should probably, um, contact the
vendor for that. Because they have no information and, uh, I'm pretty sure
they don't want to send me a USP search to, as to for evaluation. So you
should contact them. nice. Uh, thank you for the talk. Uh, I went away to a
voltage greeting for the encryption. Did you call it any faulty Sephora test?
Can you repeat, please? When you took reaching to the encryption, uh, like
the encryption core deal, get any faulty separate tests. Yes. Yes, of course.
You have a lot of faults. Uh, you have to, to sort to filter us and then depends
on your own on the algorithm. And you try to attacks depends on, on what
you want to do. Yeah. You can use or not. The different faults. Some full-
time more useful than others. Yeah. Uh, I mean, uh, you said you get some,
um, Safford tax, which is, uh, the same as the plain tax. That means the
encryption doesn't execute. So did you get any, uh, faulty Safford tax, which
is different than the plain text? Yes, of course. Okay. But it depends on your
timing. Okay. Because of course, if you are going to glitch the competition of
GIS yes, of course you will have faulty cipher texts and maybe you will be
able to do DFA, for example.
AUTO CONNECT TO WIFI
NETWORK
Carnegie or ESP 32 to your laptop using a USB cable and reset your ESP 32
by pressing enable or the reset button micropattern and terminal is Lauder or
the Shelly's Lauder to connect with any network you have to import network
network is important.
Now we have to create an object. My object name is station. We are going to
set it. Does it station mode may object to be active.

So how to make it active, you have to say true, no stash and more get
activate. So it is getting activated for scanning any of the network available
around the command Mandy's object creator. That is station God scan.
Here. These are the results. Yes. One network is you might do under years,
ESB, hippie, kind of the reason why another S ESB, AP one more. Then
these are the society of different network. So these are the strings of each and
every network. This command. Check, is it connected to any of the network
mistaken? Tell me DCS that debt. Now it is showing. Okay. It is not
connected to any of the network. That's why it is returning for someone to
connect with you. My network. How to connect station. That is our object,
dark connect. We have to pass a society and password here. You have the
boss, you are a society. In my case, I am passing Maya society. You might do
comma. You are the passive password in my case.
this is the password. I'll change that later now. Let's see, uh, it is connected.
Now we can check. Is it connected or not? By station.is connected command.
Now it's showing that truth. That means it is connected. The ESP 32 is
connected to my network, local IP address of my. ESP 32 by using the
command station. He's our object creator. now by this command, this ISTA
IP address. So it is showing the IP address, subnets, subnet mask, and
everything.
So this, this is a way we can make sure that it is connected to wifi, or we can
make it connect. I hope you understood this. Now what we have to discuss
little bit detailed deal. This many projects we discussed code, and it is saved
into a laptop or the desktop, some programs. We also see everything to that.
ESP did any check on this. Micropattern device the file system, the bulldog
by his main file here. This is one of the file Meech we saved from the last
session. I'm just going to delete this when the ESP 32 boots up the fast to fire
is going to run this boot.by so we can take what other things inside. So these
are the commands inside boot or pilot. We don't want her to change anything
in the boot door. By now, once a boot is run the next two, one by default, the
ESP 32 check for a file called main door by now, we haven't made any file
called the main door pipe. So if a mean program is there, you have to agree.
Your project into main door pipe. If the power is gone, once the power came
back after boot.by program, we'll go to and check for the main door pipe.
Then the program will drive. We are going to write a code for auto connect to
wifi network. We know that what, like I mentioned, we wanted to use, I'm
going to create a function, keyword, Def connect import network, your SS
ID, your. Password me late. We wanted to create our object here. We had
created like something called the station. CBA can create here. Station is the
objective, do it. The station mode in the ESP 32 by the command, activate
this function, the object connect to our network. So that's the one we used
here as, as ID and password. Okay. You can change here. You are a society
and password while station dot E is connected. You going to do equally.
Fourth. That means if it is not connected, then just pass, pass means then it
will not do anything otherwise, so you can make it, print it. Okay. Let it be
print print. No. Not connected to network. You can give anything always you
can put, pass over their other case. We can print the connection is successful.
Also. We can make it brain. What is the configuration? That is the IP address
for that? We can use print. We use this one. Okay. Can copy and paste over
here. I'm going to save Windup Micro pay then device name, Calder connect,
wifi. That that is copy this one. Also, we need this later, make all these to get
it. Connect auto connect for that, uh, after by the other file, which is running
is main or by, so I wanted to create some file called the main door. Control S
to the same micropolitan device, make sure that main.by, okay. I just saved
the Stu the device. Now, in this case, we have created a complete function
that is connect wifi. So I can import this complete module two. Main door PI.
So how we can do our own module in port we are the call the same way
here, how we have saved. Okay. I just imported that under this particular
module, there is only one function. That function is kind. Now I have to call
that particular file. How do I use that function? Why you fight? Okay. Dodd,
I ordered to make it connect that is from here to here so I can use

no. Let me save. Now UC Carnation is successful, then it is showing also the
IP address, which is allocated by the router to ESP 13. I have done some
corrections. I let I have put in double quotes by considering previous one of
the program. So actually this value have to pass to this variable. So you can
directly give the variable name here.
Not in double codes, then I have added some time also here. So it makes
enough time to make it connect. Now what I'm going to do, I'm going to
reconnect the ESP 30 to reboot.
You can control plu s D no after soft reboot, commercially successful. It's
again, given the IP address. Now let's set for the hard reset.
I just remote. I just reconnected. I'm not going to do any coding here. I'm just
going to just re-inject DDA RBL.

Oh, my group had an RPN. Is Laura.


After trying so many number of times, it is again connected successfully to
our life. Thank you for watching this video. I hope you understood. Almost
the basic of micro identities.
THE END

You might also like