airmeter-io / AirMeter.IO.Firmware

AirMeter.io is an OpenSource platform for building Internet of Things (IoT) connected CO2 monitors.
https://airmeter.io
GNU General Public License v3.0
7 stars 1 forks source link

A few questions before diving in #2

Open Shohreh opened 2 years ago

Shohreh commented 2 years ago

Hello,

I went through the site, and have the following questions:

  1. Are the Sensirion SCD30 and Senseair S8 sensors supported at this point?
  2. I have no need for a temperature sensor: Can it be easily removed from the equation?
  3. Can wifi be disabled to save more power ("Disconnected Mode (Planned)"), or does it use so little that it doesn't really matter?
  4. Could binaries be provided so newbies don't have to struggle with compiling, at least for the TTGO T5?

Thank you.


Edit: I followed the instructions, but it fails compiling:

  1. apt-get update
  2. apt-get ugprade
  3. apt-get install git wget flex bison gperf python3 python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
  4. mkdir -p ~/esp ; cd ~/esp
  5. git clone --recursive https://github.com/espressif/esp-idf.git
  6. cd ~/esp/esp-idf
  7. ./install.sh esp32
  8. . $HOME/esp/esp-idf/export.sh
  9. git clone https://github.com/airmeter-io/AirMeter.IO.Firmware.git
    1. cd AirMeter.IO.Firmware
    2. git submodule init
    3. git submodule update
    4. cp boards/esp32-idf/sdkconfig* .
    5. idf.py build #idf.py: command not found
    6. vi idf.py: Edit shebang line: !#/usr/bin/env python3
    7. idf.py build #Success!

After it compiles successfully, there are several binary files under ./build:

FurballTheGreat commented 2 years ago

Hi, The reason you are having a problem is most likely that you cloned the master branch of IDF. This would be covered as part of the Espressif instructions. If you add "--branch release/v5.0" to line 9 it should work. The documentation hasn't been updated as the switch to v5.0 has only just been done and a release hasn't yet been made.

As for your questions:-

  1. Are the Sensirion SCD30 and Senseair S8 sensors supported at this point? The SCD30 is supported out of the box. The PCB design even contains headers for this Sensor. The S8 hasn't been tested it's possible it would work but I haven't got a sensor to test or spent any time ensuring the code is compatible. The SCD30 is a better choice for a battery-operated device as it is a 3.3v sensor.

I would strongly recommend the Sunrise however as this sensor is much more power efficient.

  1. I have no need for a temperature sensor: Can it be easily removed from the equation? The device will run without a BME280 but you will get some errors on the UART debug output. At present the device will just show 0s.

Fairly soon major work on the data logging & sensor support infrastructure is planned to fit other sensors into the model such as PM2.5 and VOC. Part of this is making web & on device UI gracefully handle different configurations of sensors.

It should also be noted that the SCD30 actually provides temp and humidity values as well. Which I'll likely surface as part of this work.

  1. Can wifi be disabled to save more power ("Disconnected Mode (Planned)"), or does it use so little that it doesn't really matter? At present wifi cannot be disabled but this is coming in due course. If one is performing a reading every minute the average (with master code which fixes some bugs) draw is as follows with an active wifi connection:-

Essentially with the Sunrise 75-80% of power is being used by ESP32, Wifi & EPD. Whereas when using an SCD30 75-80% of the power is being used by the CO2 sensor.

  1. Could binaries be provided so newbies don't have to struggle with compiling, at least for the TTGO T5? They already are see: https://github.com/airmeter-io/AirMeter.IO.Firmware/releases

There is even a (very much alpha) web flash tool at https://flash.airmeter.io

Hope that helps!

FurballTheGreat commented 2 years ago

FYI: I'm not sure why you are getting errors regarding Python being missing. You probably need to solve that if you want to build code yourself.

Sorry misread the end of your original message. As it compiled it SHOULD flash by typing idf.py flash. Going forward this will mainly be useful if you need to check latest code or make code changes yourself.

Note that the alpha web flasher (https://flash.airmeter.io) may look simple but it will remove the need for many custom builds. The most recent changes introduced code to dynamically rebuild the device configuration partition on the flash. This means the web flasher can drop configuration changes.

As the devices onscreen UI is entirely controlled by JSON configuration files. The flasher will be able to customise a lot going forward.

Shohreh commented 2 years ago

Thanks much for the infos.

I'm not super familiar with Github, and missed the Release infos on the right-handside.

Is the Senseair Sunrise the 006-0-0007?

I'll order a T5, hook up the S8 I have on hand, and see how it goes.

FurballTheGreat commented 2 years ago

No problem! There are two versions of the Sunrise 006-0-0007 and 006-0-0008 both are supported. The difference between them is the 0008 is an updated version with a different MCU and is meant to be available in greater volumes. It is likely the 0007 variant will become difficult/impossible to source.

I have both variants running with no issues.

For the T5 make sure its LILYGO® TTGO T5 V2.3.1_2.13 with the DEPG0213BN display variant. Other panels will be supported in due course.

Shohreh commented 2 years ago

I reran the whole thing from scratch using the "--branch release/v5.0" option, and it did compile without editing idf.py:

…
[906/907] Generating binary image from built executableesptool.py v4.3
Creating esp32 image...
Merged 2 ELF sections
Successfully created esp32 image.
Generated /root/esp/esp-idf/AirMeter.IO.Firmware/build/main.bin
[907/907] cd /root/esp/esp-idf/AirMeter.IO.Firmware/build/esp-id...-table.bin /root/esp/esp-idf/AirMeter.IO.Firmware/build/main.binmain.bin binary size 0xe32f0 bytes. Smallest app partition is 0x100000 bytes. 0x1cd10 bytes (11%) free.

Project build complete. To flash, run this command:
/root/.espressif/python_env/idf5.0_py3.9_env/bin/python ../components/esptool_py/esptool/esptool.py -p (PORT) -b 460800 --before default_reset --after hard_reset --chip esp32  write_flash --flash_mode dio --flash_size 4MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0xd000 build/ota_data_initial.bin 0x10000 build/main.bin 0x22e000 build/web.bin 0x2f6000 build/dev.bin
or run 'idf.py -p (PORT) flash'

Thanks again.

FurballTheGreat commented 2 years ago

Excellent thanks for the update :)

Shohreh commented 2 years ago

FWIW, here's some code in ESP-IDF (and Arduino) to work with the Senseair S8:

https://github.com/SFeli/ESP32_S8

Shohreh commented 1 year ago

Hello,

My T5 got in and I have a Senseair8 sensor. I have a couple of questions:

  1. I don't need a temp sensor: Will the code run even if none is hooked to the T5? Should I modify the source code accordingly?

  2. How should I connect the Senseair8's TX+RX pins to the T5 before giving it the first try?

Thank you.

image

FurballTheGreat commented 1 year ago

Hi. The diagram you show is for a NodeMCU ESP8266 board so not really relevant for the T5.

I haven't setup uart with a T5 board myself yet but one user has. If you join the discord bminish has a UART setup going. I did add one feature which allows setting of the GPIOs. You will find a device.json in the "device" folder. Inside this:- "uart": { "enabled": "false", "uartNum": 2, "gpio": { "tx": "17", "rx": "16" } },

There is another issue right now with UART and power saving. The "quick fix" is to disable power saving at expense of battery life. This must be done in code right now but will be made configurable in a later release.

I also intend to fix the UART + power save bug which is related to clock speeds and resulting timing issues.

If you join the discord we can help you there over chat.