Lyr3x / Roode

A reliable smart home people counter based on VL53L1X and ESPHome
The Unlicense
150 stars 44 forks source link

Freezing on LOGO #8

Closed Kabron287 closed 5 years ago

Kabron287 commented 5 years ago

Hello, I'm trying to reproduce the project on WEMOS D1 mini Lite with VE53L0/1X and with oled disabled. Compiled OK, but after start i see on serial only Logo and nothing more. What is the reason?


| \/ | / | | |\/| | | | \ \ / \ ` \/ |/ | `/ | | | | | || || | / | | \ \ | | \ \ || ||_, |____/ \|| ||/\/|_| |/ |/ 2.3.1

With debug enabled I got: 72 MCO:BGN:INIT NODE,CP=RNNNE---,REL=255,VER=2.3.1 87 TSM:INIT 88 TSF:WUR:MS=0 95 !TSM:INIT:TSP FAIL 97 TSM:FAIL:CNT=1 99 TSM:FAIL:DIS 100 TSF:TDI:TSL 10103 TSM:FAIL:RE-INIT 10105 TSM:INIT 10111 !TSM:INIT:TSP FAIL 10113 TSM:FAIL:CNT=2 10115 TSM:FAIL:DIS 10117 TSF:TDI:TSL 20119 TSM:FAIL:RE-INIT 20121 TSM:INIT 20127 !TSM:INIT:TSP FAIL 20129 TSM:FAIL:CNT=3 20131 TSM:FAIL:DIS 20133 TSF:TDI:TSL 30135 TSM:FAIL:RE-INIT 30137 TSM:INIT 30143 !TSM:INIT:TSP FAIL 30145 TSM:FAIL:CNT=4 30147 TSM:FAIL:DIS 30149 TSF:TDI:TSL

Lyr3x commented 5 years ago

Your Radio module cant connect to the gateway. Is your MySensors gateway up and working? Also remove the static #define MY_NODE_ID 10 // Set a static Node ID if needed To prevent a NODE_ID override (will remove this soon). I never used a wemos d1 mini with MySensors did you checked that the Configuration.h and wiring is correct?

Kabron287 commented 5 years ago

Thanks for answer. I have no radio module. After defining MY_CORE_ONLY, I go a little bit farther. Now I got cyclically:

RooDe Presence Detection System

ets Jan 8 2013,rst cause:4, boot mode:(3,6) wdt reset load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d vbb28d4a3 ~ld

Lyr3x commented 5 years ago

Is the MySensors init working now? It seems like v0.9.6 does use some libraries which are not supported by the 32-Bit ESP. I ran into the same issue yesterday. I am working at a huge refactor of the whole architecture to support the ESP and MQTT. Checking https://www.mysensors.org/build/connect_radio it seems you need to connect a extra radio for the wemos running as mysensors node. Thats why i am building MQTT support for the ESP's. If you have an NRF24L01+ and an Arduino ready everything will work oob. In a few days you may check the v0.9.6-rework branch to use the wemos d1 mini with MQTT instead of MySensors.

Regarding your resets: The node wants to use some functions which are not available because you just include MY_CORE_ONLY and due to some lack of error handling (sorry for that..) the esp just going into a crash loop.

Kabron287 commented 5 years ago

I definitelly do not need any radio except the ESP8266 internal, as I use Blynk. What should I setup to exclude as much as possible from MySensors support to leave clean People Counter? Now I tested with 0.9.5

Lyr3x commented 5 years ago

Ah alright. For now there is no Blynk support available. For now there is no easy code change to support blynk available. You need to wait until i finished the refactor and then you can add a new blynk transmitter. I will notice you when i finished the rework branch

Kabron287 commented 5 years ago

I start to stady your code because of movement direction recognition. It seems to be rather complicated. In my project I use STM32duino_Proximity_Gesture library, which seem to work stable. Something like:

include

include

Gesture_DIRSWIPE_1_Data_t gestureDirSwipeData;

//setup tof_gestures_initDIRSWIPE_1(1000, 0, 1000, false, &gestureDirSwipeData);

//loop gesture_code = tof_gestures_detectDIRSWIPE_1(distance[0], distance[1], &gestureDirSwipeData);

    // Check the result of the gesture detection algorithm.
    switch (gesture_code)
    {
    case GESTURES_SWIPE_LEFT_RIGHT:
        cnt++;
        right = 1;
        break;
    case GESTURES_SWIPE_RIGHT_LEFT:
        cnt--;
        left = 1;
        break;
    default:
        break;
    }

Two lib files must be changed to suit real library src.zip

Kabron287 commented 5 years ago

Also they have a very interesting solution with the single VL53L1X sensor: https://community.st.com/s/question/0D50X0000A7VWoMSQW/is-vl53l1x-people-counting-source-code-available

A subject to think

Lyr3x commented 5 years ago

@Kabron287 it's a little more complicated then this. I checked their code a few month ago and they do nearly the same but with a few drawbacks where some edge case scenarios will fail. Their code is just a demo code. The core logic is identical but tuned my code a lot in the last two years to make it a lot more reliable for edge cases.

I'll implement the VL53L1X soon to make it possible to use one sensor and the SPAD array.

If you like to test roode you can now checkout the v0.9.6-rework branch and setup mqtt, for example with mosquitto.

Lyr3x commented 5 years ago

If you like you can start to implement a new Transmitter type (Blynk) based on v0.9.6-rework. MySensors for Arduino boards and MQTT for ESP boards is working (not ready yet). But i recommend to just use MQTT.

If you setted up your VL53L1X and want to Integrate it I would accept a PR

Lyr3x commented 5 years ago

Closing here now. Feel free to contribute with Blynk support. I'll add Vl53L1X support in the next few days. I'll integrate my test code in the project soon