# New mini IR motion sensors



## JeffHaas (Sep 7, 2010)

A friend spotted some new mini IR motion sensors, they look like this:










I've used a bunch of the previous types, like this:










So I got one of the new mini types for three bucks from ebay and tried it out. It turns out these are a drop-in replacement for the older type, any microcontroller code you have will work with it. And it's small - under 1/2" wide and about 1 1/4" long.

I was using Scary Terry's tip on mounting the older type in a drain pipe cap, now I'll look at Home Depot and see if I can find a smaller cap or tube that will work with these.

The mystery, of course, is how they have simplified the circuit from the older model to eliminate a bunch of the parts and still get the same (apparently) results. And the mini IR detector I have is slightly different than the one in the picture - there are a few parts that have been eliminated.


----------



## halstaff (Nov 18, 2009)

Those look very interesting. I'll have to get some and check them out.


----------



## Indyandy (Sep 7, 2005)

Please post your results when you test them. I am looking for some too.


----------



## tstraub (Feb 26, 2012)

Thanks for posting this. These look interesting I'll have to get a few and try them out. I think the smaller size could be less about changing the related circuitry and more to do with the way the mount the sensor element on the board edge leaving room to populate both sides of the PCB with the related circuitry.


----------



## JeffHaas (Sep 7, 2010)

The circuit is definitely different - for example, there were four electrolytic capacitors on the old version, they're gone on the new one. And the main surface mount chip on the board has fewer pins. And they got rid of the two pots to adjust sensitivity, but they didn't seem to do much anyway.

I've tested them with an EFX-Tek Prop 1, a Picaxe and an Arduino, and the code on all of them works the same as with the older type.


----------



## Otaku (Dec 3, 2004)

I'm very interested in these. Have you had a chance to see if the smaller size sensor makes a significant difference in the detection range? The 1" versions usually have about a 20' range, especially when restricted with a short tube. Thanks for posting these.


----------



## David_AVD (Nov 9, 2012)

One potential issue I saw with the smaller ones is that the ON time (when triggered) seems to be fixed at 20 seconds. (or so it says in the eBay listings)

If you were using the PIR with a micro you can just use the leading edge of the signal, but it still means you can't re-trigger until 20 seconds after the PIR stops sensing the person.

I don't have any of these PIRs yet to check if a simple capacitor replacement would knock it down to a shorted period.


----------



## niblique71 (Dec 2, 2009)

Another thread I will be folliwing with great interest


----------



## JeffHaas (Sep 7, 2010)

I just tested this...the ON time isn't 20 seconds on the one I have. I pulled out a Prop-1, a Prop-1 trainer and used this code, based on demo code from EFX.

I found that you need about 8 seconds of cool-down after triggering; if I set it to five seconds, then when the pause was over, the LED would blink again. 8 seconds is a good buffer.

I also compared this to one of the older PIRs, those will work with a five second cool-down, if the Time pot is set to minimum, and the Sensitivity pot is in the middle.


```
' =========================================================================
'
' File...... PIR.BS1
'
' Purpose...Test PIR by blinking an LED.  EFX Prop-1.  Use with Prop-1 Trainer
' and a PIR connected to P6 on the Trainer.
' Date: 6/24/2012
'
' {$STAMP BS1}
' {$PBASIC 1.0}
'
' =========================================================================

' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL    PIR = PIN6       ' SETUP = DN (or out)

' -----[ Constants ]-------------------------------------------------------

SYMBOL    IsOn = 1         ' for active-high in/out
SYMBOL    IsOff = 0
SYMBOL    ScanDelay = 10   ' 10 ms scan delay

' -----[ Variables ]-------------------------------------------------------

SYMBOL pirTimer = B2       ' for debouncing
SYMBOL Led = 0

' -----[ Initialization ]--------------------------------------------------

Reset:
  PAUSE 20000              ' warm-up/inter-show delay
  pirTimer = 0             ' clear timer for scan

  HIGH Led                   ' Blink LED to show warmup is over
  PAUSE 500
  LOW Led

' -----[ Program Code ]----------------------------------------------------

Main:

  PAUSE ScanDelay
  pirTimer = pirTimer + ScanDelay * PIR   ' advance/clear timer
  IF pirTimer < 250 THEN Main

  HIGH Led                   ' Blink LED to show motion detected
  PAUSE 500
  LOW Led
  PAUSE 500
  HIGH Led
  PAUSE 500
  LOW Led
  PAUSE 8000                 ' Let PIR cool down.  New mini models need 8 seconds to keep from retriggering.

  ' control code here

GOTO Main
```


----------



## David_AVD (Nov 9, 2012)

JeffHaas said:


> I just tested this...the ON time isn't 20 seconds on the one I have.


Sorry, I was talking about the smaller narrow ones without the trim pots. I have ordered a couple to try out, but they will take a few weeks to arrive I suspect.


----------



## JeffHaas (Sep 7, 2010)

David - that's exactly what I tested, one of the little mini ones without the trim pots.

I also tried out Otaku's suggestion about distance. It seems to have a shorter range than the older bigger ones. But when you get yours, please check that out as well, I don't have a really good setup to try that out right now.


----------



## David_AVD (Nov 9, 2012)

Gotcha - I misread what you said earlier. There were a few very similar looking versions of the mini PIRs on eBay. Who knows what will actually arrive! lol


----------



## Otaku (Dec 3, 2004)

JeffHaas said:


> It seems to have a shorter range than the older bigger ones.


Shorter is good. I have had issues with placing PIRs such that the sensor won't pick up someone walking by in the street 30 ft away. It can get tricky when you have 5 or 6 of them in the yard.


----------



## Madmangt (Nov 21, 2012)

You guys are a little above my head with this, but do you think you could use these as replacement on a boobox or the sort for the super high priced PIR like this: http://www.frightprops.com/controll...ers/prop-controller-motion-trigger-black.html

Whaddaya think?


----------



## David_AVD (Nov 9, 2012)

Most prop controllers seem to use ground switching on their trigger inputs from what I can tell. (suitable for relay, switch or "open collector" outputs)

Not having received my PIRs yet, I don't know if they are "open collector" or voltage output.


----------



## David_AVD (Nov 9, 2012)

Just received my little PIRs today from an eBay seller. Man they are small !

These ones are active high output when triggered. You could use a resistor and NPN transistor to convert to an open collector output however.

When triggered, the output stays high for approx 25 seconds.

Range seems to be about 1.8 metres (6') although the seller quotes 2 - 3 metres. It's a warm day here (31°C) so that may affect it a little.

Detection angle is at least 100° by my quick testing - seller quotes 140° angle.

Overall quality seems reasonable and is still good value at only AUD $3.38 each including postage. There may be cheaper sellers and they may be cheaper in a bulk lot.


----------



## Hippofeet (Nov 26, 2012)

How mini is that thing?


----------



## David_AVD (Nov 9, 2012)

The one pictured is 12mm x 27mm. I read the size when I ordered it, but still surprised when I got them.


----------



## Otaku (Dec 3, 2004)

That's a long high output time. Most of the PIR's I've used have a pulsed high output (2 or 3 one sec ~3VDC pulses on detect). They can be tricky to use unless you're capturing the first pulse with something like a 555 timer chip, then using a method of locking out subsequent pulses. Is the output time adjustable? Perhaps a trimmer could be used to replace an on-board fixed resistor?


----------



## David_AVD (Nov 9, 2012)

Yeah, it is a long time. I'd rather see a couple of seconds max.

There's no visible numbers on either of the 8 pin ICs on this board, so it's not easy to work out if changing a resistor or capacitor value will change the on time.

I tried my trust USB microscope as well, but the numbers have either been removed or were never there to start with.

With a bit of effort I should be able to draw the circuit out and that may give a clue to how it works. One chip will be the PIR sensor interface, but not sure what the other one does yet.


----------



## Otaku (Dec 3, 2004)

Did you measure the output from the return signal pin before it hits the board? I'm wondering if the high time is set by components inside the PIR lens or by parts on the larger board. If it's set by parts on the large board, you could grab the raw PIR output signal and do what you want to with it.


----------



## David_AVD (Nov 9, 2012)

The output of the pyroelectric module itself (metal can) needs processing and that's what one of the ICs does. Here's a *link* that explains how those modules work.

The output on time will be set by one or more components on the PCB.

I started reverse engineering the PCB and see that it uses a 4.4V low dropout regulator. It's not easy to draw the whole thing out when it's double sided and so small.


----------



## Hippofeet (Nov 26, 2012)

Active high output when triggered. How high? Enough to trigger a solenoid? And then you are saying the solenoid would remain in its triggered position for 25 seconds? Long time. Hmmm.


----------



## David_AVD (Nov 9, 2012)

OK, I just did a schematic for this little PIR. The IC on the crowded side is the pyroelectric processor and the one on the sparse side seems to extend the output on time.

Pin 7 of each 8 pin IC are connected together and that is the raw output from the pyroelectric processor IC. It goes high briefly when movement is detected.

Since there are no R/C components associated with the "timing IC", it may be a very simple microcontroller. 

There is a spot for another resistor (R9) and fitting a 100R resistor there doubled the output on time.

I'd say that the ony way to get a short on time is to use pin 7 as the output to drive the base of an NPN transistor via a 10K resistor. The emitter on the added transistor will go to 0V and the collector is the new output.

EDIT:
The output from pin 7 would not be able to source much current I'd say. Even the original output will need to drive a transistor to run a solenoid, etc.

EDIT 2:
The original output is 4.4V when high. The pin 7 output seems to be approx 3V when high. It switches on/off too fast for my meter and I don't have an oscilloscope here at home to get some better measurements.


----------



## Otaku (Dec 3, 2004)

Cool info. Using the pin 7 output as you described could be used to pull a 555/556 trigger pin to ground. You can use that to fire a prop timer, no problem.


----------



## David_AVD (Nov 9, 2012)

No need for a 555. Just use one resistor and an NPN transistor to convert pin 7 into a standard Open Collector output.

One issue could be how various props deal with a input that's toggling many times. If they restart on every single pulse that would be bad.


----------



## Otaku (Dec 3, 2004)

That's where the 556 comes in. Use one side to control the prop on time, the other to lock out the PIR (after its first pulse) for an adjustable off interval. This board is already available and should be compatible with the mini-PIR.


----------



## Hippofeet (Nov 26, 2012)

The PIR is small, and that's good. Unfortunately, I don't want to add a second board. If the resistor and transistor could be cludged in on the original board, I would give it a go. 

David, I'd like to thank you for putting in the work on this. I will eventually find something that's just what I need, but I'm not sure this is it. I'm pretty impressed you took the time to get all the info though. Thanks.


----------



## Otaku (Dec 3, 2004)

Hippofeet, the board I was referring to is a two-stage prop timer that uses a PIR as a trigger. David made a good point about props getting re-triggered or shut off by the toggling effect of the PIR. While a lot of store-bought props simply run out their pre-set routines once triggered, there are some devices (MP3 players come to mind) that will go into standby or pause mode if the Play button is toggled. The timer also allows you to set an off interval; using the PIR alone could re-trigger a prop immediately after it runs its routine, provided the victim is still within range.
Full disclosure: I was the designer of the 2-stage controller (a $20 Prop contest entry a few years ago), but I don't sell them and have no financial interest whatever.


----------



## David_AVD (Nov 9, 2012)

It would be pretty easy to mount the resistor and transistor onto the PIR board. I can do this and post a picture once I'm back at work (where all my stuff is) in about a week's time.


----------



## Otaku (Dec 3, 2004)

Cool. Looking forward to the pic, thanks for all the R&D on this!


----------



## Hippofeet (Nov 26, 2012)

I've been looking all over, and have found a few PIR's I would consider really mini. They all seem to function similar to what you describe on this one, if I'm understanding them correctly. I will look at programming in BASIC stamp, see what I can figure for out for the high signal and time.

Otaku,

I have a couple sortof mini PIR's, and while I have not looked at what is outputting (high or low or High to low) it does trigger a picoboo, but, in a very strange and unreliable fashion. Since its a pretty low priority at work, I haven't had much time. It seems to trigger sometimes, then other times not, or triggered again to reset it, different times between triggering, and sometimes retriggering the controller. Need more time, like a whole day to work on it.

I will look for the pics, and I'll have to order a couple of the PIRs, I have seen them really cheap.


----------



## Otaku (Dec 3, 2004)

Check this thread for a board that will reliably trigger your Picoboo. It uses a 5VDC supply for the PIR.

http://www.hauntforum.com/showthread.php?t=30000&highlight=pico+trigger

Now back to the mini-PIR...


----------



## David_AVD (Nov 9, 2012)

Here's the PIR modified for an open collector output. The output will pull low (to 0V) in time with the raw output of the pyroelectric IC.

The resistor is 1/8W 4K7 and the transistor is a general purpose NPN type (BC547, 2N2222, etc).

The transistor emitter goes to the non-striped side of the black capacitor, the resistor goes from pin 7 of the IC to the transistor base and the new output (white wire) is from the transistor collector.


----------



## David_AVD (Nov 9, 2012)

Here's the PIR modified for an open collector output. This time the output will pull low (to 0V) in time with the original (processed) output.

The resistor is 1/8W 4K7 and the transistor is a general purpose NPN type (BC547, 2N2222, etc).

The transistor emitter goes to the non-striped side of the black capacitor, the resistor goes from the original output pin to the transistor base and the new output (white wire) is from the transistor collector.


----------



## Otaku (Dec 3, 2004)

David, nice work. Thanks!


----------



## Hippofeet (Nov 26, 2012)

Thanks David. I'll get a few and see what I can do, but I should be able to solder like that.


----------



## David_AVD (Nov 9, 2012)

If it's not clear from the text and picture, et me know and I'll take another picture or explain more.


----------



## David_AVD (Nov 9, 2012)

I used one of these PIRs for the monster crate trigger. It worked well, but in hindsight I should have shrouded it a little to reduce the detection width.


----------



## David_AVD (Nov 9, 2012)

I got some of the newer HC-SR505 mini PIR modules earlier this year and just got around to doing the open collector mod to those.

All you need to do is remove one resistor and add an NPN transistor as detailed on my da-share page.


----------

