MicroPythonWebinar - IOT
MicroPythonWebinar - IOT
Using
Micropython
Outline:
• What is IOT
• The “thing” in IOT
• HTTP Communications
• Sockets
• Webservers
• HTTP in ESP32
• Demos:IOT applications in ESP32
RECAP from Session 1 and 2
What is Micropython?
What are sensors?
What is Micropython?
Micropython is:
• A complete reimplementation of Python
• Designed to be efficient with resources
• Compact enough to fit and run within 256k of code space
and 16k of RAM
• Allows faster iterations
• Optimises developer time
• Worry more about the solution, less about the
implementation
ESP2 modules:
Sound,temperature
, pressure,light, Sensors
vibration,humidity,
position
Lets Start
WebServers
The Internet
192.168.10.3
64.233. 160.0
192.168.10.4
60.233. 160.1
Clients
192.168.10.10
The Internet of Things WebServers
192.168.10.15
192.168.10.10
Things as
Clients
64.233. 160.0
192.168.10.3
60.233. 160.1
192.168.10.4
Internet of Things
The Internet of things is a
system of interrelated computing
devices, mechanical and
digital machines provided
with unique identifiers and
the ability to transfer data over a
network without requiring human-
to-human or human-to-computer
interaction. Wikipedia
How does data move in the Internet
WebServers
HTTP Packets
HTTP Packets
Clients
HTTP Packets
Why IOT
VS
Glocuse monitoring system.is it beneficial?
Fleet Management System
Diagnostic System
The Thing in IOT
• Must be similar to a computer
• Must have Computing Power
• Must be able produce data
• Must be able to sense its
environment
• Must have a certain level of
Robustness and Autonomy
How Can Things Produce and transmit data
WebServers
HTTP Packets
Sensors+Microcontroller+Python Clients
Car as WebServers
What is a Webserver
If everything goes well, the server accepts the connection. Upon acceptance, the server gets a new socket bound to the
same local port and also has its remote endpoint set to the address and port of the client. It needs a new socket so that it
can continue to listen to the original socket for connection requests while tending to the needs of the connected client.
Client server Communications
webserver webserver
Socket
64.233. 160.0
DEMO:ESP32 as an IOT webserver
DEMO:ESP32 as an IOT webserver
GPIO_server.py Index.htm
Networking Interface in ESP32
• Wireless connectivity:
• Wi-Fi: 802.11 b/g/n/e/i
(802.11n @ 2.4 GHz up to
150 Mbit/s)
• Can act as a Station or
Access Point
• IEEE 802.11 standard
security features all
supported, including WFA,
WPA/WPA2 and WAPI
while True:
cl, addr = s.accept()
print('client connected from', addr)
request = cl.recv(1024)
cl.send('HTTP/1.0 200 OK\r\nContent-type:
text/html\r\n\r\n')
with open('html2.txt', 'r') as html: cl.sendall(html.read())
cl.close()
HTML2.txt
<HTML>
<HEAD>
<TITLE>Your Title Here</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<CENTER><IMG SRC="clouds.jpg" ALIGN="BOTTOM">
</CENTER>
<HR>
<a href="http://somegreatsite.com">Link Name</a>
is a link to another nifty site
<H1>This is a Header</H1>
<H2>This is a Medium Header</H2>
Send me mail at <a href="mailto:[email protected]">
[email protected]</a>.
<P> This is a new paragraph!
<P> <B>This is a new paragraph!</B>
<BR> <B><I>This is a new sentence without a paragraph break, in bold
italics.</I></B>
<HR>
</BODY>
</HTML>
DEMOS
Webinar on Micropython Series
Series Titles:
1. Introduction to Micropython
2. Sensor integration in Micropython
3. Internet of things Using Micropython
4. Intermediate Python and the micropython Runtime Environment
5. Object Oriented programming in Micropython
6. Event Based programming in Micropython
7. Finite State Machines in Micropython
8. Getting to know the ESP32 deeper
9. Developing Robust and Autonomous software in Embedded devices using Micropython
10. Python Data Analysis using Desktop Python and Micropython
11. Power and Energy Optimization in Micropython Devices
12. Wireless sensor networks in Micropython
13. MQTT in Micropython
14. Sockets and networking in Micropython
15. ESPNow technology in Micropython
16. LORA in micropython
17. Machine Vision in Micropython
18. Intro to Embedded Machine Learning in Micropython
19. Intermediate Embedded Machine learning in Micropython
20. Artificial neural networks in Micropython
21. Intro to Autonomous AI Robotics using Micropython
For Your ESP32 and sensor needs
www.e-gizmo.com
Thank you