Author Topic: Panasonic PIR Sensor  (Read 1137 times)

0 Members and 1 Guest are viewing this topic.

Offline mousepadheadTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Panasonic PIR Sensor
« on: August 14, 2026, 07:07:00 am »
Hi there,

I have a fairly simple design based around a Raspberry Pi Pico Lipo - soldered onto a carrier board.
Pico Lipo 2 is supplied by USB power.
https://cdn.shopify.com/s/files/1/0174/1800/files/Pimoroni_Pico_LiPo_2_Schematic.pdf?v=1747917477

I am trying to interface to a Panasonic PaPir EKMC1601112 wired to input pin GPIO15. https://industrial.panasonic.com/cdbs/www-data/pdf/EWA0000/bltn_eng_ekmc160611_ast-ind-247327.pdf
2878264-0
2878272-1

PIR_IN net sits at 2.14V if I stay still for a long time. >>
Code: [Select]
gpio_get(PIR_PIN) = TRUEPIR_IN net sits at 3.13V is I move around infront of it. >>
Code: [Select]
gpio_get(PIR_PIN) = TRUE
3.3V supply sitting at 3.305V steady (measured at R5)
Bottom of R5 (VP net measures 3.289V steady)
PIR Datasheet Operating Voltage is Vdd: 3.0 - 6.0

Why isnt the PIR_IN pulling down to ground while no motion present?
I tried stacking another R5 = 50ohm for stronger pulldown - same results.
I have tried a new EKMC1601112 - same results.
0ohm measured between PIR GND and PicoLipo -ive
This same PIR sensing circuit is working perfectly on a Atmega32U4 (5v supply) without issue.

Any pointers would be amazing!!



« Last Edit: August 14, 2026, 07:11:00 am by mousepadhead »
 

Online jomas

  • Contributor
  • Posts: 14
  • Country: nl
Re: Panasonic PIR Sensor
« Reply #1 on: August 14, 2026, 11:31:19 am »
You set your PIR_PIN high. (single =)
If you want to get the status you should use:
gpio_get(PIR_PIN) == TRUE
 

Online mjs

  • Regular Contributor
  • *
  • Posts: 128
  • Country: fi
Re: Panasonic PIR Sensor
« Reply #2 on: August 14, 2026, 11:35:59 am »
Check the comparison Jomas mentioned and also that you have configured the GPIO pin as input. If the pin is configured as output and high, you'd get roughly what you report.
 

Online voltsandjolts

  • Supporter
  • ****
  • Posts: 3812
  • Country: gb
Re: Panasonic PIR Sensor
« Reply #3 on: August 14, 2026, 11:41:55 am »
Please post all your firmware source code, or a link to github repo.
 

Offline mousepadheadTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: Panasonic PIR Sensor
« Reply #4 on: August 14, 2026, 12:39:22 pm »
Same carrier board works correctly (toggles between 3.2 and 0v) when soldering down a Pico 1.

My code is:
Code: [Select]
#include <stdio.h>
#include "pico/stdlib.h"
int main(void)
{
    stdio_init_all();
    gpio_init(15);
    gpio_set_dir(15, GPIO_IN);

    while (true) {
        printf("GPIO15: %d\n", gpio_get(15));
        sleep_ms(500);
    }
}

Is it possible this could be related ? https://github.com/raspberrypi/pico-feedback/issues/401#issuecomment-2334490720
 

Online voltsandjolts

  • Supporter
  • ****
  • Posts: 3812
  • Country: gb
Re: Panasonic PIR Sensor
« Reply #5 on: August 14, 2026, 04:20:03 pm »
Try removing the sensor and connecting GPIO15 pin to 1 and 0 (i.e. 3v3 and GND) with a wire or 100Ohm resistor. Check you get expected printf output.

If that works then it's probably the feeble 100uA output capability of your sensor, coupled with perhaps odd behaviour of pico gpio pins. Try buffering the signal from your sensor with, say, a logic gate like Schmitt input inverter 74hct14 or such like.
« Last Edit: August 14, 2026, 05:24:36 pm by voltsandjolts »
 

Offline aeg

  • Frequent Contributor
  • **
  • Posts: 462
  • Country: us
Re: Panasonic PIR Sensor
« Reply #6 on: August 15, 2026, 12:00:06 am »
Looks like the sensor output never sinks current, so if the pin is sitting at 2.14V, that's gotta be coming from elsewhere... weak pullup enabled on the GPIO pin?
 

Offline mousepadheadTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: Panasonic PIR Sensor
« Reply #7 on: August 15, 2026, 01:09:31 am »
I think something related to the PIR only being able to source 100uA, and the leakage or the RP pins.?

I copied the reference sheet for the PIR, including switching circuit with 2N2222.

Seems to be working now!

2878580-0
 

Offline aeg

  • Frequent Contributor
  • **
  • Posts: 462
  • Country: us
Re: Panasonic PIR Sensor
« Reply #8 on: August 15, 2026, 01:39:20 am »
OK, but you still don't understand what was wrong.

If the PIR is only able to source 100uA, then where was the current coming from to pull it all the way to 3.13V when the sensor is triggered?

Why would a CMOS input have 100,000 picoamps of leakage in 2026?

It's working now, but the logic levels are inverted compared to without the transistor. Do you understand why?

The transistor is wired open-collector and will never source current from its collector. How are you getting two logic levels out?
 

Offline mousepadheadTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: Panasonic PIR Sensor
« Reply #9 on: August 15, 2026, 02:00:34 am »
I understand why logic levels are inverted,
When PIR is inactive, base is pulled to GND, 2N2222 is in cut-off, no current flows C->E, GPIO is pulled up to 3.3V.
When PIR is active, OUT high (~3.1 V), V_BE at ~0.7 V, base current flows, 2N2222 saturated, C->E conducts, collector (and GPIO) pulled to 0 V.



I still don't quite understand why the original circuit did not work, it did not work on 2 separate Pico2 (RP2350), (worked instantly on Pico1 (RP2040).

Do you not think this is relevent? (Errata E9)



 

Offline aeg

  • Frequent Contributor
  • **
  • Posts: 462
  • Country: us
Re: Panasonic PIR Sensor
« Reply #10 on: August 15, 2026, 10:35:11 am »
OK  :)

Does your Pico 2 have an early stepping of the RP2350 chip? If the first group of characters under the raspberry logo ends in A2 then you may have nailed it... lines up well with the 2.12V you saw. Current production with A4 stepping doesn't have this errata.

Note that my interpretation of the PIR datasheet is it will never sink current. No matter how small you make R5, your only pulldown is from R10.
 
The following users thanked this post: mousepadhead

Offline mousepadheadTopic starter

  • Newbie
  • Posts: 7
  • Country: au
Re: Panasonic PIR Sensor
« Reply #11 on: August 15, 2026, 11:02:33 am »
I think that's it, RP23500A02. I thnk they fixed it in A04. Its stuck to a Pirmironi Pico Lipo 2. I think I did read somewhere that they stocked up so current supplies are still shipping with the previous rev MCU. (I bought these 2 weeks ago).

I think you are bang on with the PIR only being able to source current, I was just going off the arrow on the datasheet, but reading it again the spec table only gives details on the output current while Vout is at high state.

I found some extra details in the catalogue that i feel they could have added to the datasheet..

Thanks for your help AEG





 

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 5368
  • Country: nl
Re: Panasonic PIR Sensor
« Reply #12 on: August 16, 2026, 02:36:32 pm »
Are you sure your PIR sensor outputs a logic signal?

The sensor itself generates a very weak signal, which then has to be amplified 10k times or so, which only works by filtering out DC ( absolute sensor offset, opamp offset voltages etc). Very cheap sensors then put it though a flipflop and timer, but you can do much more by directly analyzing the analog output with a uC. For example reduce the false positives, or get more true positives by analyzing lower level inputs.

Edit: It's apparently a digital output. Page 4 of the datasheet shows a circuit of how to interface with it.
« Last Edit: August 16, 2026, 02:39:44 pm by Doctorandus_P »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->