# Help understanding PIR amplifier analog circuit

I found a PIR amplifier circuit and would like to understand better how/why it works. The purpose is mostly to learn more about analog electronics.

I found the following circuit here: PIR motion detector circuit electronic project.

The raw PIR sensor (not one with built in circuitry) outputs approx 1v and has swings in either direction from this by approx 10mV depending on motion. The signal is quite noisy though.

This is the raw output of IRA-E700 (without lens) with R1, C1 and R2 from the schematic. If i move my hand over it i can see the average voltage rising or dropping by 5-15mV.

My assumptions from the schematic:

1. IC1D is an amplifier, IC1C & I2CB comparators and IC1A compares the results of IC1C & IC1B
2. IC1D is configured as an inverting amplifier with a gain of -29.6x. This gain is set through (R6+R4)/R3.
3. C8 adds a low pass filter. C2 + R3 add a high pass filter. Together these give an active band pass filter.
4. With VCC=5v the voltage at pin 12 of IC1D is 1.544v through the voltage divider R7, R8, R9, R10:

$$5 \times \dfrac{R9 + R10}{R7 + R8 + R9 + R10}$$

5. IC1C has a bias of 1.674v (set by the voltage divider R7, R8, R9, R10). Any voltage above this will have the op amp output go to GND, otherwise VCC.

6. IC1B has a bias of 1.413v. Lower voltages make the output go low.
7. IC1A compares the outputs from IC1C and IC1B to 1.413v. A low on either op amp before will cause the output here to be low, in effect giving us digital logic out (active low).
8. VCC can be anything within the limits of the PIR sensor and op amp (no values would need to be changed for 3.3v operation for instance)

While I think I understand the general circuit I have some questions about the details:

1. What does R2 do?
2. What is the purpose of R5 & C4? I guess the capacitor would charge over time, adding another low pass filter?
3. What is the purpose of D1?
4. C3 is another low pass filter?
5. How would i calculate the frequency response of the whole system?
6. Anything i missed or overlooked?

Potential changes I could do (?):

1. Change R3 to a 50k resistor and 50k pot in series. This would allow me to change the negative feedback and set the amplifier from 22x to 44x, effectively affecting sensitivity (for instance to avoid pets).
2. Change R5 to a pot. This would allow me to change the frequency response so it wouldn't immediately react but instead trigger only if movement has been present for a while. No idea how or why this would work though. Are there other ways of doing this?

If you have other examples of PIR circuits (preferably with explanation) that would be greatly appreciated too!

-
Put the lens back in front of it and take a scope measurement while walking in front of it - you might be surprised at how the lens works in conjunction with this circuit to produce the desired result. Without the lens, the circuit is nearly useless. –  Adam Davis Jul 10 at 18:48

This is basically a classic window comparator, with stuff around it to make is actually useful in the particular application.

PIR sensors report changes in IR accross the sensor area. C2 removes the DC bias, and the circuit around IC1D amplifies the result and also does some frequency filtering. This is probably in part to reduce frequencies that aren't relevant and therefore just add noise, and in part to get the response of the overall sensor+filter that is useful for detecting motion.

IC1C and IC1B are the window comparator. R7, R8, R9, and R10 are a divider chain making voltages for the output of IC1D to be compared against. Just from the topology without looking at any numbers, you can see that the threshold for IC1C is higher than that for IC1B. Also see that the input signal into the window comparator (outout of IC1D) is fed in to the two comparators (IC1C and IC1B) at opposite polarity. In the "window" region, which is the voltage range between the - input of IC1C and the + input of IC1B, both amps will be driving low. Below the window region, IC1B will drive high and IC1C low. Above the window, IC1C will drive high and IC1B low.

The two comparator outputs are averaged by R11 and R12, then the result compared to a threshold by IC1A. This threshold is set so that IC1A drives high only when both comparator amps are driving low, meaning the voltage is in the window region.

The digital signal that indicates whether the sensor output is within the window region is capacitively coupled into this HT2812 thing. I didn't look that up, so I don't know what exactly it does, but from the transistor and speaker it is probably intended to produce a beep when motion is detected.

I'm not sure what the point of the switch in series with the KEY input is. When the switch is open, the HT2812 block won't receive the motion signal. If that is the intent, then powering everything down would be the more obvious approach, so there is probably some additional feature it supports. I don't know why you'd want to only sound a beep due to motion when a button is pressed, but that appears to be what what this circuit will do.

-
If c9 couples the output to the HT2812, wouldn't then there be no signal since the DC bias (of this binary output) be removed? Also, is IC1D any type of particular filter that you know of so further research can be done? I have no idea what C4 and R5 do, what D1 is for, or what C8 does for example. –  sherrellbc Jul 10 at 14:44
@sherr: The HT2812 thing can apparently work on the edges that will be coupled thru C9. C2 and R3 together form a high pass filter of about 200 mHz. C8 and the resistors connected to it form a low pass filter, but the diode will cause assymetric and therefore non-linear behavior. The resistors relative to R3 also set the overall gain. I don't have time to get into the details of what the R4,R5,R6 resistor network is doing exactly. –  Olin Lathrop Jul 10 at 14:50
I don't really care about the buzzer HT2812 in this case, I'd be driving an interrupt pin on a micro to wake it from sleep. In that case i guess i could skip C9 too? I'm more interested in the amplifier in this case as i can't recognize this filtering in typical inverting amplifier circuits i've seen. I understand it's to make this more practical but would like to understand more on how/why it works as it does. The stages after IC1D are quite clear –  Antti Jul 10 at 14:55
@Antti: If you want to feed motion detection into a microcontroller, then yes, you want to DC couple the output. Make sure the high level is compatible with the micro first, though. –  Olin Lathrop Jul 10 at 15:01

IC1D is configured as an inverting amplifier with a gain of -29.6x. This gain is set through (R6+R4)/R3.

This is not true because there is a bias voltage on V+ and V- (1.54V). If I did my math correctly (and for DC operating point only) there is actually an offset to the gain that is rather interesting:

$$Vo = Vn(1+\dfrac{R4+R6}{R3}) - Vi\dfrac{R4+R6}{R3}$$

Which is obviously in infamous inverting amplifier if Vn (inverting terminal) = 0. Plugging in values we get:

$$\dfrac{Vo}{Vi} = -29.6 + \dfrac{47.12}{Vi}$$

Perhaps my math skills are subpar, but I was not able to quickly see a closed-form solution. It's interesting to note that the gain then grows more negative as Vi increases, and more positive as Vi gets smaller.

C2 + R3 add a high pass filter

Also I don't think C2 and R3 are making any sort of high-pass filter. Rather, C2 decouples the output of the sensor to to the input of the amplification stage. C3, in effect, passes high-frequency, but the combination of these two passive components does not have an output to speak of, so it's not really a filter in that way. R3 sets the gain, as you said. Feel free to correct me if I am wrong here.

IC1B has a bias of 1.413v. Lower voltages make the output go low.

Recall the equation for op amps: Vout = A(V+ - V-). Which says that if V- > V+ (without feedback) then the output rails to the negative supply. Likewise, if V+ > V-, the output will rail to the possible supply. If you look at IC1C, for example, V- is biased to 1.67V. Therefore, the output is always at the negative supply until the output of IC1D becomes greater 1.67V. Similarly, IC1B has V+ biased to 1.41V, so the output is always at the positive supply unless V- becomes greater than 1.41V. I say this because your point 6 contradicts this - but should rather say HIGH where you write LOW

C8 adds a low pass filter

I don't see the purpose if that is the case. The high-frequency components have a path through R4 and R6.

What does R2 do?

Looking at the schematic from the datasheet, D and S represent Drain and Source of a mosfet, so R2 is connecting the open drain to ground but I am not sure exactly why as it appears to be driven by a crystal of sorts.

-
How is there a bias voltage on V+? I can see V- having a bias (as described in the question) but V+ doesn't get a bias from anywhere, unless i'm missing something. Can you please elaborate a bit on where you got the numbers from (also R1 & R2 don't match the schematic). –  Antti Jul 10 at 14:44
The non-inverting terminal is directly connected to the resistor divider chain of R7, R8, R9, and R10. –  sherrellbc Jul 10 at 14:46
Also yes, i had the window comparator the wrong way around (high/low), thanks for pointing that out. –  Antti Jul 10 at 14:48
Oh whoops, had those two mixed up. However as far as i can see there's no bias on V-? "This is not true because there is a bias voltage on V+ and V-" –  Antti Jul 10 at 14:50
You have negative feedback, so V+ = V-. What bias on V+ are you seeing? –  sherrellbc Jul 10 at 14:57