MakePython ESP32 Color LCD

From MakerFabsWiki
Jump to: navigation, search

Introduction

Python is one of the most widely used, simple and easy-to-learn programming languages around. MicroPython is a lean implementation of the Python 3 programming language that has been pared down to run efficiently on microcontrollers.
Makerfabs MakePython ESP32 color LED is development board for IOT applications. Based on ESP32, the boards can act as WIFI node easily; there on-board UART-USB convertors to enable this module to be programmed anytime with a PC. 1.3-inch LCD display screen is suitable for the applications that need colorful displays.
MakePython ESP32 color LED is preloaded with MicroPython, simple and suitable for beginners to learn the basic programming with MicroPython, Of course, users can free to change it to make it work with other platforms such as Arduino/GCC.

Model: MAKT32CL
MakePython ESP32 Color LCD.jpg

Features

  • Wi-Fi Protocols: 802.11b/g/n(802.11n up to 150Mbps),A-MPDU and A-MSDU aggregation and 0.4us guard interval support
  • Wi-Fi Frequency range: 2.4GHz ~ 2.5GHz
  • Bluetooth Protocols: Bluetooth v4.2 BR/EDR and BLE specification
  • Bluetooth Radio: NZIF receiver with-97 dBm sensitivity, Class-1/class-2 and class-3 transmitter, AFH
  • Bluetooth Audio: CVSD and SBC
  • CPU: Two low-power Xtensa® 32-bit LX6, ESP32-D0WDQ6
  • CPU clock frequency: 80MHz to 240MHz
  • Module interface: SD card,UART,SPI,SDIO,I2C,LED PWM,Motor PWM,I2S,IR,pulse,GPIO,capacitive touch sensor,ADC,DAC
  • On-chip sensor: Hall sensor
  • On-chip Internal RAM: 520KB
  • Integrated crystal: 40MHz crystal
  • Integrated SPI flash: 4MB
  • Integrated PSRAM: NO(MakePython ESP32 WROOM), 8MB(MakePython ESP32 WROVER)
  • Power supply: 5V, integrate 5V-to-3.3V LDO
  • Operating current: Average 80 mA
  • Minimum current delivered by power supply: 500 mA
  • LCD: 1.3inch TFT ST7789 driver
  • Recommended operation temperature range: --40℃ ~ +85℃
  • Board size: 70*32.6mm
  • Moisture sensitivity level(MSL): Level 3

Interface Function

MakePython ESP32 Color LCD 1.JPG
①Micro USB: USB to serial communication (Also supply power for the board)
②FLASH: Download Boot(Download Mode)
③RST: Reset button
④LCD: 1.3inch TFT ST7789, 160K-RGB pixel
⑤ESP32 Module: ESP32 WROOM(NO PSRAM) or ESP32 WROVER(8MB PSRAM)

Usage

Github:MakePython-ESP32-Color-LCD

Installing uPyCraft IDE

Click this link to download uPyCraft IDE for Windows:
  https://randomnerdtutorials.com/uPyCraftWindows
  After a few seconds you should see a similar file (uPyCraft_VX.exe) in your Downloads folder
MakePython ESP32 Color LCD 2.JPG

Double-click that file. A new window opens with the uPyCraft IDE software.
MakePython ESP32 Color LCD 3.JPG

Connection

Connect MakePython ESP32 Color LCD to your computer through an USB cable, follow the steps:

  • Tools > Board and select the board you’re using. Select the esp32

MakePython ESP32 Color LCD 4.JPG

  • Go to Tools > Serial and select the com port your ESP is connected to(download the USB driver at: CP210x USB
  • Press the Connect button to establish a serial communication with your board.

MakePython ESP32 Color LCD 5.JPG
You will see “>>> “ appear in the Shell window after a successful connection with your board.
You can type the print command to test if it's working. Try to print:

print(“hello, world”)

MakePython ESP32 Color LCD 6.JPG
It should print the “Hello,World” message.

MakePython ESP32 Color LCD Projects

Project_1: Display color words

Connect MakePython ESP32 Color LCD to your computer through an USB cable

  • Download the st7789.py driver library, romans.py and italicc.py file from here:Code
  • File > open and select the st7789.py, romas.py and italicc.py just downloaded

MakePython ESP32 Color LCD 7.JPG

  • Click on the right to DownloadAndRun

Download the sample code: Color_LCD_test01.py

  • File > open and select the Color_LCD_test01.py, then click DownloadAndRun

Successful download will show similar results
MakePython ESP32 Color LCD 8.JPG
Grammar explanation:

import romans,italicc       #Import the font
fonts = [romans,italicc]    #Add fonts to the list
display.text()		    #Display font, content, x and y positions, color
display.fill(st7789.BLACK)  #Clear screen

Show:
MakePython ESP32 Color LCD 9.JPG
The screen randomly displays words in different fonts and colors


Project_2: Get network time and display temperature and humidity

We use the humidity /temperature sensor at:
https://www.makerfabs.com/dht11-temperature-humidity-module.html
MakePython ESP32 Color LCD 10.JPG

  • Sensor Connection
  • Connect the simple sensor to ESP32 boards as following:
DHT11 Pins MakePython ESP32 Color LCD Pins
GND GND
DATA IO18
Vcc 3V3

Connect MakePython ESP32 Color LCD to your computer through an USB cable.

  • Download the st7789.py driver library and romans.py file from here:Code
  • File > open and select the st7789.py and romas.py just downloaded
  • Download the sample code: Color_LCD_test02.py
  • File > open and select the Color_LCD_test02.py
  • You need to change the network name and password below :
connectWiFi("Makerfabs", "20160704")  #Change the network name and password
  • Then click DownloadAndRun

Show:
MakePython ESP32 Color LCD 11.JPG
The screen shows today's date and the measured temperature and humidity


Project_3: Display color pictures

1.Upload images to MakePython ESP32 Color LCD, steps are as follows:

  • Install PIP, download address: https://pypi.org/project/pip/#downloads (skip this step if already installed, python3 or above comes with PIP)
  • Install ampy, use the upload file function, type the following command and press enter (skip this step if already installed)
pip install adafruit-ampy
  • Enter cd + image path, enter the following command and press enter
cd C:\Users\yuan\Desktop\MakePython ESP32

MakePython ESP32 Color LCD 12.JPG

  • Connect MakePython ESP32 Color LCD to your computer through an USB cable
  • View COM port in device manager, mine is COM21

MakePython ESP32 Color LCD 13.JPG

  • Modify the corresponding COM port, upload the BMP picture, enter the following command and press enter
ampy --port COM21 put logo01_240X240.bmp

MakePython ESP32 Color LCD 15.JPG

2.Open uPyCraft software. After connecting the module, you can see the uploaded image name in the device directory
Download the st7789.py driver library.

  • File > open and select the st7789.py, then click DownloadAndRun
  • Download the sample code Color_LCD_test03.py

If you want to display other images, simply change the following statement in the program after uploading the image:

test_main('logo01_240X240.bmp')

Show:
MakePython ESP32 Color LCD 14.JPG
You can see the picture on the screen

Project_4: Arduino test
1.Install Arduino IDE.
2.Install ESP32-supported packages.

Voice Interaction Hat for MakePython 105.jpg
  • Click “Tools>Board>Boards Manager” to search for and install the ESP32 library.
Voice Interaction Hat for MakePython 106.jpg

3.Install the LovyanGFX library. Click “Tools> Manager Libraries” to search for and install the LovyanGFX library.
MakePython ESP32 Color LCD 17.JPG
4.Open the code.
5.Select Tools-> Board-> ESP32 Wrover Module, and Tools-> Port-> COM… .
6.Verify and upload the code Makerfabs-MakePython-ESP32-Color-LCD/Color_LCD_test/Color_LCD_test.ino.
7.The LCD will show "Hello World".
MakePython ESP32 Color LCD 16.JPG

FAQ

You can list your questions here or contact with support@makerfabs.com for technology support.

Resources