HomeKidd / ESP8266-HomeKit-Air-Quality-Sensor-Elgato-Eve-Room

ESP8266 based  Homekit Indoor Air Quality sensor that acts like Eve Room🌱
70 stars 8 forks source link

2.1.0 not working when 2.0.2 is #16

Open wachl opened 3 years ago

wachl commented 3 years ago

Szia! köszönöm szepen for this awesome project! I can't get 2.1.0 to work, serial output is just gibberish. 2.0.2 is working fine though! However my understanding was, that pressing the button on the pcb would activate the display, but it resets completly (at least at 2.0.2)?

Thank you for your help!

HomeKidd commented 3 years ago

Hi! The latest release Is 2.1.0 which have features like turning off the reset function 30 seconds after boot🤓 Your problem is looks like to hardware issue to me: When you see garbage text on the serial the means you flashed the ESP with wrong flash mode

The resetting needs 10+ seconds pressing to the button so maybe a sticky button? Or the wrong flash mode problem causing this too

wachl commented 3 years ago

Hi! thank you for your quick reply. It was late last nigth and I screwed up the version numbers in my original post (already edited).

Still my issue is that 2.0.2 is working, only the reset pin is completly resetting everything and not turning the screen on. It is not a sticky button since I just short the pins manually.

I tried again to get 2.1.0 working (this time under MacOS) but it still wont work. I used this command to flash (ofc I erased the flash beforehand) esptool.py -p /dev/cu.usbserial-A50285BI --baud 115200 write_flash -fs 4MB -fm dio -ff 40m 0x0 rboot.bin 0x1000 blank_config.bin 0x2000 main.bin

And this is the serial readout after I joined the wifi and added to homekit: https://pastebin.com/6nBW4jR6

The screen stays off the entire time (working with 2.0.2). I think it might be an I2C issue?

The wrong flash mode sound interesting, however there is not much to do wrong rigth? I power the esp with the reset button pressed, release it, flash it and thats it?

Any help is appreciated!

HomeKidd commented 3 years ago

What happens when you wait after the wi-fi connection? The Screen task is created 2 sencond after the successful wi-fi connection and HomeKit running

Until this try to dont touch the button

wachl commented 3 years ago

Unfortunatley simply nothing happens, no screen output and no serial output. It seems as if the ESP crashed.

HomeKidd commented 3 years ago

It seems as if the ESP crashed.

can you send me an image of the connections how was the esp wired?

wachl commented 3 years ago

I am using your pcb :) (mini usb version)

Lovis Wach Am 2. Mai 2021, 21:15 +0200 schrieb HomeKid @.***>:

It seems as if the ESP crashed. can you send me an image of the connections how was the esp wired? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

wachl commented 3 years ago

Hi, I now tried using a different serial converter but I am still getting the same result. After flashing I restart the ESP (power off / power on -> no button press) and enter my wifi credentials through the webpage. The connection is established (I can see it connected to my wifi) but display stays off. Any other ideas?

I also tried this on three other air monitors I built, all behave the same way.

Thanks!

HomeKidd commented 3 years ago

On first setup the display should be on and it turns off after 5 minutes, so this could be a faulty display.

Did you updated the Fw to 2.1.0?

Did you tried to triple press the button for changing the display type?

Can you send a picture of the OLED screen?

wachl commented 3 years ago

Yes, I am using the Fw 2.1.0 I am using this SSD1306 screen atm which has the VCC and GND pin switched (for testing I am using cables and connect it properly ofc). Since I also think it might have to do something with the display, I have this SH1106 one (with correct pin layout) coming on monday.

The display is not defective however since it is working with fw 2.0.2. I would stay on that version but it seems unstable for me.

Thanks!

wachl commented 3 years ago

New display, same problem :( I also can not change the display mode, as soon as i press the button, the ESP restarts.Edit: Display Mode is changing correct, however display does not turn on. Any idea what I could try next? Thanks!

If I compare the behaviour of fw 2.1.0 vs 2.0.2 I think on the latest version the bus communication is broken.

Only bug on 2.0.2 i noticed is the resetting of the homekit configuration even on a short button press :(. On 2.0.2 display (only SSD1306) is working and sensor data is read.

Attached is a screenshot of the apple home pairing. This is my current serial ouptut from a boot with the paired device:


17:03:32.051 -> pm_task_hdl : 3fff0c00, prio:1, stack:176
17:03:32.051 -> frc2_timer_task_hdl:0x3fff5790, prio:12, stack:200
17:03:32.085 -> 
17:03:32.085 -> ESP-Open-SDK ver: 0.0.1 compiled @ Nov 20 2020 12:10:06
17:03:32.085 -> phy ver: 273, pp ver: 8.3
17:03:32.085 -> 
17:03:32.085 -> HomeKid > Loading saved states
17:03:32.085 -> 
17:03:32.085 -> HomeKid > Hardware Revision v2.0.0 found
17:03:32.085 -> 
17:03:32.085 -> 
17:03:32.085 ->   HomeKid  
17:03:32.085 -> 
17:03:32.085 -> Developed by @Homekidd 
17:03:32.085 -> 
17:03:32.085 ->   AirQuality Sensor's Firmware Version: 2.1.0, for Harware Revision 2.0.0, Display is SH1106.
17:03:32.085 -> 
17:03:32.085 -> >>> wifi_config: Initializing WiFi config
17:03:32.085 -> >>> wifi_config: Connecting to FRITZ!Box 7530 TU
17:03:32.153 -> mode : sta(e8:db:84:9b:58:57)
17:03:32.153 -> add if0
17:03:32.290 -> scandone
17:03:34.526 -> reconnect
17:03:34.631 -> scandone
17:03:35.930 -> add 0
17:03:35.930 -> aid 5
17:03:35.930 -> cnt 
17:03:35.965 -> 
17:03:35.965 -> connected with FRITZ!Box 7530 TU, channel 1
17:03:35.965 -> dhcp client start...
17:03:37.062 -> ip:192.168.178.57,mask:255.255.255.0,gw:192.168.178.1
17:03:42.161 -> >>> wifi_config: Connected to WiFi network
17:03:42.231 -> Connected to WiFi
17:03:42.231 -> HomeKid > Starting HomeKit Server
17:03:42.231 -> >>> HomeKit: Starting server
17:03:42.231 -> >>> HomeKit: Using existing accessory ID: 67:72:4F:AC:75:60
17:03:42.231 -> >>> HomeKit: Found admin pairing with 5BB68219-E557-42CB-87BD-495D99FF4531, disabling pair setup
17:03:42.231 -> >>> HomeKit: Configuring mDNS
17:03:42.231 -> mDNS announcement: Name=AirMonitor-9B585 md= AirQuality Sensorpv=1.0id=67:72:4F:AC:75:60c#=8256s#=1ff=0sf=0ci=10sh=nqGetw== Port=5556 TTL=4500
17:03:42.607 -> >>> HomeKit: Got new client connection: 4 from 192.168.178.37
17:03:42.607 -> >>> HomeKit: [Client 4] Pair Verify Step 1/2
17:03:43.121 -> >>> HomeKit: [Client 4] Pair Verify Step 2/2
17:03:43.121 -> >>> HomeKit: [Client 4] Found pairing with 5BB68219-E557-42CB-87BD-495D99FF4531
17:03:43.294 -> >>> HomeKit: [Client 4] Verification successful, secure session established
17:03:43.294 -> >>> HomeKit: [Client 4] Closing client connection
17:04:40.651 -> >>> HomeKit: Got new client connection: 4 from 192.168.178.37
17:04:40.651 -> >>> HomeKit: [Client 4] Pair Verify Step 1/2
17:04:41.028 -> >>> HomeKit: [Client 4] Pair Verify Step 2/2
17:04:41.028 -> >>> HomeKit: [Client 4] Found pairing with 5BB68219-E557-42CB-87BD-495D99FF4531
17:04:41.165 -> >>> HomeKit: [Client 4] Verification successful, secure session established
17:04:41.233 -> >>> HomeKit: [Client 4] Get Accessories

image

Output of the same hardware on fw 2.0.2:

17:12:06.372 -> pm_task_hdl : 3fff0aa0, prio:1, stack:176
17:12:06.372 -> frc2_timer_task_hdl:0x3fff5628, prio:12, stack:200
17:12:06.372 -> 
17:12:06.372 -> ESP-Open-SDK ver: 0.0.1 compiled @ Apr  5 2020 15:57:51
17:12:06.372 -> phy ver: 273, pp ver: 8.3
17:12:06.372 -> 
17:12:06.372 -> 
17:12:06.372 -> 
17:12:06.372 ->   HomeKid  
17:12:06.372 -> 
17:12:06.372 -> Developed by @Homekidd 
17:12:06.406 -> 
17:12:06.406 ->   AirQuality Sensor's Firmware Version: 2.0.2
17:12:06.406 -> 
17:12:06.406 -> HomeKid > Loading saved states
17:12:06.406 -> 
17:12:06.406 -> 
17:12:06.542 -> >>> wifi_config: Initializing WiFi config
17:12:06.612 -> !!! wifi_config: No configuration found
17:12:06.612 -> >>> wifi_config: Starting AP mode
17:12:07.980 -> >>> wifi_config: Starting DHCP server
17:12:07.980 -> mode : sta(e8:db:84:9b:58:57) + softAP(ea:db:84:9b:58:57)
17:12:07.980 -> add if0
17:12:07.980 -> add if1
17:12:07.980 -> bcn 100
17:12:07.980 -> >>> wifi_config: Starting WiFi scan
17:12:07.980 -> >>> wifi_config: Starting DNS server
17:12:07.980 -> >>> wifi_config: Starting HTTP server
17:12:07.980 -> !!! WARNING !!! Sensor is in Heating up phase which takes about 5 minutes from startup.
17:12:08.014 -> SHT3x Sensor: 23.94 °C, 38.00 %
17:12:08.495 -> Resumed Display Task from Sensor Reading
17:12:09.010 ->  0 star 
17:12:10.104 -> scandone
17:12:17.977 -> !!! WARNING !!! Sensor is in Heating up phase which takes about 5 minutes from startup.
17:12:20.071 -> scandone
17:12:23.021 -> SHT3x Sensor: 24.00 °C, 38.00 %
17:12:23.500 -> Resumed Display Task from Sensor Reading
17:12:23.534 ->  0 star 
17:12:27.995 -> !!! WARNING !!! Sensor is in Heating up phase which takes about 5 minutes from startup.
wachl commented 3 years ago

Any chance you could send me the source code for fw 2.1.0 and 2.0.2 for me to check?

HomeKidd commented 3 years ago

Any chance you could send me the source code for fw 2.1.0 and 2.0.2 for me to check?

Nope, its still secret 😄

Only bug on 2.0.2 i noticed is the resetting of the homekit configuration even on a short button press :(. On 2.0.2 display (only SSD1306) is working and sensor data is read.

I'm still guessing that this button is broken. All my PCBs are running 2.1.0 and never have any issue like that. The reset code only runs when you press the button for at least 10 seconds. Also i have a lot of safety feature:

void button_callback(button_event_t event, void* context) {
    switch (event) {
        case button_event_single_press:
            if(!first_init){
                lcd_power = !lcd_power;
                printf("HomeKid > Display %s\n", lcd_power ? "ON" : "OFF" );
                vTaskResume(ssd1306_task_handle);
                sdk_os_timer_arm(&display_timer, 300000, 0); // Auto OFF Timer --> 300 sec = 5 min
                save_states_callback(2500);                 
            }
            break;
        case button_event_double_press:
            break;
        case button_event_tripple_press:
            _is_ssd1306 = !_is_ssd1306;
            save_states();
            printf("HomeKid > Display Type changed to %s. Please Reboot!\n", _is_ssd1306 ? "SSD1306" : "SH1106");
            sdk_system_restart();
            break;
        case button_event_long_press:
            if(_resettable) reset_configuration();
            else printf("!!! HomeKid > Reset Failed!\n Reset can be done wihtin 30 seconds from reboot. Please reboot the device and try again!\n");
            break;
        default:
            printf("Unknown button event: %d\n", event);
    }
}

I've made some minor changes in v2.1.1 but i'm 100% sure that the cause of this problem is a hardware (button) related because the code never lets you fully reset on single press 😄