Parallax Motion Sensor from Radio Shack

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.

Two Parallax / Radio Shack motion sensor kits

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.

Parallax pyroelectric sensor

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.

Parallax motion sensor, component side

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:

Parallax motion sensor, component side

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.

Parallax motion sensor, pulse timing components

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.

Parallax motion sensor, lockout timing components

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.

60 Responses to “Parallax Motion Sensor from Radio Shack”

  1. Alan says:

    I’ve been wanting to lower the times on a similar unit that uses the same bis ic. Thanks for sharing this experiment. You saved me some work.

    Thank you too SunGear. The first thing I looked for was this datasheet but I only found it in Chinese.

    Now it’s time to give this hack a try.

  2. Olivier says:

    Thanks a lot, I followed your advices and I put in parallel a resistor on Rx and Ri and I’ve now half a second of HIGH state when the PIR detects and half a second for rearming. That’s perfect !

  3. Grumpy_Mike says:

    You said
    “The absolute numbers still don’t match what the equation says I should get, ”
    But your calculations are only for the time constant of that R & C. In most practical circuits a time delay is given by zRC where z ( should be Greek zeta ) is typically 0.5 to 0.75, so you can’t say what you did.

    It looks like the numbers (calculated ) could actually match what you found if you use the right zeta.

  4. Fabio says:

    Is it possible to use the sensor for read temperature such as infrared thermometers?

  5. PeterF says:

    The descriptions for all these PIR sensors (and there a quite a few close variants in the market) speak of the “blocking time” which in your article you designate as Ti. I can see the point of having a blocking time if the sensor is set to non-retriggerable mode, so it times out after a fixed delay, irrespective of what further movement pulses are detected, For that mode it makes sense to have a defined inactive period before a retrigger can occur.

    But in “retriggerable” mode a blocking time makes little sense. If the movement pulses are coming in with a period less than the output dwell time of Tx, then you want the output to remain high. If the degree of movement means the output times out, then for all practical purposes you want it to return high as soon as possible with a zero blocking time.

    Think of a corridor or cupboard light: if movement stops for such a time that the output goes low from lack of movement, it’s a nonsense to make the device unresponsive to subsequent movement for any time at all, let alone the default 2.5 seconds.

    In retriggerable mode the blocking time should be zeroed out altogether. Yet in the assemblies I have made so far it is still present.

    The variant I buy ex Hong Kong (for about $0.60 USD each in 2016) has two trimpots on it: one for setting Tx and the other is a sensitivity control which translates to be a range control. Both work well. There is also a pair of holes on the PCB for a CdS resistor so it can do daylight sensing. I don’t know why they don’t fit it universally, as it is easier to cut it out if not required, than to add it in after manufacture.

    The output drives from 0V (no movement) to around 3.5V when on. This is pretty usless for directly driving anything other than an Arduino input, but by adding an NPN power transistor with its base directly connected to the output pin there is enough current gain to drive a fair length of LED strip lighting, or providing base current for a relay driver. A power darlington is a better choice for loads upwards of 800mA. The limiting resistor of 1K internal to the chip means direct connection to the base won’t do any harm.

    Someone mentioned collimating the field of view to get more directionality. Masking the lens internally with one or two layers of insulation tape cut to cover unwanted fields (white tape will do as well as black) is easier, and does not take up any more room like a collimating tube would. Painting the lens with white-out is just as good, but harder to adjust after the painting. Remember it’s IR you are trying to mask. Visible light is irrelevant, so total opacity is not needed.

    Thanks to Keith for a great and instructive hack.

    To Grumpy_Mike and the zeta factor he mentions….surely zeta in this case is exactly 49152, as given by the manufacturer. I agree with G_M that usually for an RC circuit it is ln(e) or some number in the range he cites dependent on voltage thresholds of that circuit. But this is clearly not a simple RC timer, but a time that uses R and C and a binary plus a trinary divider chain to give a multiplication factor of….49152. I think Keith is right that the discrepancy comes from measurement artifacts, a supposition that fits in well with the precise scaling of the timing variation with resistance variation.

    To Fabio who asked if the device could be bent to measure temperature… No! Not without total remanufacture. A bit like turning a car into a bathtub. About the only thing usable would be the pyroelectic element. All the circuitry and especially the chip and lens would need to go.

  6. Robert says:

    What should I do if I do not want any value for Ti. I don’t want any time interval that the sensor is not triggerable.

  7. Levente says:

    Hi Keith, little late on this matter, but once you mentioned pin12 (v2out of bis0001) you wanted to solder a fly-wire and check on scope whats going on real-time with the pir. some times ago, studying the schematics and the time-base signal diagrams i got to the same conclusion, and i wanna process this “live” output with an ADC pin on an esp module. Do you remember something if it was successful or not?
    (i wanna get rid of Tx and Ti completely) in order to apply pir sensors instead of IR LED IRreceiver barrier. (double barrier for passing direction evaulation.
    cheers, lev

  8. sluva says:

    We are facing the same problem and were so excited when we saw you figured out how to solve it. The problem is, we don’t have the same exact PIR motion sensor as you (or it doesn’t seem like it from the picture) and we couldn’t exactly follow the steps with the soldering and everything. We tried it using two 10k resistors soldered together and we soldered one end to pin 4 on the op amp and the other end to the green line touching the capacitor. When we plugged it in, nothing was detected. Can you please help us? Give us a more dumbed down version, with every step spelled out? Our PIR is HC-SR501. Thank you very much!

  9. Saul Margolis says:

    Does anybody know how to limit the maximum detection range on this? The PIR I’ve got is the HC-SR501 which is based on the same chip. It has a pot to limit range to between 3m and 7m, but I’d like to limit the range to between 1.5m and 2m.

Leave a Reply