timeular/notes.org

1.1 KiB

MicroPython Implementation Notes

Circuit Layout

Pin Used For
37 SDA - MPU6050
36 SCL - MPU6050

SSD 1306

from machine import I2C, Pin
import ssd1306

rst = Pin(16, Pin.OUT)
rst.value(1)
scl = Pin(15, Pin.OUT, Pin.PULL_UP)
sda = Pin(4, Pin.OUT, Pin.PULL_UP)
i2c = I2C(scl=scl, sda=sda, freq=450000)
oled = ssd1306.SSD1306_I2C(128, 64, i2c, addr=0x3c)

oled.fill(0)
oled.text('ESP32', 45, 5)
oled.text('MicroPython', 20, 20)
oled.show()

MPU 6050

from machine import I2C, Pin
from mpu6050 import accel

scl=Pin(36, Pin.OUT)
sda=Pin(37, Pin.OUT)
i2c = I2C(scl=scl, sda=sda, freq=450000)
a = accel(i2c)
a.get_values()

Connections

Pin 23 ESP -> SDA MPU Pin 19 ESP -> SCL MPU

MPU AD0 -> - Rail MPU GND -> - Rail MPU Vcc -> + Rail

ESP GND -> - Rail ESP VEXT -> +Rail

Things to look at

  • Can we turn off the MPU with VEXT Control? (ESP Pin 21).
  • Connecting to WiFi - Client Mode
  • Connecting to WiFi - Direct Mode
  • BLE?
  • NTP?
  • How to store the data appropriately
  • How to retrieve data over WiFi
  • How to detect battery low