This Arduino code will run on the Heltec ESP32 LoRA V3 915h MHz (schematic) aboard the PHAT-3 mainboard. It will save data from PCB-mounted sensors to a micro SD card, as well as transmitting it over LoRA.
Sensor purchase requests:
Pinout for connecting to the Heltec board:
Schematic of the PHAT-3 payload:
- See idf_component.yml for dependencies.
- esp-idf-lib libraries used for aht, bmp180, mpu6050, and scd4x.
- igrr/libnmea used for parsing GPS output.
- nopnop2002/sx126x used for controlling built-in radio. Here is example code. (TODO: This will hopefully replace the high-boilerplate driver we used to use in components/sx126x_driver).
- SCL - schematic pin 11 - GPIO 41
- SDA - schematic pin 12 - GPIO 42
- Make sure your chip is set to "esp32s3" with
idf.py set-target esp32s3
. Confirm it says "esp32s3" in the bottom bar of VSCode.
Temperature and humidity sensor
- Purchase link
- AHT 21 Documentation
- On I2C bus
- 7-bit I2C Address: 0x38
Temperature and pressure sensor
- Purchase link
- BMP180 Documentation
- On I2C bus
- 7-bit I2C address: 0x77
Accelerometer
- Purchase link
- GY-521 Documentation
- On I2C bus
- 7-bit I2C address: 0x68 (because AD0 pin is disconnected)
GPS
- Purchase link
- GT-U7 Documentation
- Specification page
- UART GPS
- ESP -> GT-U7 - schematic pin 1 (U2TXD) - GPIO 7
- GT-U7 -> ESP - schematic pin 2 (U2RXD) - GPIO 6
CO2, temperature, humidity
- Purchase link
- SCD41 Documentation
- On I2C bus
- 7-bit I2C address: 0x62
Camera
- Documentation
- ESP -> UCAM - schematic pin 9 (U1TXD) - GPIO 39
- UCAM -> ESP - schematic pin 10 (U1RXD) - GPIO 40
- Purchase link
- SPI SD Card Reader
- MISO (sub -> main) - schematic pin 29 - GPIO 34
- CLK (clock) - schematic pin 30 - GPIO 33
- MOSI (main -> sub) - schematic pin 31 - GPIO 47
- CS (chip select) - schematic pin 32 - GPIO 48
- Built-in LoRa radio on the ESP board.
- NSS - GPIO 8
- SCK - GPIO 9
- MOSI - GPIO 10
- MISO - GPIO 11
- RST - GPIO 12
- Busy - GPIO 13
- DIO1 - GPIO 14