Shop OBEX P1 Docs P2 Docs Learn Events
New stamper question — Parallax Forums

New stamper question

ArchiverArchiver Posts: 46,084
edited 2001-08-14 20:19 in General Discussion
I'm fairly new to Basic stamps and electronics in general. I was
hopping one of you out there might be able to help me out here. I
have a Passive Infrared motion detector that shows a 5.06 voltage
constant until movment is detected. When it senses movment the
voltage drops to below 1 volt. Now from reading, this seems to be
what is termed active-low. Now my real question . How would I code/
add components to the stamp to allow me to sense when the PIR sensor
detects movment? Do I need any resitors or other components? It seems
to me I should be able to do an If in8=0 then display movment
detected. Any code examples and or componets required would be
appricated.

Thanks for your help

Shawn

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-08-14 16:30
    Connect the output of the PIR detector to one of the Stamp ports though
    about a 330 ohm resistor. You don't absolutely need the resistor, but if you
    screw up and have the port set up as an output it can save the Stamp. Set
    the port up as an input with the DIR = statement, then do the IF statement
    you posted.

    Original Message

    > I'm fairly new to Basic stamps and electronics in general. I was
    > hopping one of you out there might be able to help me out here. I
    > have a Passive Infrared motion detector that shows a 5.06 voltage
    > constant until movment is detected. When it senses movment the
    > voltage drops to below 1 volt. Now from reading, this seems to be
    > what is termed active-low. Now my real question . How would I code/
    > add components to the stamp to allow me to sense when the PIR sensor
    > detects movment? Do I need any resitors or other components? It seems
    > to me I should be able to do an If in8=0 then display movment
    > detected. Any code examples and or componets required would be
    > appricated.
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-14 16:33
    That sounds like it should work. All digital devices have some threshold and
    anything below that threshold is a "0" (except for devices that exhibit
    hysterisis, but that's another story and one that doesn't apply). The 5.06V
    should not bother the Stamp, although a small series resistor would allow
    you to safely handle voltages high enough to trip the Stamp's internal
    protection diodes (5.6V or so).

    Figure a Stamp input can sink 20mA safely. The protection diodes will clamp
    the input to 5.6V (and -.6V on the other side) more or less. So ohm's law
    can tell us that:

    (Vin-5.6)/.02 = R

    So if the PIR could deliver, for example, 9V would give you an R of 170
    ohms. Under normal operation, this wouldn't be a problem since the Stamp
    inputs draw so little current. Just for a seat of the pants guess, say a
    Stamp input draws 100uA (.0001A) -- it may not even draw that much, but just
    say that it does. That would result in a 17mV drop in your input voltage. So
    if the PIR outputs 5.06V, the Stamp would see 5.043V -- no big deal.

    So while you probably don't need a small resistor, it wouldn't hurt to put
    one in and could save you trouble later. Cheap insurance. 170 ohms probably
    isn't a standard value, but 220 is. That's OK on current because it will
    cause the current to be even lower if the voltage goes too high. And the
    drop at 100uA is only 22mV -- still a drop in the bucket (no pun intended).

    You might also want to consider software averaging, filtering, and
    hysterisis to ignore fast noise.

    For example:

    No filter:

    if in8=0 then motion_on


    Example raw filter:
    waitmo:
    filter=0
    waitmo1:
    if in8=1 then waitmo
    filter=filter+1
    if filter<5 then waitmo1 ' wait for 5 hits in a row


    Good luck!

    Al Williams
    AWC
    * Floating point math for the Stamp, PIC, SX, or any microcontroller
    http://www.al-williams.com/awce/pak1.htm







    >
    Original Message
    > From: shawnusa@e... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=LaNvFWEYnglxOkQLeU6FWyFaMXs5X6w4rwR_paQwWJznDsBhf9BtLkpHQpGFURMGYfHHa3W_E4bmGQ]shawnusa@e...[/url
    > Sent: Tuesday, August 14, 2001 10:07 AM
    > To: basicstamps@yahoogroups.com
    > Subject: [noparse][[/noparse]basicstamps] New stamper question
    >
    >
    > I'm fairly new to Basic stamps and electronics in general. I was
    > hopping one of you out there might be able to help me out here. I
    > have a Passive Infrared motion detector that shows a 5.06 voltage
    > constant until movment is detected. When it senses movment the
    > voltage drops to below 1 volt. Now from reading, this seems to be
    > what is termed active-low. Now my real question . How would I code/
    > add components to the stamp to allow me to sense when the PIR sensor
    > detects movment? Do I need any resitors or other components? It seems
    > to me I should be able to do an If in8=0 then display movment
    > detected. Any code examples and or componets required would be
    > appricated.
    >
    > Thanks for your help
    >
    > Shawn
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-14 18:20
    I would probably use a much higher value resistor, say 4.7K

    With a 330 Ohm resistor you 'might' if the stamp pin
    is at anytime an output and at a logic state opposite the
    PIR, see 15.3mA of surge current. This in my opinion is much
    to close to the nominal 20mA/25mA capabilities of the Stamp.

    With a 4.7K resistor the current is adequate to drive
    the stamp in input mode, and also remains safe if the stamp
    pin was to be placed in output mode.


    >Connect the output of the PIR detector to one of the Stamp ports though
    >about a 330 ohm resistor. You don't absolutely need the resistor, but if you
    >screw up and have the port set up as an output it can save the Stamp. Set
    >the port up as an input with the DIR = statement, then do the IF statement
    >you posted.
    >
    >
    Original Message
    >
    > > I'm fairly new to Basic stamps and electronics in general. I was
    > > hopping one of you out there might be able to help me out here. I
    > > have a Passive Infrared motion detector that shows a 5.06 voltage
    > > constant until movment is detected. When it senses movment the
    > > voltage drops to below 1 volt. Now from reading, this seems to be
    > > what is termed active-low. Now my real question . How would I code/
    > > add components to the stamp to allow me to sense when the PIR sensor
    > > detects movment? Do I need any resitors or other components? It seems
    > > to me I should be able to do an If in8=0 then display movment
    > > detected. Any code examples and or componets required would be
    > > appricated.



    Beau Schwabe IC Mask Designer
    National Semiconductor Wired Communications Division
    500 Pinnacle Court, Suite 525 Mail Stop GA1 Norcross, GA 30071
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-14 19:02
    Yes, that's true if you might ever put the input mode into an output state.
    Although you'd hope something like that would be transient and 15.3mA is
    still within the letter of the law.

    I had said 220 which will allow even higher current to flow (5/220) but I
    was really thinking about high voltage from the PIR not reversed Stamp pins.

    From all the discussion, you might think a bigger resistor is better, so
    just use a bigger resistor (and I know you know this Beau, but for the
    lurkers). To a point this is OK, with two limiting cases. As we've
    discussed, the higher resistance drops more input voltage. At some point you
    drop below threshold. The second problem occurs with short pulses and/or
    long lines. Interconnections have capacitance and adding resistance makes an
    RC circuit. This can do bad things to your inputs if they are short pulses.
    Just something to think about.

    Anyway, that's a good point since the Stamp's pins can go either way.

    Al Williams
    AWC
    * Measure 8 pulses at once
    http://www.al-williams.com/awce/pak7.htm

    >
    Original Message
    > From: Beau Schwabe [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=t-AVdpkX6wlwrGmarDKmsPRKaHxQNwsumnbQh_uH_Kx5vkts-7FRCgKMI7q_j_Q-uMJkgpdrqICe5DBlga9xag]bschwabe@a...[/url
    > Sent: Tuesday, August 14, 2001 12:21 PM
    > To: basicstamps@yahoogroups.com
    > Subject: Re: [noparse][[/noparse]basicstamps] New stamper question
    >
    >
    > I would probably use a much higher value resistor, say 4.7K
    >
    > With a 330 Ohm resistor you 'might' if the stamp pin
    > is at anytime an output and at a logic state opposite the
    > PIR, see 15.3mA of surge current. This in my opinion is much
    > to close to the nominal 20mA/25mA capabilities of the Stamp.
    >
    > With a 4.7K resistor the current is adequate to drive
    > the stamp in input mode, and also remains safe if the stamp
    > pin was to be placed in output mode.
    >
    >
    > >Connect the output of the PIR detector to one of the Stamp ports though
    > >about a 330 ohm resistor. You don't absolutely need the
    > resistor, but if you
    > >screw up and have the port set up as an output it can save the Stamp. Set
    > >the port up as an input with the DIR = statement, then do the IF
    > statement
    > >you posted.
    > >
    > >
    Original Message
    > >
    > > > I'm fairly new to Basic stamps and electronics in general. I was
    > > > hopping one of you out there might be able to help me out here. I
    > > > have a Passive Infrared motion detector that shows a 5.06 voltage
    > > > constant until movment is detected. When it senses movment the
    > > > voltage drops to below 1 volt. Now from reading, this seems to be
    > > > what is termed active-low. Now my real question . How would I code/
    > > > add components to the stamp to allow me to sense when the PIR sensor
    > > > detects movment? Do I need any resitors or other components? It seems
    > > > to me I should be able to do an If in8=0 then display movment
    > > > detected. Any code examples and or componets required would be
    > > > appricated.
    >
    >
    >
    >
    > Beau Schwabe IC Mask Designer
    > National Semiconductor Wired Communications Division
    > 500 Pinnacle Court, Suite 525 Mail Stop GA1 Norcross, GA 30071
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    > Subject and Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
  • ArchiverArchiver Posts: 46,084
    edited 2001-08-14 20:19
    Thanks Guys for the help. It works like a charm. Now all I have to do
    is figure a way to pan a r/c servo to look in the right direction of
    the detected PIR unit. I plan to have 6 pir units and one r/c servo
    with a CCD cammera attached on it. When a PIR is activated the servo
    will turn to that general direction and with a Heat sensor try and
    track the movment with the servo. It's going to take me awhile to
    figure out how to code the PIR with the Servo movment. Anyway thanks
    for your help and any recommendations are welcome on my project.

    Shawn


    --- In basicstamps@y..., "Al Williams" <alw@a...> wrote:
    > Yes, that's true if you might ever put the input mode into an
    output state.
    > Although you'd hope something like that would be transient and
    15.3mA is
    > still within the letter of the law.
    >
    > I had said 220 which will allow even higher current to flow (5/220)
    but I
    > was really thinking about high voltage from the PIR not reversed
    Stamp pins.
    >
    > From all the discussion, you might think a bigger resistor is
    better, so
    > just use a bigger resistor (and I know you know this Beau, but for
    the
    > lurkers). To a point this is OK, with two limiting cases. As we've
    > discussed, the higher resistance drops more input voltage. At some
    point you
    > drop below threshold. The second problem occurs with short pulses
    and/or
    > long lines. Interconnections have capacitance and adding resistance
    makes an
    > RC circuit. This can do bad things to your inputs if they are short
    pulses.
    > Just something to think about.
    >
    > Anyway, that's a good point since the Stamp's pins can go either
    way.
    >
    > Al Williams
    > AWC
    > * Measure 8 pulses at once
    > http://www.al-williams.com/awce/pak7.htm
    >
    > >
    Original Message
    > > From: Beau Schwabe [noparse][[/noparse]mailto:bschwabe@a...]
    > > Sent: Tuesday, August 14, 2001 12:21 PM
    > > To: basicstamps@y...
    > > Subject: Re: [noparse][[/noparse]basicstamps] New stamper question
    > >
    > >
    > > I would probably use a much higher value resistor, say 4.7K
    > >
    > > With a 330 Ohm resistor you 'might' if the stamp pin
    > > is at anytime an output and at a logic state opposite the
    > > PIR, see 15.3mA of surge current. This in my opinion is much
    > > to close to the nominal 20mA/25mA capabilities of the Stamp.
    > >
    > > With a 4.7K resistor the current is adequate to drive
    > > the stamp in input mode, and also remains safe if the stamp
    > > pin was to be placed in output mode.
    > >
    > >
    > > >Connect the output of the PIR detector to one of the Stamp ports
    though
    > > >about a 330 ohm resistor. You don't absolutely need the
    > > resistor, but if you
    > > >screw up and have the port set up as an output it can save the
    Stamp. Set
    > > >the port up as an input with the DIR = statement, then do the IF
    > > statement
    > > >you posted.
    > > >
    > > >
    Original Message
    > > >
    > > > > I'm fairly new to Basic stamps and electronics in general. I
    was
    > > > > hopping one of you out there might be able to help me out
    here. I
    > > > > have a Passive Infrared motion detector that shows a 5.06
    voltage
    > > > > constant until movment is detected. When it senses movment the
    > > > > voltage drops to below 1 volt. Now from reading, this seems
    to be
    > > > > what is termed active-low. Now my real question . How would I
    code/
    > > > > add components to the stamp to allow me to sense when the PIR
    sensor
    > > > > detects movment? Do I need any resitors or other components?
    It seems
    > > > > to me I should be able to do an If in8=0 then display movment
    > > > > detected. Any code examples and or componets required would be
    > > > > appricated.
    > >
    > >
    > >
    > >
    > > Beau Schwabe IC Mask Designer
    > > National Semiconductor Wired Communications Division
    > > 500 Pinnacle Court, Suite 525 Mail Stop GA1 Norcross, GA 30071
    > >
    > >
    > >
    > >
    > > To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@y...
    > > from the same email address that you subscribed. Text in the
    > > Subject and Body of the message will be ignored.
    > >
    > >
    > > Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
    > >
Sign In or Register to comment.