Topic 15 Using MicroPython on ESP32 Professor Peter YK Cheung - - PowerPoint PPT Presentation

topic 15 using micropython on esp32
SMART_READER_LITE
LIVE PREVIEW

Topic 15 Using MicroPython on ESP32 Professor Peter YK Cheung - - PowerPoint PPT Presentation

Topic 15 Using MicroPython on ESP32 Professor Peter YK Cheung Dyson School of Design Engineering URL: www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/ E-mail: p.cheung@imperial.ac.uk PYKC 9 June 2020 Topic 15 Slide 1 DE 1.3 - Electronics 1


slide-1
SLIDE 1

Topic 15 Slide 1 PYKC 9 June 2020 DE 1.3 - Electronics 1

Topic 15 Using MicroPython on ESP32

URL: www.ee.ic.ac.uk/pcheung/teaching/DE1_EE/ E-mail: p.cheung@imperial.ac.uk Professor Peter YK Cheung Dyson School of Design Engineering

slide-2
SLIDE 2

Topic 15 Slide 2 PYKC 9 June 2020 DE 1.3 - Electronics 1

ESP32 IoT Microcontroller (1)

Radio CPU core & memory Peripheral Interface Embedded flash memory Cryptographic Hardware Real-time clock & Low Power processor unit Wi-Fi Bluetooth

slide-3
SLIDE 3

Topic 15 Slide 3 PYKC 9 June 2020 DE 1.3 - Electronics 1

ESP32 CPU Core & Memory

slide-4
SLIDE 4

Topic 15 Slide 4 PYKC 9 June 2020 DE 1.3 - Electronics 1

ESP32 RTC and Power Management Sub-system

slide-5
SLIDE 5

Topic 15 Slide 5 PYKC 9 June 2020 DE 1.3 - Electronics 1

ESP32 Crypto Hardware

slide-6
SLIDE 6

Topic 15 Slide 6 PYKC 9 June 2020 DE 1.3 - Electronics 1

ESP32 wireless links

slide-7
SLIDE 7

Topic 15 Slide 7 PYKC 9 June 2020 DE 1.3 - Electronics 1

ESP32 Peripheral Interfaces & SPI RAM

slide-8
SLIDE 8

Topic 15 Slide 8 PYKC 9 June 2020 DE 1.3 - Electronics 1

Heltec ESP32 module

slide-9
SLIDE 9

Topic 15 Slide 9 PYKC 9 June 2020 DE 1.3 - Electronics 1

ESP32 with MicroPython (uPy)

PyCharm IDE

Editor Directory uPy terminal Flash ESP32 via esptool MicroPython firmware in flash ROM On-chip ROM for programs REPL boot.py main.py hello.py

  • led.py

rotary.py machine sys time esp esp32

  • s

network neopixel math

slide-10
SLIDE 10

Topic 15 Slide 10 PYKC 9 June 2020 DE 1.3 - Electronics 1

Lab 4A – Setting up the MicroPython environment

Install CP2102 drive driver

Task 1

Install esptool

Task 2

Erase and flash uPy to ESP32

Task 3

Install PyCharm IDE with uPy plug-in

Task 4

Flashing “Hello world!”

  • nto ESP32

Tasks 7

Display on OLED

Task 8

Explore uPy via REPL

Tasks 5 & 6

slide-11
SLIDE 11

Topic 15 Slide 11 PYKC 9 June 2020 DE 1.3 - Electronics 1

MicroPython Documentation

slide-12
SLIDE 12

Topic 15 Slide 12 PYKC 9 June 2020 DE 1.3 - Electronics 1

MicroPython Library Functions

MicroPython Libraries Python standard lib MicroPython and ESP32 specific lib

math – mathematical functions (e.g. sin, pi) sys – system specific functions (e.g. sys.argv) machine – functions related to processor itself esp – functions related to the board time – functions related to hardware timer

Various class libraries to drive peripherals

slide-13
SLIDE 13

Topic 15 Slide 13 PYKC 9 June 2020 DE 1.3 - Electronics 1

pyb - Class Library

machine Classes

class PWM – PWM signal generation class ADC – analog to digital conversion class DAC – digital to analog converson (2 channels) class LED – LED objects to control on board LEDs class Pin – control I/O pins class I2C – control I2C interface class Timer – control hardware timers class SPI – control SPI interface