D1 Mini + 12V PIR from old alarm system

Hi!

Is there a simple way to make an old PIR motion detector “smartified”. It seems to be 4 wires to the old PIR. Please point me in the right direction.

Supply the PIR with 12V and GND. Connect the PIR C alarm contact to the D1 Mini GND. Connect the PIR NC alarm contact to a GPIO. Enable pullups for the GPIO input.

These devices usually have a NC tamper contact as well. If you want to enable it you can connect it in series with the alarm contact.

4 Likes

Thanks! I’ll give it a try when I have some time! :slight_smile:

I am using Konnected for this. Advantage is that it more or less works out of the box and the board has easy screw connections for your PIR and also for siren or lamp.
The main disadvantage is that it relies on Home Assistant to generate an alarm.
With every HA update you risk losing your alarm functionality, this happened 2-3 times to me.
I am considering to build or buy? a standalone ESP32 solution with MQTT.
Less depending on HA.

@zamb
Did you ever make something

No time yet (or other things more prioritized…). But in theory I have it working… :smile:

I know this is an old thread, but I just wanted to report that @tom_l 's instructions worked for me. I now have 3 old motion detectors (and a bunch of door sensors) working off an ESP board. Konnected looked nice, but very expensive in comparison to a cheap 12V power supply and an ESP8266/ESP32.

Here’s an example from the ESPHome config in case it helps others:

binary_sensor:
  - platform: gpio
    pin:
      number: 23
      mode:
        input: true
        pullup: true
        output: false
        open_drain: false
        pulldown: false
      inverted: false
    name: "Living Room Motion"
    device_class: motion
    filters: 
      - delayed_off: 6s
4 Likes

Wouldn’t the 12V signal from the PIR burn out the GPIO?

I was trying this and being new to HA am appearing to fail badly in understanding things.

Did you get multiple sensors connected to the one ESP32? I have eight I need to get connected and so far I managed to get random “working” and detects motion then instantly switches to no motion, then seems to not work for a while, if at all again.

Your code is very different though, I got this to use from somewhere as an example:

binary_sensor:
  - platform: gpio
    pin:
      number: 13
      mode: INPUT_PULLDOWN
    name: "Bathroom Ceiling PIR"
    device_class: motion

Essentially what I need is very basic, just a way to see the motion from old PIRs that are powered from a 12V supply.

I had them wirking in Homeseer via an Arduino and prior to that on an ancient Homevision but I rely on them heavily with most being 360˚ ones that detect motion brilliantly.

8 PIRs shouldn’t be problem for Esp32 board, but it all depends on your PIR output/wiring.

I’m not so sure exactly but they are bog standard alarm PIRs.

All powered from one 12V supply and on the Arduino I have one common for all the sensors then each one (I assume) a live 5V onto an individual pin for each sensor. So far as I am aware that’s a very common arrangement for alarm PIRs.

It’d be brilliant if I could use the ESP32 in the same sorta way, solves a lot of problems for me.

If that assumption is correct (do check it) then the sensors supply 5V when clear and open circuit when movement is detected. So this config:

Is almost correct. Try:

binary_sensor:
  - platform: gpio
    pin:
      number: 13
      mode: 
        input: true
        pullup: false
        pulldown: true
    name: "Bathroom Ceiling PIR"
    device_class: motion

Excellent, thank you.

On the end of that can I add this to give the sensors a little more active time?

However, I tried that this morning and all appeared to be going great with motion detected on one zone a couple of times then it just stopped for no apparent reason, no changes were made in code or physically. I can’t work out why that’d be

Okay so, an update as I’m testing this just now.

If I disconnect the common then reconnect it, it works for a minute or two then seems to just die, no input being reported and I get an immediate on/off on the sensor I’m working with.

I see this:
2024-11-22_09-18-41

It seems to very quickly detect then clear, then after a bit die.

I’ve played about for a while and, added the delay I mentioned just in case that was the issue as what I think and, I am by no means any sort of an expert, is that when motion is detected that’s fine but, it instantly goes to clear then back to motion, clear and my instinct is it’s getting caught in a loop and crashing. Is that possible?

If so my guess is that it’s a code thing causing the issue but that I do not know how to solve here.

Where is this “common” connected?

The ground pin, it seems to work on either as I read it was common to the entire board.

To ground pin of your Esp32?
Is so, it’s correct.
You need to setup pullup:true and pulldown:false
Also, not all pins on all Esp32 boards are good for this. What board you have?

Yes, ground on the ESP32 and it’s a generic one, all I can see on it is this and ESP32S:

The code I have on the pin used presently is this:

  - platform: gpio
    pin:
      number: 25
      mode: 
        input: true
        pullup: false
        pulldown: true
    name: "Downstairs Hallway PIR"
    device_class: motion
    filters: 
      - delayed_off: 6s

So it looks reversed, I;ll go try it the other way and see what happens.

Okay so changed it to pull-up true and pulldown false, same sorta thing happening, it runs through (reported in HA) three motion/cleared virtually instantly then stops responding as before.

And what is Esphome log showing you?