Experienced software developer but electrical engineering noob here...
I'm interested in replacing a custom automation system from a company that went out of business a long time ago. Part of what I need to do is replace the alarm component that was used to detect wired alarm PIR and door/window opening sensors.
My plan for now is to wire these up to ESP32's, largely the same as an Indestructibles article I found online (but with differences, like lack of a traditional alarm panel and many more inputs). Before wiring up the ESP modules I figured I'd breadboard the detection circuit first with a simple LED indicator.
Once this works, I'll swap out the LED for a 3.3v pull up configured input on the ESP32. Although it might be nice to leave an LED on the board as a display of current activity, so I may try to design that in.
The circuit uses an LM339 (I'll need 4 of these for 16 channels eventually) and a voltage divider to catch when the PIR goes from its untriggered to triggered state.
I measured our existing 12v powered alarm sensors and the output lines go from around 5.9v at rest to 3.9v when triggered, so I picked a voltage divider value of 4.9v in the middle.
It doesn't make sense at this stage to test against the PIRs we have installed on our walls. Instead for the breadboard test I'm using a crappy spare PIR that I bought as a replacement but hated because it was so noisy (loud relay).
The test PIR's voltage characteristics are different with nearly 12v at rest and under a volt when triggered. Since the voltage divider reference of 4.9 should still work with this range, I left that alone.
The following was my first circuit attempt:
Please ignore the PIR part itself. I just picked something close in the EasyEDA parts list. My test PIR uses 12v for power, and 12v for the sensor. I didn't bother with any EOL resistors or anything in order to keep the test simple.
The problem was that when the PIR triggered, the LM339 didn't seemed to sink to ground so the LED didn't turn on.
I probed the circuit with a meter (I didn't have an oscilloscope at the time I was doing this) to check the voltages. What I found was when I measured the (+) input (the output of the PIR) while triggering the PIR it worked and the LED lit. Yes, the presence of the meter affected the result.
Figuring that the resistance of the meter was playing a role in fixing the problem, I added a pull down resistor (R7 below) to the (+) input. I didn't know what the resistor value should be so I guessed 10k (based on other pull up/down values I've seen commonly used).
With this change the circuit works without attaching a meter:
The thing I don't understand is why the pull down is needed in order to fire the comparator. Is it generally needed, or maybe a side effect of the fact that I didn't wire up the other inputs or outputs of the LM339?
Thanks in advance for helping me understand this. Also, I welcome any other suggestions to improve this design.
I'm interested in replacing a custom automation system from a company that went out of business a long time ago. Part of what I need to do is replace the alarm component that was used to detect wired alarm PIR and door/window opening sensors.
My plan for now is to wire these up to ESP32's, largely the same as an Indestructibles article I found online (but with differences, like lack of a traditional alarm panel and many more inputs). Before wiring up the ESP modules I figured I'd breadboard the detection circuit first with a simple LED indicator.
Once this works, I'll swap out the LED for a 3.3v pull up configured input on the ESP32. Although it might be nice to leave an LED on the board as a display of current activity, so I may try to design that in.
The circuit uses an LM339 (I'll need 4 of these for 16 channels eventually) and a voltage divider to catch when the PIR goes from its untriggered to triggered state.
I measured our existing 12v powered alarm sensors and the output lines go from around 5.9v at rest to 3.9v when triggered, so I picked a voltage divider value of 4.9v in the middle.
It doesn't make sense at this stage to test against the PIRs we have installed on our walls. Instead for the breadboard test I'm using a crappy spare PIR that I bought as a replacement but hated because it was so noisy (loud relay).
The test PIR's voltage characteristics are different with nearly 12v at rest and under a volt when triggered. Since the voltage divider reference of 4.9 should still work with this range, I left that alone.
The following was my first circuit attempt:
Please ignore the PIR part itself. I just picked something close in the EasyEDA parts list. My test PIR uses 12v for power, and 12v for the sensor. I didn't bother with any EOL resistors or anything in order to keep the test simple.
The problem was that when the PIR triggered, the LM339 didn't seemed to sink to ground so the LED didn't turn on.
I probed the circuit with a meter (I didn't have an oscilloscope at the time I was doing this) to check the voltages. What I found was when I measured the (+) input (the output of the PIR) while triggering the PIR it worked and the LED lit. Yes, the presence of the meter affected the result.
Figuring that the resistance of the meter was playing a role in fixing the problem, I added a pull down resistor (R7 below) to the (+) input. I didn't know what the resistor value should be so I guessed 10k (based on other pull up/down values I've seen commonly used).
With this change the circuit works without attaching a meter:
The thing I don't understand is why the pull down is needed in order to fire the comparator. Is it generally needed, or maybe a side effect of the fact that I didn't wire up the other inputs or outputs of the LM339?
Thanks in advance for helping me understand this. Also, I welcome any other suggestions to improve this design.