cyberman54 / ESP32-Paxcounter

Wifi & BLE driven passenger flow metering with cheap ESP32 boards
https://cyberman54.github.io/ESP32-Paxcounter/
Other
1.69k stars 397 forks source link

SDS011 sensor + TTGOV1.6 LoRa issue #866

Closed FabTangi closed 2 years ago

FabTangi commented 2 years ago

Hello, Using this code with an SDS011 sensor and a TTGOV1.6, I have an issue. Lora handshake and SDS011 data are OK. 1 frame is sent, and the the sensor continue, but no more frames are sent. There is also an error just after sending the Lora frame :

_22:22:47.075 > [ 43665][I][sds011read.cpp:37] sds011_loop(): SDS011: pm25: 4.10, pm10: 14.20 22:23:14.917 > [ 71507][I][lorawan.cpp:224] lora_send(): 6 byte(s) sent to LORA 22:23:19.958 > FAILURE 22:23:19.958 > .pio/libdeps/usb/MCCI LoRaWAN LMIC library/src/lmic/radio.c:1065 22:23:47.076 > [103665][I][sds011read.cpp:37] sds011_loop(): SDS011: pm25: 3.90, pm10: 13.10 22:24:47.076 > [163665][I][sds011read.cpp:37] sds011loop(): SDS011: pm25: 4.00, pm10: 13.00

Any idea ?

cyberman54 commented 2 years ago

This is Lora related problem, not an SDS011 specific issue. Make sure that the SPI interface to the Lora chip is working. The error in line 1065 of radio.c points to non working Lora chip, because the radio driver reports that it cannot activate RX mode.

FabTangi commented 2 years ago

Well, it is linked to SDS011, because if SDS011 is not powered, the paxcounter on TTGO V1.6 is working properly, without any Lora issue...

cyberman54 commented 2 years ago

To which pins did you connect the SDS011?

FabTangi commented 2 years ago

Well I used pin 19 and 23 and added in hal file ttgov21new.h :

// SDS011 dust sensor settings

define HAS_SDS011 1 // use SDS011

// used pins on the ESP-side:

define SDS_TX 19 // connect to RX on the SDS011

define SDS_RX 23 // connect to TX on the SDS011

cyberman54 commented 2 years ago

Pins 19+23 are used on TTGO v1.6 for SPI interface of Lora chip. Thus, you cannot use these pins for serial interface of SDS011.

Check your wiring.

cyberman54 commented 2 years ago

Use IO12 and IO35.