Circuit detect human movement in a space.
this project use PIC18F25K20 microcontroller to detect if the sensor change state and it will emit a sound from the speaker or piezo, the MCU also detect the voltage of the battery in the startup, the algorithm it´s very simple use an interrupt on change to detect the change on the PIR sensor.
VDD output is 3,3V, in this circuit 9V battery is connected to a IC L317T but input voltage can be 8 to 24V DC.
Calculate VDD value: VDD = 1,25 * (R2/R1+1)
Power On - when circuit start, a delay come to MCU generate a unknowed state, to avoid circuit malfunction, R6 and C1 make a RC delay filter, calculate delay with: τ = R * C
Circuit have a 8Ω speaker but piezo can be used, transistor BC338 (Q1) is used because sound have low level and should be able to ear from a different division, with BC338 transistor β = 35. Transistor Ic can be calculate with this equation:
Vcc - (Rb * Ib) - Vbe = 0