ESP32: Difference between revisions
Content added Content deleted
Line 20: | Line 20: | ||
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 esp32-idf4-20191220-v1.12.bin |
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 esp32-idf4-20191220-v1.12.bin |
||
= Projects = |
|||
== I2C LCD == |
|||
Source: [https://github.com/micropython-Chinese-Community/mpy-lib/tree/master/lcd/I2C_LCD1602 github.com] |
|||
*Download the below library file from below link & upload it to ESP32: |
|||
https://github.com/micropython-Chinese-Community/mpy-lib/tree/master/lcd/I2C_LCD1602 |
|||
- mp_i2c_lcd1602.py |
|||
*Connect the ESP32 to I2C LCD-1602 as below: |
|||
P5 ---------------- SCL |
|||
P4 ---------------- SDA |
|||
GND --------------- GND |
|||
5V ---------------- VCC |
|||
* Testing the LCD: |
|||
<syntaxhighlight lang="python"> |
|||
i2c = I2C(1, sda=Pin(4), scl=Pin(5)) |
|||
i2c.scan() |
|||
lcd = LCD1602(i2c) |
|||
lcd.puts("Initializing..",0,0) |
|||
</syntaxhighlight> |
|||
*Print the output on the LCD: |
|||
<syntaxhighlight lang="python"> |
|||
from machine import I2C, Pin |
|||
from mp_i2c_lcd1602 import LCD1602 |
|||
from time import sleep_ms |
|||
i2c = I2C(1, sda=Pin(9), scl=Pin(10)) |
|||
LCD = LCD1602(i2c) |
|||
LCD.puts("I2C LCD1602") |
|||
n = 0 |
|||
while 1: |
|||
LCD.puts(n, 0, 1) |
|||
n += 1 |
|||
sleep_ms(1000) |
|||
</syntaxhighlight> |
|||
Revision as of 02:17, 18 June 2021
Basics
![]() |
Installation
Download the firmware:
http://micropython.org/download/esp32/
- Non-SPIRAM firmware will work on any board, whereas SPIRAM enabled firmware will only work on boards with 4MiB of external pSRAM.
- Firmware built with ESP-IDF v3.x has support for BLE, LAN and PPP.
- Firmware built with ESP-IDF v4.x, has support for BLE, but no LAN or PPP.
- If in doubt use v3.x.
Flashing the Firmware:
esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 esp32-idf4-20191220-v1.12.bin
Projects
I2C LCD
Source: github.com
- Download the below library file from below link & upload it to ESP32:
https://github.com/micropython-Chinese-Community/mpy-lib/tree/master/lcd/I2C_LCD1602 - mp_i2c_lcd1602.py
- Connect the ESP32 to I2C LCD-1602 as below:
P5 ---------------- SCL P4 ---------------- SDA GND --------------- GND 5V ---------------- VCC
- Testing the LCD:
i2c = I2C(1, sda=Pin(4), scl=Pin(5))
i2c.scan()
lcd = LCD1602(i2c)
lcd.puts("Initializing..",0,0)
- Print the output on the LCD:
from machine import I2C, Pin
from mp_i2c_lcd1602 import LCD1602
from time import sleep_ms
i2c = I2C(1, sda=Pin(9), scl=Pin(10))
LCD = LCD1602(i2c)
LCD.puts("I2C LCD1602")
n = 0
while 1:
LCD.puts(n, 0, 1)
n += 1
sleep_ms(1000)
- References
{{#widget:DISQUS
|id=networkm
|uniqid=ESP32
|url=https://aman.awiki.org/wiki/ESP32
}}