Geekzone: technology news, blogs, forums
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.

Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic
1 | 2 | 3 | 4
3344 posts

Uber Geek


  #1866332 14-Sep-2017 16:07
Send private message



Let me further elucidate my answer:


9v high - 5.5v low


If you use a 6v zener + 100k pulldown


Would a Schottky diode suffice or does it need to be a zener diode because of the reverse biasing?


Has to be a zener, because you want to drop the voltage by a set amount.  Apologies as "reverse bias" I think is the wrong term.  What we want is "reverse breakdown voltage" which is the voltage at which a diode will allow current to flow "backwards".


Reverse breakdown voltage on a schottky is going to be somewhere around 100 volts and forward is about 0.2 - neither are useful to you here.  


A zener has a specified reverse breakdown voltage of your choosing, so the voltage differential (across the zener) remains effectively constant once that voltage is exceeded.  This gives you the voltage drop required want to drive your input high without overloading it, and means it will not conduct at all when the input is "low" here is a range, you would pick the best value to bring the "high" level between 2.5 and 3.3v (high as per


If you want to protect against overvoltage on the GPIO pin, you could also use a 3.3v zener across the pulldown and put a relatively small resistor (10k or so) in the path. But this complicates things further and is probably not needed.  From what I read the ESP8266 will withstand some overvoltage on the GPIO pins.


excuse the abysmal diagram


       6.2v    10k             100k 


 in ---Z<---/\/\/--gpio--+--\/\/\---+--gnd


9v                    ~2.7v   +---Z<---+


                                        3.3v (for protection)


GoodSync. Easily back up and sync your files with GoodSync. Simple and secure file backup and synchronisation software will ensure that your files are never lost (affiliate link).
3885 posts

Uber Geek

  #1866528 14-Sep-2017 21:17

I wouldn't use zener diodes in this application. As their reverse breakdown voltage is not stable if you put less than 5mA through them. And any current that you draw from the alarm wiring will affect the voltages on the alarm zones. And if the ESP has inbuilt pull up or down resistors you have to allow for them as well.

And if the ESP has schottky type input logic, you might not get enough voltage swing on its inputs to reliably trigger it.

I have used zener diodes heaps in other applications, but I can see this one becoming a nightmare to diagnose if it doesn't work first time.

3035 posts

Uber Geek

  #1866548 14-Sep-2017 22:21
Send private message

I suggest you experiment a little more with your PIR. The output of the PIR is probably open collector or alternatively open emitter. if it is either of these, you'll be quids in.


To tell which one it is, put a resistor (mebbe 1K to start with) to the power rail. See what happens when your device is active and not.


Repeat with the resistor switched to ground ( as @worzel mentioned).


If you end up with a situation he predicted with a low voltage thats ok but a high voltage that exceeds your power rail, this would be bad (i.e. smoke) for your input device. Easy way to deal with this is to limit the current (with series resistor) and and then limit the voltage with a clamping diode. This goes between the input pin and the voltage rail.



Most of the posters in this thread are just like chimpanzees on MDMA, full of feelings of bonhomie, joy, and optimism. Fred99 8/4/21


448 posts

Ultimate Geek

  #1866553 14-Sep-2017 22:49
Send private message

I have not built/tested with the zener diode idea quite yet - for now however, I've done some reading and at the very least, I have an understanding of how a zener diode works - so thanks for the character based fritzing v0.2 diagram!!! Based on that, your description and the article article I managed to decipher the electronic buzz words and made sense of it

I'll experiment when I have time over the weekend and see how I go. I did get "fault" appearing on the alarm control panel with one of my attempts so it maybe susceptible to voltage drops (or poor attempts at wiring breadboards)



1 post

Wannabe Geek
Inactive user

  #1866586 15-Sep-2017 06:33
Send private message per my knowledge  10k ohms will give you close to 0v when not triggered.  If you still get 9v when triggered you are in business.  If not, try putting the resistor between the output and the supply voltage of the PIR instead and see if the voltage goes to 0v when not triggered.


2487 posts

Uber Geek
Inactive user

  #1866592 15-Sep-2017 06:45
Send private message

Alarms have tamper proof circuits to the sensors. They expect certain voltages when on and off, if you pull the voltages out of range, you'll trigger the tamper protection.

Of all the advice here, I'd be going with aredwood, mostly because his solution seems least likely to mess up your alarm.


448 posts

Ultimate Geek

  #1882150 11-Oct-2017 22:10
Send private message



@chimera Use a voltage comparator. The LM339 would be ideal for what you want. You simply feed 2 different voltage levels into it, and an output switches on and off depending on which input has more voltage than the other. Jaycar sell it for $2.40 ZL-3339


Connect the LM339 to the 12V supply from the alarm. Use 2 resistors as a voltage divider to get whatever voltage you want as your "changeover voltage" (7V maybe?) Connect that voltage to all of the minus input pins of the comparator. and connect each + input pin to an alarm zone. Since the LM339 is a quad comparator, it will do up to 4 alarm zones.


The output pins are open collector, meaning they are either open circuit, or connected to ground. If the ESP8266 has inbuilt pullup resistors on it's inputs, simply connect it's input pins to the comparator outputs. Otherwise just connect 10K resistors between the ESPs 5V rail and the input pins. Because of the open collector design, you can connect the comparator output pins together, if you want to monitor say 4 zones, but you don't need to know which zone got triggered. Just that a zone got triggered.


Swap the + and - inputs if you want to swap the output between 0V = zone triggered and 0V = zone normal.


Another trick is to use a 10K multi turn variable resistor as a voltage divider. Connect the end terminals to 12V and ground. And the wiper terminal is your reference voltage. So you can then adjust the changeover voltage easily if you want.


Remember to link the alarm system ground and the ESPs ground together.



I finally got around to testing this tonight.  I've tried an LM339 and setup as suggested, with 12V rail / GND from alarm powering LM339, voltage divider with a couple of 3300ohm resistors to drop 12V (which is actually about 13.2V) to about 6.6V.  I've run wire from alarm zone to Z1 (testing this first) to comparator input pin 1+, and run 'voltage divided' power to input pin 1-  On the pin 1 output I've connected an LED - with its GND leg to output pin 1, and the LED + leg to a 1k ohm resistor then off to the +12V rail (for starters at least, so I can visually see if it works)  Under normal operation, it appears to work fine - I go and walk in front of the PIR, and the LED illuminates (4.3V read via multimeter when Z1 triggered), then when the PIR goes back to idle, the LED turns off (and 7.9V read via multimeter when Z1 is idle)


However, the issue is the PIR zone voltage when the alarm system powers up.  On power up, the multimeter shows Z1 for the first ~1 second reads about 5.8V (LED flashes), then voltage drops to 4.3V (LED turns on) for about ~8 seconds, then eventually jumps back up to 7.9V (LED turns off)  When I get around to programming the Wemos, because its powered off the alarm system, I could do a delay for the first 10 seconds or so to ignore the GPIO inputs, but would rather solve via circuitry to avoid any discrepancies.


Any ideas?





3885 posts

Uber Geek

  #1882828 13-Oct-2017 10:07

@chimera I have only just seen your post. It looks like the alarm PIR is doing some sort of power on test. To narrow it down disconnect the zone wire from the alarm zone input terminal. And tempoarlly connect a 3.3K resistor between the zone wire and ground. to simulate the internal pull down resistor. Test again, then you will know if it is the panel or the sensors causing it to trigger.

Also test a tamper zone and test with the alarm running on the backup battery instead of mains.

3885 posts

Uber Geek

  #1882836 13-Oct-2017 10:20

Another thought. It could also be the panel doing a power on self test. Assuming you are monitoring all 4 zones, the best method might be some code that tells the wemos to ignore the alarm if all 4 zones get triggered at the same time.

And test the panel without any sensors connected to the zone by wiring a 2.2k resistor between the zone terminal and 12V.


448 posts

Ultimate Geek

  #1882844 13-Oct-2017 10:27
Send private message

Aredwood: Another thought. It could also be the panel doing a power on self test. Assuming you are monitoring all 4 zones, the best method might be some code that tells the wemos to ignore the alarm if all 4 zones get triggered at the same time.


I think this is what it is - I checked it last night, and if I power on the alarm system, and peak at all PIR's (without moving to trigger them obviously) I can see all PIR LED's light up throughout the duration of the alarm POST sequence (about 8-10 seconds or so)  


Your latter suggestion is genius... as highly unlikely 4 burglars will be breaking into 4 different areas of the house at the same time! cool


Thanks again!






448 posts

Ultimate Geek

  #1882907 13-Oct-2017 11:49
Send private message

So I did a quick test of voltage across zones Z1, Z2, Z3 and Z4.  I've been testing so far with Z3, which is throwing out 7.89V when idle, and about 4.38V when triggered. 


I put a multimeter across Z4, got same readings. 


I put a multimeter across Z1 and Z2, they show 6.68V when idle, and 0V when triggered.


All zones have the blue 'PIR movement' wire in it, on closer inspection zone Z3 also has a white wire that goes to the external siren (assume siren tamper) and Z4 has a white wire to a resistor in series then onto a momentary switch on the front of the alarm panel box (must be box tamper)


So had to alter voltage divider to read somewhere in the middle of 4.3V and 6.68V.  Have opt'd for 12V to 5V drop (actually reads 5.4V) which is a 4.7 ohm and 6.8 ohm resistor.  That's quite a large voltage drop though?


It works for all zones, but will need to see what voltage reads if the box or siren tamper is triggered next (maybe I'll get some earplugs first) - perhaps the combination of which may alert me to when the alarm is actually triggered.


I'm guessing any changes I make need to have no / or very minimal changes to any voltage the alarm panel is seeing.





3885 posts

Uber Geek

  #1883226 14-Oct-2017 02:08

@chimera The current that the voltage comparator draws from the alarm zones is measured in nanoamps. And changing the voltage divider won't have any effect on the alarm either apart from a very small change to the amount of power drawn from it's 12V supply. And assuming you wired it how I described. Switching off or power cycling the ESP won't affect the alarm either.


Your alarm uses "EOL Wiring" as per your circuit diagram that you posted earlier. Since you are getting different voltages on some of the zones when they have been triggered. It means that the original installer hasn't put all of the EOL resistors on all of the zones. EOL wiring is based on voltage dividers (resistors in both series and parallel) With different switches disconnecting or connecting different resistors into or out of the voltage divider. Which is how the alarm has 8 zones despite only having 4 zone inputs.


So you can see why I said not to go with the other suggestions of adding more voltage dividers into midpoints of existing voltage dividers, with some active components (zener diodes) for good measure.


You can also add a second comparator IC, setup with a different reference voltage. If you want to be able to tell the difference between an alarm due to a triggered PIR and an alarm due to a tamper condition.


The comparator can also easily be used for mains failure detection or low battery voltage detection. (with suitable input circuitry of course - easy to make though).


448 posts

Ultimate Geek

  #1883268 14-Oct-2017 10:08
Send private message

Thanks, yes I considered the tiny amp draw after I posted but couldn’t edit the post, negligible watts lost to heat.

I actually rang the installer the other day, he said there are EOL resistors wired into the PIR’s (which I opened and confirmed) and also the siren box, and said that’s why they’re called “end of line”, except the box tamper though as obviously it’s tamper switch is in the alarm panel. He also ran me through the manual and how to get into installer mode and make changes - quite a bit to take in.

I’ve got the WeMos chip programmed up and yes they do have internal pull-ups so I’ve managed to get it reading either 3.3V when idle or 0V when triggered. Just need to fix up the code to have the last state remembered for each zone and also put some delays in as my initial attempt caused it to read totally wrong.

I’ll post the setup and code and some pictures of how it looks when done. A second comparator with different voltage divider is a good idea though although I’ll complete the first phase until it’s robust enough before moving to the next.

Thanks again




448 posts

Ultimate Geek

  #1884498 16-Oct-2017 18:14
Send private message

Got the basic's of this going last night, works pretty well. Thanks so much for your help Aredwood, it makes sense, well - now that I've done it! 


EDIT: The only one downside, is the Wemos doesn't power up when the alarm powers up.  Suspect the alarm panel must draw a bit of power on startup, I'll try some capacitors for the Wemos see if that helps.  Other issue is powering off alarm panel all the time for testing, comes up with fault 12 hours later but luckily it is only because the date/time isn't set.




Breadboard to alarm...



iPhone view of OpenHAB







448 posts

Ultimate Geek

  #1892799 30-Oct-2017 19:30
Send private message

Created another instructable for this... to me its a good way of sharing an idea, plus by me documenting it, helps commit what I've learn't to memory!


Thanks again Aredwood!





1 | 2 | 3 | 4
Filter this topic showing only the reply marked as answer View this topic in a long page with up to 500 replies per page Create new topic

News and reviews »

One New Zealand Extends 3G Switch-off Date
Posted 11-Apr-2024 08:56

Amazon Echo Hub Review
Posted 10-Apr-2024 18:57

Epson Launches New Versatile A4 Desktop Scanners
Posted 10-Apr-2024 15:31

Motorola Mobility Launches New Android Phones in New Zealand
Posted 10-Apr-2024 14:59

Logitech G Unveils the PRO X 60 Gaming Keyboard
Posted 9-Apr-2024 19:01

Logitech Unveils Signature Slim Keyboard and Combo
Posted 9-Apr-2024 13:33

ExpressVPN Launches Aircove Go Portable Router With Built-in VPN
Posted 26-Mar-2024 21:25

Shure MoveMic Review
Posted 25-Mar-2024 12:47

reMarkable 2 Launches at JB Hi-Fi New Zealand
Posted 20-Mar-2024 08:36

Samsung Galaxy S24 Ultra review
Posted 19-Mar-2024 11:37

Google Nest Wifi Pro Review
Posted 16-Mar-2024 11:28

Samsung Galaxy A55 5G and Galaxy A35 5G
Posted 12-Mar-2024 12:41

Cricut EasyPress Mini Zen Blue launches at Spotlight New Zealand
Posted 12-Mar-2024 12:32

Logitech Introduces MX Brio Webcam
Posted 12-Mar-2024 12:24

HP Unveils Broadest Consumer Portfolio of AI-Enhanced Laptops
Posted 3-Mar-2024 18:09

Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.

Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

GoodSync is the easiest file sync and backup for Windows and Mac