Ribbit-Network / ribbit-network-frog-hardware

The sensor for the world's largest crowdsourced network of open-source, low-cost, GHG Gas Detection Sensors.
https://www.ribbitnetwork.org/
MIT License
93 stars 26 forks source link

Frog V4: Esp32s3 with SCD30 and Golioth Support #184

Closed keenanjohnson closed 1 year ago

keenanjohnson commented 1 year ago

I have created an esp-idf project that integrates the SCD30 library and the latest golioth firmware from https://github.com/golioth/golioth-firmware-sdk

I have validated that the code does talk to the SCD30, connects to golioth, etc

This changeset also introduces a github workflow to build the esp project and a vscode workspace file that allows the esp-idf extension to be easily used with this project.

keenanjohnson commented 1 year ago

I have validated that flashing the Adafruit Feather ESP32S3 board with this code does indeed function.

I have flashed using the esp-idf vscode extension.

ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0x15 (USB_UART_CHIP_RESET),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x420a4b6a
0x420a4b6a: esp_pm_impl_waiti at /Users/keenan/esp/esp-idf/components/esp_pm/pm_impl.c:839

SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x1650
load:0x403c9700,len:0xb9c
load:0x403cc700,len:0x2f98
entry 0x403c994c
I (24) boot: ESP-IDF v4.4.2 2nd stage bootloader
I (24) boot: compile time 12:56:53
I (25) boot: chip revision: 0
I (26) boot.esp32s3: Boot SPI Speed : 80MHz
I (31) boot.esp32s3: SPI Mode       : DIO
I (36) boot.esp32s3: SPI Flash Size : 4MB
I (40) boot: Enabling RNG early entropy source...
I (46) boot: Partition Table:
I (49) boot: ## Label            Usage          Type ST Offset   Length
I (57) boot:  0 nvs              WiFi data        01 02 00009000 00004000
I (64) boot:  1 otadata          OTA data         01 00 0000d000 00002000
I (72) boot:  2 phy_init         RF data          01 01 0000f000 00001000
I (79) boot:  3 factory          factory app      00 00 00010000 00100000
I (87) boot:  4 ota_0            OTA app          00 10 00110000 00100000
I (94) boot:  5 ota_1            OTA app          00 11 00210000 00100000
I (101) boot: End of partition table
I (106) boot: Defaulting to factory image
I (110) esp_image: segment 0: paddr=00010020 vaddr=3c0b0020 size=22f1ch (143132) map
I (145) esp_image: segment 1: paddr=00032f44 vaddr=3fc97180 size=0426ch ( 17004) load
I (149) esp_image: segment 2: paddr=000371b8 vaddr=40374000 size=08e60h ( 36448) load
I (158) esp_image: segment 3: paddr=00040020 vaddr=42000020 size=a8d10h (691472) map
I (283) esp_image: segment 4: paddr=000e8d38 vaddr=4037ce60 size=0a31ch ( 41756) load
I (292) esp_image: segment 5: paddr=000f305c vaddr=50000000 size=00010h (    16) load
I (300) boot: Loaded app from partition at offset 0x10000
I (301) boot: Disabling RNG early entropy source...
I (302) cpu_start: Pro cpu up.
I (305) cpu_start: Starting app cpu, entry point is 0x40375370
0x40375370: call_start_cpu1 at /Users/keenan/esp/esp-idf/components/esp_system/port/cpu_start.c:160

I (0) cpu_start: App cpu up.
I (320) cpu_start: Pro cpu start user code
I (320) cpu_start: cpu freq: 160000000
I (321) cpu_start: Application information:
I (321) cpu_start: Project name:     golioth-esp-idf-external-app
I (321) cpu_start: App version:      hw_v2-93-g1f33572-dirty
I (321) cpu_start: Compile time:     Nov 27 2022 12:56:47
I (322) cpu_start: ELF file SHA256:  aeb0a1ec7b541b07...
I (322) cpu_start: ESP-IDF:          v4.4.2
I (322) heap_init: Initializing. RAM available for dynamic allocation:
I (322) heap_init: At 3FCA2688 len 0003D978 (246 KiB): D/IRAM
I (323) heap_init: At 3FCE0000 len 0000EE34 (59 KiB): STACK/DRAM
I (323) heap_init: At 3FCF0000 len 00008000 (32 KiB): DRAM
I (323) heap_init: At 600FE000 len 00002000 (8 KiB): RTCRAM
I (324) spi_flash: detected chip: generic
I (325) spi_flash: flash io: dio
I (325) sleep: Configure to isolate all GPIO pins in sleep state
I (326) sleep: Enable automatic switching of GPIO sleep configuration
I (327) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.

Type 'help' to get the list of commands.
Use UP/DOWN arrows to navigate through command history.
Press TAB when typing command name to auto-complete.
I (649) pp: pp rom version: e7ae62f
I (659) net80211: net80211 rom version: e7ae62f
                                                                                                                                                                                                                             I (669) wifi:wifi driver task: 3fce75d0, prio:23, stack:6656, core=0
I (669) system_api: Base MAC address is not set
I (669) system_api: read default base MAC address from EFUSE
I (669) wifi:wifi firmware version: eeaa27d
I (669) wifi:wifi certification version: v7.0
I (669) wifi:config NVS flash: enabled
I (669) wifi:config nano formating: disabled
I (679) wifi:Init data frame dynamic rx buffer num: 32
esp32> I (679) wifi:Init management frame dynamic rx buffer num: 32
I (679) wifi:Init management short buffer num: 32
I (679) wifi:Init dynamic tx buffer num: 32
I (679) wifi:Init static tx FG buffer num: 2
I (679) wifi:Init static rx buffer size: 1600
I (679) wifi:Init static rx buffer num: 10
I (679) wifi:Init dynamic rx buffer num: 32
I (679) wifi_init: rx ba win: 6
I (689) wifi_init: tcpip mbox: 32
I (689) wifi_init: udp mbox: 6
I (689) wifi_init: tcp mbox: 6
I (689) wifi_init: tcp tx win: 5744
I (689) wifi_init: tcp rx win: 5744
I (689) wifi_init: tcp mss: 1440
I (689) wifi_init: WiFi IRAM OP enabled
I (689) wifi_init: WiFi RX IRAM OP enabled
I (689) phy_init: phy_version 503,13653eb,Jun  1 2022,17:47:08
I (729) wifi:mode : sta (f4:12:fa:59:ab:58)
I (729) wifi:enable tsf
I (739) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (1699) wifi:state: init -> auth (b0)
I (1719) wifi:state: auth -> assoc (0)
I (1719) wifi:state: assoc -> run (10)
I (1739) wifi:connected with Bill Wi the Science Fi, aid = 1, channel 1, BW20, bssid = 28:bd:89:de:66:df
I (1739) wifi:security: WPA2-PSK, phy: bgn, rssi: -39
I (1749) wifi:pm start, type: 1

I (1749) wifi:set rx beacon pti, rx_bcn_pti: 0, bcn_timeout: 0, mt_pti: 25000, mt_time: 10000
W (1749) wifi:<ba-add>idx:0 (ifx:0, 28:bd:89:de:66:df), tid:6, ssn:2, winSize:64
I (1829) wifi:BcnInt:102400, DTIM:2
W (1959) wifi:<ba-add>idx:1 (ifx:0, 28:bd:89:de:66:df), tid:0, ssn:0, winSize:64
I (2649) esp_netif_handlers: sta ip: 192.168.86.92, mask: 255.255.255.0, gw: 192.168.86.1
I (2649) example_wifi: WiFi Connected. Got IP:192.168.86.92
I (2649) example_wifi: Connected to AP SSID: Bill Wi the Science Fi
I (2649) golioth_mbox: Mbox created, bufsize: 1144, num_items: 10, item_size: 104
I (2659) golioth_example: SCD30 Firmware Version: 3.2
I (2659) golioth_example: Starting continuous measurement
I (2699) golioth_coap_client: Start CoAP session with host: coaps://coap.golioth.io
I (2709) libcoap: Setting PSK key

I (2709) golioth_coap_client: Entering CoAP I/O loop
I (2959) golioth_example: Golioth client connected
I (2959) golioth_coap_client: Golioth CoAP client connected
I (4669) golioth_example: CO2: 838 ppm
I (4669) golioth_example: Temperature: 24.89 °C
I (4669) golioth_example: Humidity: 35.14 %
I (6679) golioth_example: CO2: 942 ppm
I (6679) golioth_example: Temperature: 24.82 °C
I (6679) golioth_example: Humidity: 35.24 %
I (8689) golioth_example: CO2: 967 ppm
I (8689) golioth_example: Temperature: 24.80 °C
I (10699) golioth_example: CO2: 974 ppm24 %