Hello, i have a NodeMcu V3 Lolin i will attach the code (the code is based on a secret Knock by Steve Hoefer, modified by Patduino and now it can work with 3 different secret knocks and also theres other code included for IFTTT requests)
Im only facing one problem. When i knock only once it resets and i get this error:
everything else from the code works (the 2 knocks turns on my lights and the 3 knocks turns off my lights) and it never crashes. Any ideas? Please help i tried a lot of things that i read about capacitors etc.
wvmarle:
Install the "ESP exception decoder" in your Arduino IDE.
Reset cause 2: reset pin.
Possible power supply issue.
Which of the three sketches you actually use? Please post it inline.
thanks for your reply, i use the one called newKnock2.0 but i get the error with original knock too. As a power supply im using the usb cable and the mb102 breadboard power supply. I added a 100uf capacitor in the vin and ground. I will try powering up the nodemcu with a battery. When i get home i'll post the code inline. Thanks
I tried with 2 AAA batteries in parallel + Usb and i tried a 70 Amps 5 volt power supply. Now it seems like im getting exception (0) and it restarts. I downloaded the esp decoder but i cant make it appear in my arduino IDE Tools section. Do you think that its compatible with the newest IDE?
Exception 0: Illegal instruction
Decoding 13 results
0x40106889: __divsi3 at d:\ivan\projects\arduinoesp\toolchain\dl\gcc-xtensa\build-2\xtensa-lx106-elf\libgcc/../../../libgcc/config/xtensa/lib1funcs.S line 638
0x4022f9e8: pm_wakeup_init at ?? line ?
0x40228b39: test_tout at ?? line ?
0x40228b9d: test_tout at ?? line ?
0x40201e84: validateKnock() at C:\Users\FedX\Dropbox\esp8266\New_KNOCK2.0/New_KNOCK2.0.ino line 371 (discriminator 2)
0x40219e3c: system_adc_read at ?? line ?
0x40201126: __analogRead at C:\Users\FedX\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_analog.c line 33
0x40202216: listenToSecretKnock() at C:\Users\FedX\Dropbox\esp8266\New_KNOCK2.0/New_KNOCK2.0.ino line 173
0x40219e3c: system_adc_read at ?? line ?
0x40201126: __analogRead at C:\Users\FedX\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring_analog.c line 33
0x40202345: loop at C:\Users\FedX\Dropbox\esp8266\New_KNOCK2.0/New_KNOCK2.0.ino line 113
0x40203668: loop_wrapper at C:\Users\FedX\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56
0x40100718: cont_norm at C:\Users\FedX\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/cont.S line 109
I can see that the first error shows the path of someone called ivan on line 613 Maybe im missing a library or something?
Ivan is the first name of one of the lead developers of the ESP8266 core for Arduino, igrr. I wonder if that path is coming from a pre-compiled file in the ESP8266 toolchain?
pert:
Ivan is the first name of one of the lead developers of the ESP8266 core for Arduino, igrr. I wonder if that path is coming from a pre-compiled file in the ESP8266 toolchain?
wvmarle:
If you're missing a library it wouldn't have compiled, so it's from something you installed.
From the name I'm guessing it's some kind of division, and it's an illegal instruction. Are you by any chance trying to divide something by zero?
i tried to post the code inline but it says it exceeds the maximum characters allowed. Idk if the code is trying to devide something by zero. the esp decoder shows an error at Validatedknock() in line 375. i can see this
// normalize knocks
for (i = 0; i < maximumKnocks; i++) { // Normalize the times
knockReadings[i] = map(knockReadings[i], 0, maxKnockInterval, 0, 100);
}
I just removed that part of the code and it stops crashing but the multiple knocks stops working too perhaps theres something wrong in there?
I'll look over the code, but it takes 2 knocks to define a time interval. Maybe there is a problem with the logic in that case. It might be as simple as checking to see that you've got at least 2 knocks before checking the pattern.
Hello! The reason why its important that with one knock it doesn't restart is because the piezo sensor will be attached to my bed stand or to my bed's headboard. If by accident i hit once that surface, i lay down a glass or water or anything else it will automaitcally restart i really hope there's fix for this and that you could help me out. Thanks a lot for your help!
So I looked at the code and things look ok to me. But just to be safe I counted the number of knocks in the validate function and return a "no knock pattern detected" indication if there is only a single knock.
I only tried it with an Uno -- I don't have an ESP, so I can't completely reconstruct your setup. Give this a try. Hopefully, it'll work!
So I looked at the code and things look ok to me. But just to be safe I counted the number of knocks in the validate function and return a "no knock pattern detected" indication if there is only a single knock.
I only tried it with an Uno -- I don't have an ESP, so I can't completely reconstruct your setup. Give this a try. Hopefully, it'll work!