The back cover of Servo Magazine is always an ad from Parallax, and the December issue featured several sensors that will now be distributed through Radio Shack, including a motion sensor for $10.
John and I are getting ready for this spring’s Technology: Art and Sound by Design class; and although I think John will be doing most of the teaching this year, I’m always on the lookout for sensors that would be good for students’ interactive sculptures.
Jason at work suggested that the LED puck could have a motion-sensing mode, to serve as a sort of intrusion alarm.
When two separate events occur simultaneously pertaining to the same object of inquiry, we must always pay strict attention. Or, ah, three events.
I picked up a couple of the sensors last week to try out. The clerk said when they got them, he had thought they’d never sell any. Why am I always the guy buying the weird stuff?
How Motion Sensors Work
The heart of common motion detectors is a pyroelectric sensor, which is essentially a FET with a window in the case opening onto an infrared-sensitive gate. Changes in the level of IR light with a wavelength corresponding to body heat cause changes in the drain-source resistance, which the circuit monitors.
The real trick is that the sensor is then placed behind a multifaceted lens that (loosely speaking) “chops up” the view of the world into smaller cones of heightened visibility and intervening areas of lessened visibility. Think of a stage polka-dotted with multiple spotlights, only actually seeing that way rather than merely illuminating that way.
A body moving from an area of reduced visibility into an area of increased visibility causes a rapid change in the amount of IR (body heat) shining on the sensor, hence a rapid change in its drain-source resistance. The motion detector circuit watches for these rapid changes, and when detected, triggers the alarm. This is why Robert Redford has to move slowly while retrieving the MacGuffin from Cosmo’s office in Sneakers.
A brief note about the multifaceted lens: It is usually a Fresnel lens, but being a Fresnel lens is a red herring. That simply makes the lens thin and easy to mold out of plastic; it is really the multifaceted nature of the lens that’s important. Closer examination of a motion sensor lens easily reveals that it comprises multiple adjacent Fresnel lenses.
The Fresnel dome of this sensor, by the way, is too large to fit into the LED puck (as, most likely, is the PCB). However, it’s not out of the question to purchase a separate PIR element and mill a multifaceted lens pattern into the puck enclosure above it. It would be an interesting challenge, perhaps for a later version.
The Parallax Sensor
The sensor comes with an absolutely minimal connection diagram, and refers to the Parallax web site for full documentation. The module has a three-pin connector (bottom) for ground/V+/output, and a two-position jumper (upper left) for retriggering mode.
The power/output header is annoyingly the same height as the other components on the back side of the board, so the sensor cannot be plugged directly into a breadboard for prototyping; it requires an extension. Parallax recommends a servo extension cable; I soldered a three-pin header to a three-pin header socket to make a rigid extension for breadboarding.
The module’s output is active-high. The Parallax documentation indicates that the jumper selects retriggering mode. With the jumper in the L position, the module triggers the output upon detecting motion and then goes low again. With the jumper in the H position, the module is supposed to keep the output high as long as motion continues, but mine does not.
The datasheet indicates that the module needs a “warmup” period of about a minute, during which time it’s adapting to ambient conditions and may trigger randomly. My experience was similar, so anyone using this module needs to be prepared to accept random triggering for a while after startup.
The package and datasheet indicate a detection range of about 20′. I didn’t have room to test this, but I’m willing to believe it until I learn otherwise. Apart from the minor annoyances above, the sensor really is very easy to use, particularly for our class. It seems quite responsive to motion, and certainly responsive enough to pick up gallery visitors not specifically trying to sneak up on it. Output is a very clean 5V, so it’ll be easy for students to interface to the Arduino.
Sensitivity is fixed. It’d be nice to have a trim pot to adjust sensitivity/range, particularly for use in interactive sculpture projects. A Halloween prop-maker going by the name “Scary Terry” has written a nice review of the motion sensor, and includes pictures of mounting it inside PVC pipe to control its angle of sensitivity. I guess with care, the sensor could be angled toward the ground in such a way that it would be triggered only when feet entered a designated area.
Hacking the Sensor
I suspect that most students using this sensor either would trigger a long sequence of actions when motion is first detected, or would like to get a continuous (retriggered) signal the entire time motion is detected. I’m somewhat interested, though, in a much finer-grained notion of “the entire time motion is detected” than that.
By my rough count, the sensor triggers for about two and a half seconds each time it detects motion. It then locks out briefly (didn’t time it — say another couple of seconds?) during which time it’s insensitive before it can detect motion again.
I’d like to be able to get a series of much shorter spikes and much shorter recovery time. I don’t know exactly why; it just seems useful to me.
Let’s go back to that component view:
The IC doing all the work is a BISS0001. The only datasheet I can find for it is in Chinese, yay, don’t read that, sorry. The chip has a bunch of comparators, some logic, a logic section labelled in Chinese, and two timers labelled in Chinese. It looks like it’s probably made specifically for motion-sensing applications.
Fortunately the pinouts and component values are labelled in English, so I was able to make enough sense of the datasheet to understand how to set the timing constants. From the sample application circuit, pin 2 is obviously the master output; and on the pinouts, pin 2 is labelled VO.
On the timing diagrams, VO goes high for a period labelled TX and low for a period labelled Ti. Just above that, we have the equation TX ≈ 49152R1C1 leaping out at me from a wad of impenetrable Chinese. On the functional diagram, R1 and C1 stack from pin 3 to 4 to ground.
Okay! On the PCB, pin 3 goes to a resistor that said “204.” (Ignore the 473 in the picture.) The resistor and the IC’s pin 4 go to a capacitor, which goes to ground. We’re in business!
The resistor is labelled as a 200KΩ, and my meter confirms that. The capacitor is unlabelled; in-circuit, my meter tests it at about 470pF. Doing the math:
49152 R1 C1 = 49152 * 200KΩ * 470pF ≈ 4.6 seconds
Hm, that’s a little off from the 2.6 seconds I was counting, but same order of magnitude. For a capacitor value that small, I’m willing to believe that I’m getting extra capacitance from my meter probes and from measuring it in-circuit. I think we’re in the ballpark.
The easiest way to shorten the on-period (TX) seems to me to be replacing the resistor. To take the period down an order of magnitude, I should use about a 20KΩ resistor. After looking at the SMT resistors on a dead PC motherboard, I found a 473 (47KΩ) and figured it was enough smaller to make my point.
I desoldered it by wrapping a piece of heavier wire around it and heating the wire, like Josh suggested, and it worked great. Then out of laziness and because the new resistor was larger than the existing resistor and might not fit the pads well, I just soldered it on top of the resistor that was already there, in parallel. Makes it a 38KΩ resistor instead of a 47KΩ, so we’re even going in the right direction.
I powered up the motion sensor again, waited a minute for it to settle down, and started timing its response. On-time after sensing motion (TX) is now in the half-second range. The absolute numbers still don’t match what the equation says I should get, but the relative values are right on — a resistor with 1/5 the value reduced TX to 1/5 of its former value.
Pretty slick! Now I can pick whatever TX I want, be it short or long. I haven’t tried it yet, but the lockout time between motion detection (Ti) is set by R2 and C2 on pins 5 and 6, and they’re easily accessible as well, so I should be able to change that too.
And About that Datasheet . . .
Don’t get me wrong about the Chinese datasheet. Sure I would have been disappointed if I couldn’t read it, but I was actually really pleased that sections of it were in English. I’m aware that people throughout the rest of the world have to learn English in order to do a lot of technical things, and do so with ease and proficiency much greater than that of the few Americans who bother to learn languages other than English.
Bunnie Huang has an interesting blog post that touches in passing on certain types of devices using chips of Chinese manufacture that can’t be found, or can scarcely be found, by searching Google in English:
Just try searching for USB mass storage controller ASICs, or digital picture frame SoCs on Google in English, and then go and open up one of these devices and compare your findings. I bet you’ll find that the chips most frequently used in these popular devices are best searched for in Chinese.
It’s a competitive world out there, and those of us in the west have had it awfully easy for an awfully long time. I know as a mere hobbyist, the technology I use is far behind the leading edge, and I’m not yet impacted in nearly the way of engineers developing new products for market. But the world is changing, no doubt about it, and I hope it’s a while yet before it impacts my ability to tinker.





Good job on this one ! I have a bunch of these and noticed the annoying delays, so annoying that I dropped thos sensors for some projects.
Glad you found a way to overcome this. Thanks !
And good luck with your future chinese lessons
Hello, I have just read this interesting article, Please may I have permission to post this on my website for other ppl to read, as we to would like to try this hack.
Many thanks
Mike
Mike, I’m glad it was useful to you!
I’d prefer you post a summary, possibly with a picture, and link to my article, rather than reposting my entire article on your site. Here’s a nice example of how one site does it:
http://www.electronics-lab.com/blog/?p=1305
Hi Keith,
I am trying to find a motion sensor that could be used to activate a small sound module. This module is contained at the bottom of a small cylinder and I am attempting to find a way to have this cylinder emit sound from the module when it is tilted onto its side.
If you know of a type of device that could work with the sound module then i would be interested in hearing it. I would appriciate any advice you have for me.
thank you
Howard, I don’t know how big a cylinder you’re talking about, but the easiest thing to do would be find a mercury tilt switch. Of course you want to be careful you don’t break it and leak the mercury.
Digi-Key also has several small, non-mercury switches available for $6-8 — one of them might suit you better.
Hope that helps!
This same circuit, or one very similar to it, is used in a solar-security light with motion. It is produced by EnerG+. What I want to do is lengthen the amount of time the security light is on. It is currently on for about 8-10 seconds. I would really like this light to stay on for about 60 seconds.
Even the support from EnerG+ is no help. I am assuming that I would increase the value of the resistor connected to pin 3, but I am not sure. There is a potentiometer on the motion sensor circuit, which is used to control the amount of ‘on’ time, so I suppose I could just add a resistor in series with that.
DJW, when you say “this same circuit, or one very similar to it,” on what basis do you make that claim? Have you seen schematics for the two circuits and they’re nearly identical? Does your solar security light also use a BISS0001? If so, then you likely could change the resistor attached to pin 3 of the IC.
But since there’s already a potentiometer to control the on time, I’d suggest having a look at that. See whether it’s really being used as a pot to set a control voltage, or whether it’s being used as a variable resistor in the timing circuit. If the latter, swap it out for one with 10x the value and you should probably be in good shape.
Hi Keith,
First of all good job! I’m really new to electronics in general but I would like to use this sensor to switch on emergency lighting (which automatically come on when there’s a power outage) for a couple of minutes only when motion id detected, rather than have them on all the time and quickly rub down the batteries. Do you reckon that’s possible?…and if yes can you give me any ideas for how to do it?
Thanks a lot, Keith
Lawrence
Lawrence, my approach would depend on how much light I wanted to provide and what materials I had on hand.
I can tell you that I would definitely start with an existing emergency light system — I have no desire to take engineering responsibility for a gel cell charging / charge maintenance circuit. I’d dig in and see how it turned on the light — relay? FET? something else? — and then look at integrating the motion sensor’s output into that control line.
It’s hard to say much more without having the emergency light circuit in front of me, because it could go so many different ways.
Hi Keith, thanks for your prompt reply.
I guess I understand what you are saying. I’m figuring the sensor can go somewhere between the supply and the switching device. Obviously I’ll have to increase the on time to about 2/3 minutes or so because they’ll be in an 4 floor apartment staircase.
Well I’ll have a go at it some time soon.
thanks again
Lawrence — specifically, I assume there’s already some kind of (relatively) high-current switching device turning the light on and off. I’d look to inject the motion sensor’s signal into the control side of that switch (relay, FET, whatever) so it can still do the job it was made to do, just with additional input.
Hi Keith, thanks once again for your input. I guess I’ll open up one of the lights and see what I can do. Like I said I’m a newbie so I’m a bit weary of all this, still I’ll have a go and then I’ll send off for one and give it try.
Thank you very much for your extremely informative article
I’m trying to determine how to use pir in a small low voltage circuit to detect presence rather than motion.- What I need to do is trigger a pulse when presence when the presence is no longer detected. badically i need to close a circuit momentarily when a small room ( a living room for example) is no longer occupied. I need to ensure that this ‘event doesn’t occur when someone is simply setting still on a couch not moving. How would you accomplish this?
Sean, I think there are “pyroelectric” sensors that will detect the infrared heat signature of a human body and tell you about its presence, not its movement. I don’t think you can (easily) hack a PIR motion sensor to do that, but try searching for pyroelectric.
Hey Keith,
Great info on the PIR, thanks. I have one very similar to the Parallax unit (it has minor differences like no jumper for changing the re-trigger mode), based on the BISS0001 IC. I’d like to be able to adjust the time between triggers (Ti) by using a potentiometer. You touch on that possibility in the above article, and I was wondering if you’ve had a chance to try the hack yet.