Interface a normal PIR to a PIC?

Status
Not open for further replies.
PL-1. One home automation supply co that;s in the US says not available. I found this. **broken link removed**
but not a UK source.

Someone in the UK is having similar problems: **broken link removed**

==

Also not the IP ratings. They are Intrusion Protection and refer to environmental protection. IP65 is dust and water jets. http://en.wikipedia.org/wiki/IP_Code
 
Last edited:
Interesting, thanks.

With this PIR could I connect my circuit (powered by USB at the moment) to the LOAD + and - shown in Fig. C of the manual... if I used a voltage regulator on it, or do I need to be connecting the PIR to a relay still?

Apologies if I'm still not getting this fully. I had imagined that the PIR uses 12v itself so what it would output, or switch, would also be 12v, is that right?

At the moment my circuit does a) PIR activation detection via an interrupt, b) checks the light level via a TSL237, c) if dark enough selects a random LED effect and lights up, d) waits for an amount of time then if the PIR is low turns off the lights.

With this commercial PIR steps a), b) and d) could be taken away from my circuit and the PIR just provides power, when it's activated, to a circuit that chooses a LED effect when the PIC starts-up.
 
the OP said:
Apologies if I'm still not getting this fully. I had imagined that the PIR uses 12v itself so what it would output, or switch, would also be 12v, is that right?

The output is a potential free relay rated to 10 Amps. In the instructions https://www.shop.solar-wind.co.uk/acatalog/12v-PIR-sensor-manual.pdf PDF page 2, they show wiring where the sensor is directly connected to a lamp or outputs 12V. If you remove the jumper, you have an independent potential free contact and power.

There are issues SOMETIMES when you use high current contacts to activate logic signals. Make sure these contacts pass at least 10 mA when closed and you should be fine. 10 mA is a good rule of thumb.

You could also use it as wired and drive an optoisolator (10-20 mA through the LED portion) and then use the transistor for your output.

Just looking around, there seemed to be both variants of a potential free and direct switching.
 
So, option 1... leave the wire link in place and the PIR will output 12v DC on +LOAD when activated... in that case my circuit could be powered, I'd regulate 12v down to 5v, and select a LED effect... when the PIR activation ends (selectable on the PIR) power would be removed from my circuit and the LEDs would turn off (immediately).

Option 2... remove that wire link and have the PIR send my circuit a logic high which I can interrupt on, my circuit would already be powered by 5v and be running... upon receiving the logic high I can light the LEDs and deactivate them nicely (with a fade) when I decide to... possibly a timer or possibly by monitoring the state of the PIR line I do now with the Parallax one I've got.

Pros and cons to each it seems.

It would be nice to just have a single power supply (as it were)... rather than a 12v wall wart and a USB cable coming from my socket, so maybe option 1 is more appealing. It will require me Veroboarding my circuit again to include a voltage regulator.
 
But with option 1 I'm not really learning anything new, like how to use a relay to interface, albeit simply, with a microcontroller.
 
Your option #1, I would not do. I'd use the 12 V output to drive an optocoupler which would get you an open collector output. It also satisfies the 10-20 mA minimum current as well. There is no need to regulate the output to 5 VDC.
 
I've also never used, nor do I have, an optocoupler... something else to read up on. I bet there's about a million different types..!

Not sure I get the "no need to regulate" comment - yet - is that because I would maintain my USB power or because the optocoupler would provide 5v to my circuit somehow?
 
I don't understand the question. Please look at figure #14 in the datasheet.
The series resistor for the LED is missing.

To derive the resistor for the LED, you need a few things.
1. Current for the LED
2. Vf or V (forward) which depends on the LED color, You would usually use the max.
3. Vce (sat) or saturation if the port, ransistor or FET

The effective voltage that the power supply voltage + the LED drop + the drop of the FET/transistor at saturation.

With FETs, the on resistance can be used to compute a voltage drop.
 
OK guys... I've not taken the plunge yet with buying a new PIR. I had another that I'd bought from eBay (a shipped from China type) stashed to one side that is physically smaller than the Parallax one and is situated horizontally, so I thought that I could just stuff it into my project box and it would nicely peek out...

The thing is, my PIC circuit is driven by an interrupt on the rising edge of pin A2 - whereas the Parallax PIR works very nicely (maybe this is why it cost me about a tenner) and outputs 3.3 volts when activated, the other PIR seems to output 2.6 volts when it activates. Obviously the PIC detects one as high and the other as, well, not high.

Can I do anything here to have the PIC recognise this PIR's 2.6 volts as an interrupt? The datasheet hasn't given me the answer, thus far.
 
Thank you for that... I might do that, just to test - but (I should have been clearer) I really wanted a software solution... some lovely setting I had missed in the PIC datasheet whereby I could have INTCON_INTLV (I just made that up) set to 1 so the INT pin could recognise a 2.6 volt 'signal' and not ignore it.

My circuit is already on a veroboard and sat in a project box, you see... adding more bits would be challenging (possibly possible, but challenging).
 
If the pin was on PortB you could select the internal pullups, but there aren't any on PortA.

But it would be simple to add a resistor on the bottom of the veroboard, simply across the pins of the PIC.

For that matter, add the pullup to the PIR.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…