Only two pins work with motion detectors??

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Only two pins work with motion detectors??

#1 Post by supplex » 10 Nov 2017, 09:08

Hi!

Just started my descent into the world of little devices that need a completely different way of interaction than the full fledged operating systems im used to :)

Yesterday i started a little project to open up my old alarm system and moving all the motion detectors one by one over to my v2 2866 ESP-12E running on ESP Easy mega 2.0.0. but noticed that i only got response on two motion detectors and 3 other ones do not seem to trigger anything at all. Could be defective sensors but i connected all of them to the working gpio ports and all of them respond nicely. I've also tried older firmware but it doesnt make a difference in which port responds.

So i'm a bit stuck...my thought was that i had around 6 to 7 usable pins but every gpio pin except GPIO0 and GPIO2 do not trigger any status at movement.
I'm sure this is my lack of knowledge so can someone point out what i did wrong or forgot to read? ;-)

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#2 Post by supplex » 10 Nov 2017, 10:45

Update: after testing with a switch and leds it seems all the ports are working. gpio0 and gpio2 do seem to have a default high status, the others do not. But after manually setting the status to high on for example, gpio15 it does change the state of the motion detector but does not register motion or change its state.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Only two pins work with motion detectors??

#3 Post by grovkillen » 10 Nov 2017, 11:10

ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#4 Post by supplex » 10 Nov 2017, 12:17

Thnx, read it and still troubleshooting the possible issues.
Have scoured the internet trying to find a reason why gpio0 and 2 do work with triggering a state when motion is detected but why this does not work on the other ports. Have tried to change bootmodes for the pins, checking cables, see if ground is properly connected.

It does register the first state when i plug it in on all the ports, but triggering motions afterwards does not happen except for gpio0 and 2.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Only two pins work with motion detectors??

#5 Post by grovkillen » 10 Nov 2017, 12:42

What PIR sensor are you using?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#6 Post by vader » 10 Nov 2017, 12:57

Normally GPIO-0 and GPIO-2 are no problem. Disable any Pull-Ups in the settings (e.g. switch input for the HC-SR501) and all is fine! You can define the used GPIO port as Input under Hardware. That should work (I have it in use)....

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Only two pins work with motion detectors??

#7 Post by Shardan » 10 Nov 2017, 13:57

GPIO0 and GPIO2 are pulled up (hopefully) by external resistors, otherwise the ESP8266 starts with SD-Mode or in flash mode or something alike.

GPIO's 0,2 and 15 need predefined levels for correct booting so be aware none of your sensors triggers when ESP is booting.

Some more info would be helpfull:
Can you provide a schematic please? Or a photo?
A screenshot of the switch task configuration (Click "Edit" in the device list) is often helpful too.

Did you use pullup resistors? Just a switch connected to a GPIO might be not enough.
This might be the reason why GPIO0 and GPIO2 work but others do not.

Regards
Shardan
Regards
Shardan

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#8 Post by supplex » 10 Nov 2017, 14:09

Bit difficult to say which pirs they are. The pirs are from an old (analog) alarm system, all pirs are practically part of the wall so cant see the backside of the pir. I left the 12v connected to the alarm box to power all pirs and used the ground and v3.3 volt wire on the esp.

I tried disabling all pull up sensors and setting all gpio ports to input. Disconnected all pirs and testing only one at the moment.
Following shows up in the log when connected to gpio0 or gpio2

140658 : EVENT: Overloop#Motion=1.00
143761 : SW : State 0
143761 : EVENT: Overloop#Motion=0.00
145049 : SW : State 1
145049 : EVENT: Overloop#Motion=1.00
148097 : SW : State 0
148097 : EVENT: Overloop#Motion=0.00

But once i connect the same pir i'm testing with to a different gpio port the only trigger that gets logged is
490245 : SW : State 0
490272 : EVENT: 13#Motion=0.00

Already reflashed it with different versions but no success

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Only two pins work with motion detectors??

#9 Post by Shardan » 10 Nov 2017, 14:16

Shardan wrote: 10 Nov 2017, 13:57 GPIO0 and GPIO2 are pulled up (hopefully) by external resistors, otherwise the ESP8266 starts with SD-Mode or in flash mode or something alike.

GPIO's 0,2 and 15 need predefined levels for correct booting so be aware none of your sensors triggers when ESP is booting.

Some more info would be helpfull:
Can you provide a schematic please? Or a photo?
A screenshot of the switch task configuration (Click "Edit" in the device list) is often helpful too.

Did you use pullup resistors? Just a switch connected to a GPIO might be not enough.
This might be the reason why GPIO0 and GPIO2 work but others do not.

Regards
Shardan
Did you read it?
Regards
Shardan

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#10 Post by vader » 10 Nov 2017, 14:33

Stupid question: What is the output level in V of your PIRs, when they are old and work with 12V as you wrote? Because, old hardware and 3.3V....!? :roll:

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#11 Post by supplex » 10 Nov 2017, 14:49

@Shardan, yes. Havent used external pullup resistors but did connect one just now to check and see if there was any change in behaviour. Sadly no difference or state change based on movement.

I measured around around 3.2 to 3.4v when triggered before i started the project. Otherwise i wouldn't have pulled apart the alarmsystem ;) but the fact that two ports are able to trigger state changes is hope enough for me that the system is able to register the correct values and notify upon them.

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#12 Post by vader » 10 Nov 2017, 16:03

I think it would be a good idea to provide us with some screen shots of your config. Pics say more than 1000 words, as you know... ;)

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#13 Post by supplex » 10 Nov 2017, 16:26

You're right. Had to take a bit of time to open up stuff for proper pics.

Don't mind the messy cabling ;)
Underneath the controlbox for the alarm panel. The red/blue cabling (12v) and the white cabling (0v) in the red circle on the alarm panel are for powering the pirs. The green circle shows the ground wires on the breadboard and pins for the alarm cable on the right side of the board (3v)
Image 2017-11-10 at 11.12.28.jpeg
Image 2017-11-10 at 11.12.28.jpeg (368.37 KiB) Viewed 11226 times
Right now i've unplugged the ESP from the breadboard and only connected the ground line to the board and one single pir alarm cable to test all the gpio pins.

I've managed to open up one of the pirs which also includes a small schematic of the connections. If a better quality pic of the cabling is required please let me know.
Image 2017-11-10 at 11.07.35.jpeg
Image 2017-11-10 at 11.07.35.jpeg (90.98 KiB) Viewed 11226 times
Image 2017-11-10 at 16.00.59.jpeg
Image 2017-11-10 at 16.00.59.jpeg (117.11 KiB) Viewed 11226 times

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#14 Post by vader » 10 Nov 2017, 16:46

The cabeling looks in fact a bit wild! :lol: But I mean some screen shots of the ESP Easy config pages. My thought is, that there is something wrong.

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#15 Post by supplex » 10 Nov 2017, 17:02

Haha i know, typical engineer trait i guess. I'll fix it up once i get everything up and working ;)
Underneath screenshots of certain settings in the esp.

The hal device works, the overloop device too, the woonkamer device does not and all other gpio pins i tried do not work either.
Screen Shot 2017-11-10 at 16.58.57.png
Screen Shot 2017-11-10 at 16.58.57.png (118.68 KiB) Viewed 11207 times
Screen Shot 2017-11-10 at 16.57.46.png
Screen Shot 2017-11-10 at 16.57.46.png (142.28 KiB) Viewed 11207 times
Screen Shot 2017-11-10 at 17.05.10.png
Screen Shot 2017-11-10 at 17.05.10.png (125.61 KiB) Viewed 11207 times

And two devices, one on a pin that works and the other that doesn't
Screen Shot 2017-11-10 at 17.05.02.png
Screen Shot 2017-11-10 at 17.05.02.png (81.34 KiB) Viewed 11207 times
Screen Shot 2017-11-10 at 17.04.53.png
Screen Shot 2017-11-10 at 17.04.53.png (79.51 KiB) Viewed 11207 times

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#16 Post by vader » 10 Nov 2017, 17:14

Ok, that looks good so far I can see. A bit careful with the use of GPIO-0. If it is LOW during boot, you enter flash mode! Have you connected the GPIOs direct with GND / 3.3V to see if the state change?

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#17 Post by supplex » 10 Nov 2017, 17:32

Thanks for the heads up on gpio 0

Yes gpio 13 for example does trigger if i directly connect it to ground. So the pins are fine, the motion detector is doing its work perfectly on gpio0 and gpio2. But once the pir is connected to gpio 13 for example it does not trigger anything.

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#18 Post by vader » 10 Nov 2017, 17:47

Ok, it seems that GPIO-0 and GPIO-2 have already an internal pull-up!? So enable pull-up in the config of woonkamer for GPIO-10 and check what happens. Have the outputs of the PIRs open collector? Then we need the pull-ups....

And I found this and maybe helpful why GPIO-0 and GPIO-2 works.... ;)
https://www.forward.com.au/pfod/ESP8266 ... index.html
https://tttapa.github.io/ESP8266/Chap04 ... oller.html

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#19 Post by supplex » 10 Nov 2017, 18:20

Enabled pull up for gpio 10 and tested functionality. taking the plug off the pin and putting it back gives the following log
141741 : SW : State 1
141757 : EVENT: Woonkamer#Motion=1.00
142977 : SW : State 0
142977 : EVENT: Woonkamer#Motion=0.00

But afterwards it does not trigger anymore. Tried it to be sure with gpio13 as well and a different pir and same story.

Thanks for the urls by the way :) gives me something to read up on

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#20 Post by vader » 10 Nov 2017, 19:19

That's strange.... :? And the ESP with direct connection to GND works like expected? Have the PIRs a re-trigger delay?
Last edited by vader on 10 Nov 2017, 21:12, edited 3 times in total.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Only two pins work with motion detectors??

#21 Post by grovkillen » 10 Nov 2017, 20:09

I wonder what the voltage for LOW is (for the output from the PIR). Might be too high?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#22 Post by supplex » 11 Nov 2017, 13:41

Ok, extra info after training my dog to trigger the pir in the hallway :lol:

Low is 0.7v
High is 1.6v

So i'm seeing a bit of a difference in voltage and guess i mistook the high output on the esp for the triggervalue
Would this be not enough of a difference in voltage? My idea is that if gpio0 and 2 are able to succesfully trigger each time movement is detected that this should be possible on the other ones as well.

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Only two pins work with motion detectors??

#23 Post by vader » 11 Nov 2017, 14:19

This values call for trouble, I would say. :? Why is HIGH so low with 1.6V? That will never work stable. So, you should fix that first, that we have proper H/L-levels for the ESP. In this time you can set your dog in stand-by mode..... :lol:

supplex
Normal user
Posts: 11
Joined: 10 Nov 2017, 09:02

Re: Only two pins work with motion detectors??

#24 Post by supplex » 11 Nov 2017, 15:08

Good news, managed to fix it by removing the resistors in the pir.
As you can see on the previous picture i posted of the inner workings there are two connected resistors between 3 connections for the tamper protection. Those little buggers messed it up, after removing them all pirs started communicating on all gpio pins! Now on to integrating the bunch into Home Assistant.

So problem solved, and learned a bunch of things about the esp. Thanks for the help, the ideas and the articles :)

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Only two pins work with motion detectors??

#25 Post by grovkillen » 11 Nov 2017, 17:58

Happy to have assisted.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Only two pins work with motion detectors??

#26 Post by grovkillen » 11 Nov 2017, 22:19

For info, the ESP are expecting approx these levels for high and low.

High: 3.3V-2.4V
Buffer: 2.39V-0.81V
Low: 0.8V-0.0V
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Post Reply

Who is online

Users browsing this forum: No registered users and 122 guests