Python in IOt
Python in IOt
School of Engineering
Department Of Electronics & Communication Engineering
PYTHON IN IOT
Presented by
Rakshana M
20080UEL07
III BE ECE
CONTENTS
• Python in IoT
• Solutions for IoT in Python
• Python on Raspberry Pi
• Python on PyBoard
• ESP8266, ESP32 with Micropython
WHY PYTHON IN IoT?
• It is simple to learn, has clean syntax, and has a large online community supporting it.
• Used backend or software development in IOT
• Works on various platforms like Linux , MicroPython for Microcontrollers
• Accessible in the cloud.
• Python recognizes the IoT project from scratch or interact with actuators, sensors, and
accessories.
• It has a large number of libraries for all types of platforms and the speed it offers at which we
can develop the code.
• It is a great ally for developing device prototypes.
3
Solutions for
• Python on Raspberrypi
• Python on PyBoard IoT in Python
• ESP8266, ESP32 with
Micropython
4
Python on Raspberry Pi:
• The I/O ports on the expansion bar of the Raspberry Pi can be controlled.
• The board supports wireless communication (Bluetooth and WiFi) and Ethernet.
• Monitor can also be connected to the HDMI output, a specialized 3.2" 320x240 TFT LCD, or a
low energy consumption E-Ink 2.13" 250x122 display for Raspberry Pi.
• There are controllers available in a large variety .
• Controllers are ranging from the fast Raspberry Pi 4 Model B 8 GB to the smallest Raspberry Pi
Zero, all supporting the Python programming language.
5
Example:
Let us consider the following snippet of Python code where we have used the GPIO Zero library in order to
control the I/O ports.
6
Python on PyBoard
• Another great solution for Python in IoT devices is the PyBoard with an STM32F405RG microcontroller.
• It is compact as well as a powerful electronics development board.
• It works on MicroPython.
Working:
• The PyBoard connects to the PC through USB,
• USB flash drive is provided to store the Python scripts and a serial Python prompt (a REPL) for instant
programming.
• It works with Windows, MacOS, and Linux.
• PyBoard executes MicroPython, which is a lightweight implementation of the standard CPython interpreter.
7
ESP8266, ESP32 with Micropython:
MicroPython:
• It is a lean and efficient implementation of the Python 3 programming language that includes a small subset of the
Python standard library and is optimized to run on microcontrollers and in constrained environments.
• The MicroPython pyboard is a compact electronic circuit board that runs MicroPython on the bare metal, giving a
low-level Python operating system that can be used to control all kinds of electronic projects.
MicroPython features:
• An interactive prompt
• Arbitrary precision integers
• Closures
• List comprehension
• Generators
• Exception handling
• Controls I2C, UART, ADC, DAC, and SPI.
• 256k of code space and 16k of ram.
• Dimensions: 33mm x 43mm
• Weight 6 grams.
8
Installing Micropython:
9
Developing & Working
Advantages
• Cost effective
• Works effectively on Pyboard
• Easy to write
10
Example:
11
Than
k
You Refence links:
https://www.javatpoint.com/internet-of-things-with-pytho
n