Closed bgoodwine closed 1 year ago
Pi initial requests:
0:
= request for general checkin1:[IMU data]
= IMU data that the ESP32 should either confirm or alert mismatching data 2:message
= transmit message via SDR 3:sensor_id
= restart sensor corresponding to sensor_id
4:sensor_id
= shutdown sensor corresponding to sensor_id
0:2
= start relay of available SDR message (sent after receiving 0:2
from ESP32)0:3
= start relay of solar panel efficiency report (sent after receiving 0:3
from ESP32)ESP32 response to general checkin:
0:0
= not tumbling0:1
= tumbling alert0:2:[num_bytes]
= message from SDR waiting to be relayed 0:3:[num_bytes]
= solar panel efficiency report available for relay ESP32 response to IMU data:
1:0
= IMU data is good1:1
= IMU data does not match1:report:[solar panel report]
= solar panel efficiency report 2:num_bytes
= number of bytes in message received from the SDR, which the ESP32 will next relay to the Pi2:[message]
= message relayed to Pi, will only be num_bytes
longESP32 data relay:
2:[message]
- SDR message to relay, repeat until num_bytes
has been sent (-2 for each sent message)3:[report]
- solar panel efficiency report to relay, repeat until num_bytes
has been sent (-2 for each sent message)
Establishing I2C connection
Arduino Wire library Arduino twi library that Wire uses I2C Python SMBUS Doc
LED blinking tutorial
Connect GPIO2 on Pi 4 to 22 on ESP32 (SDA) Connect GPIO3 on Pi 4 to 21 on ESP32 (SDL)
I2C tools:
ls /dev/*i2c*
to show which I2C port is being used on Pi 4 (current:/dev/i2c-1
)i2cdetect -y 1
to list all devices connected on I2C port/bus 1 (i.e. SDA = GPIO2, SCL = GPIO3)