esp8266 door/window sensor modemcu without arduino

6 years 4 months ago #1734 by EasyIoT

cdj wrote: Another Issue described by Mr. EasyIoT :

Later I've discovered one little detail about ESP8266. While power up GPIO2 must be connected to VCC to start in correct mode. In my test case it happened that door was open and GPIO2 was on VCC. If you start this example with door closed it won't work because ESP8266 wont start int correct mode. There are two solutions:
-connect reed relay and capacitor to VCC and GPIO. That way GPIO2 will be always connected to VCC at startup. Also correct line gpio.mode(4,gpio.INT,gpio.PULLUP) to gpio.mode(4,gpio.INT,gpio.PULLDOWN)
-use different ESP8266 model and connect reed relay to different GPIO pin. Also correct program to work with different GPIO.


I'm trying unsuccessfully to fix this (because if esp restart with door closed it doesn't start correctly) :

Assuming that reed has two cable, 1 and 2:

1) connect reed1 to +3.3v
2) connect gpio2 to +3.3v
3 connect reed2 to gnd

this produce a loop of "1" status....

1) connect reed1 to +3.3v
2) connect gpio2 to reed2

this produce a NULL status... nothing appear when i close or open reed

gpio.mode(4,gpio.INT,gpio.PULLDOWN) line modified

obviously in pull-up mode with gpio2 to reed1 and gnd to reed2 works perfectly, but when reset with closed door it doesn't start correct as you discovered.

Please someone explain better how to fix it ?
Dario


Try to use some other gpio pin and not GPIO0 or GPIO2.

Please Log in or Create an account to join the conversation.

6 years 4 months ago #1739 by cdj

EasyIoT wrote:

cdj wrote: Another Issue described by Mr. EasyIoT :

Later I've discovered one little detail about ESP8266. While power up GPIO2 must be connected to VCC to start in correct mode. In my test case it happened that door was open and GPIO2 was on VCC. If you start this example with door closed it won't work because ESP8266 wont start int correct mode. There are two solutions:
-connect reed relay and capacitor to VCC and GPIO. That way GPIO2 will be always connected to VCC at startup. Also correct line gpio.mode(4,gpio.INT,gpio.PULLUP) to gpio.mode(4,gpio.INT,gpio.PULLDOWN)
-use different ESP8266 model and connect reed relay to different GPIO pin. Also correct program to work with different GPIO.


I'm trying unsuccessfully to fix this (because if esp restart with door closed it doesn't start correctly) :

Assuming that reed has two cable, 1 and 2:

1) connect reed1 to +3.3v
2) connect gpio2 to +3.3v
3 connect reed2 to gnd

this produce a loop of "1" status....

1) connect reed1 to +3.3v
2) connect gpio2 to reed2

this produce a NULL status... nothing appear when i close or open reed

gpio.mode(4,gpio.INT,gpio.PULLDOWN) line modified

obviously in pull-up mode with gpio2 to reed1 and gnd to reed2 works perfectly, but when reset with closed door it doesn't start correct as you discovered.

Please someone explain better how to fix it ?
Dario


Try to use some other gpio pin and not GPIO0 or GPIO2.


In ESP-01 i can invent it :)
When arrive new ESP-12 (just ordered) i try, but no way to do it with ESP-01 ?

Please Log in or Create an account to join the conversation.

6 years 4 months ago #1742 by asm7100
Remember to buy a converter card, the pin space on esp-12 is only 1mm :-)

//
Allan
The following user(s) said Thank You: cdj

Please Log in or Create an account to join the conversation.

6 years 4 months ago - 6 years 4 months ago #1747 by cdj
And finally it works !!!

Ok to connect gpio2 to reed and reed to +3.3v
Ok to modify code :
gpio.mode(4,gpio.INT,gpio.PULLDOWN)

BUT IS ALSO NECESSARY TO MODIFY :

command = 'ControlOff'
if (status == 0) then
command = 'ControlOn'
end

(and not status == 1 !!!)

:lol:

EDIT: I CAN'T BELIEVE, IF I REMOVE MULTIMETER CONNECTION FROM BREADBOARD (to check if reed give correct voltage) IT DOESN'T WORK ????????? WTF !!! Ok i switch project on esp-07...

Please Log in or Create an account to join the conversation.

6 years 4 months ago #1762 by cdj

EasyIoT wrote:

cdj wrote: Another Issue described by Mr. EasyIoT :

Later I've discovered one little detail about ESP8266. While power up GPIO2 must be connected to VCC to start in correct mode. In my test case it happened that door was open and GPIO2 was on VCC. If you start this example with door closed it won't work because ESP8266 wont start int correct mode. There are two solutions:
-connect reed relay and capacitor to VCC and GPIO. That way GPIO2 will be always connected to VCC at startup. Also correct line gpio.mode(4,gpio.INT,gpio.PULLUP) to gpio.mode(4,gpio.INT,gpio.PULLDOWN)
-use different ESP8266 model and connect reed relay to different GPIO pin. Also correct program to work with different GPIO.


I'm trying unsuccessfully to fix this (because if esp restart with door closed it doesn't start correctly) :

Assuming that reed has two cable, 1 and 2:

1) connect reed1 to +3.3v
2) connect gpio2 to +3.3v
3 connect reed2 to gnd

this produce a loop of "1" status....

1) connect reed1 to +3.3v
2) connect gpio2 to reed2

this produce a NULL status... nothing appear when i close or open reed

gpio.mode(4,gpio.INT,gpio.PULLDOWN) line modified

obviously in pull-up mode with gpio2 to reed1 and gnd to reed2 works perfectly, but when reset with closed door it doesn't start correct as you discovered.

Please someone explain better how to fix it ?
Dario


Try to use some other gpio pin and not GPIO0 or GPIO2.


Ok Mr.EasyIoT, i switched project on ESP-07 and tried some other GPIO... (and not gpio15 i suppose because it must be connected to gnd to made esp boot correctly) ...the result is that i've burnt an esp-07 :)
You suggest to use another gpio in pullup or in pulldown mode? reed to gnd or to 3.3v ?
thanks
Dario

Please Log in or Create an account to join the conversation.

6 years 4 months ago #1763 by asm7100
Hmm you can only blowout a modul if you connect it to more than 3v3 or reversert the power, like 3v3 to gnd and gnd to 3v3 not by using a other pin.

Hav you tryet to flash it with new firmware again??

//
Allan

Please Log in or Create an account to join the conversation.

Time to create page: 0.298 seconds