Shop OBEX P1 Docs P2 Docs Learn Events
Using the PING naked in an alarm circuit with USB (computer) feed — Parallax Forums

Using the PING naked in an alarm circuit with USB (computer) feed

JonathanDJonathanD Posts: 4
edited 2009-01-25 19:23 in General Discussion
Okay - well the USB part is a whole NOTHER issue...
but before a couple hours ago I was an utter stranger to this company and it's products, including the PING sensor I bought while at Fry's Electronics...

So what the hell was I thinking?

Well - I was thinking that maybe it would be just the thing to function as the heart of a good quality alarm system for my new business space... it seems to me that maybe I'm biting off more than I can chew here (well - that it was going to be ALOT more involved than I'd hoped!).

At any rate- is there a way I can quickly and easily set this up to trigger an external circuit? Ultimately - I want to mount it in a sneaky place adjacent to the front door and have it send a signal through a USB port on my computer. At that point - I want to use a script to have the computer play back a short audio sample through the store sound system. Yeah- kooky I know - but I really want to do this...

So - am I barking up the wrong tree with the PING??

Comments

  • SRLMSRLM Posts: 5,045
    edited 2009-01-25 03:12
    You'll need to use a microcontroller to interface between the Ping and USB chip. You won't be able to hook the ping up directly to a USB cable, or even a USB to serial chip.
  • JonathanDJonathanD Posts: 4
    edited 2009-01-25 04:15
    a controller...? why...? I mean - there's just ONE pin as an output...! So there's just going to be a voltage drop or rise at the pin when something passes in front, no...? So wouldn't choosing the right relay or amplifier give you something useful to play with on the other end...?
  • JonathanDJonathanD Posts: 4
    edited 2009-01-25 04:18
    I'm not sooo keen on having to spend another $300 for some superfluous hardware that makes me feel less insecure if there another way to do the job - especially when I'm just trying to make a doorbell...! Parallax mentions 'motion detector alarm' as a possible use for the sensor - but provide no clues or hints at how to do this... it's unfortunate.
  • SRLMSRLM Posts: 5,045
    edited 2009-01-25 04:32
    Take a look at the documentation: it states quite clearly that there is a signal protocol that needs to be followed. It is a digital device. In the case of the ping, it takes a pulse in, and outputs a pulse whose width is relative to the distance sensed. You can get an SX for a couple of dollars (plus some for a programmer), or the Propeller USB protoboard would work as well. If you need something that outputs an analog voltage, then take a look at the Sharp IR sensors of the PIR motion sensor from parallax.

    However, now would be a good time to learn some new techniques. [noparse]:)[/noparse]
  • FranklinFranklin Posts: 4,747
    edited 2009-01-25 05:13
    For motion sensing on the cheap this is what you need. www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/CategoryID/51/List/0/Level/a/ProductID/83/Default.aspx?SortField=ProductName%2cProductName

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • JonathanDJonathanD Posts: 4
    edited 2009-01-25 05:45
    Well I appreciate the feedback for one... but

    SRLM... are not all digital signals ANALOG by nature...? i.e.- a measurable change in potential, different from it's 'normal' state? I mean- there MUST be some measurable change in V or A...! I'm not trying to flog a dead (expletive) - but just be a little creative here... I mean - there MUST be some way to use it as a trigger... just because it was designed to interface with a given microcontroller doesn't mean that you can use it for something else - I would hope...? At any rate - I MAY ditch it... but I'd like to think there's a way to use it somehow...

    Franklin/Stephen - yes - I'm aware of the PIR module. IDENTICAL problem. Needs the additional componentry to function according to parallax and this forum. This guy (http://forums.parallax.com/forums/default.aspx?f=15&m=176239) was having huge problems with doing something a LITTLE bit similar to what I'm trying to do - even with all the buying into the parallax name and all that (seems total overkill to me). I'm just tryin' to be a little bit resourceful here. Most of the BETTER motion detect sentry systems use ultrasonic sensors... I've seen lots of forums talking about adapting the sonar modules out of those 80s polaroid cameras for similar uses - they really seem the superior technology...

    I'm just thinking that for MY use - buying all these pricey modules is a waste of good componentry... I'd just be buying it in order to bypass most if not all of it's functionality.... seems to me.... I'm hoping there might be someone on here who gets what I'm trying to say and has a suggestion that may work...
  • SRLMSRLM Posts: 5,045
    edited 2009-01-25 06:02
    The PIR is easy to interface to external circuitry: http://forums.parallax.com/showthread.php?p=775638

    The problem with the Ping for this application is that it needs an input signal, and then the output is a pulse width. You could probably have a timer or two give the input signal periodically, but the output would be a little bit more difficult to process without a microcontroller.
  • UghaUgha Posts: 543
    edited 2009-01-25 15:02
    JonathanD: Since I'm a newbie myself... I'll translate all the techno speak into newbieese for us k?

    The Ping requires a series of high-low pulses VERY fast, faster than a human can perceive. Then it sends out another series of high-low pulses VERY fast that says the
    exact distance that its detecting. You need a microcontroller (I recommend a Basic Stamp2 for around $50.. cheaper for the OEM version if you know how to solder) to
    transmit and receive pulses that fast.

    The PIR parallax sells is very nice for this kind of application... it doesn't require any input at all, just a power source. When it detects a change in temp within its field
    of vision, it sends either a high or low (+5 volts or 0 volts, I can't remember which off hand) for a few seconds... your external circutry could easily detect this change
    and trigger off that.

    If you want to get really cool and techy... and get a microcontroller like the Basic Stamp2(BS2), you can even do infrared "trip wires" that can cause your alarm to trigger
    when someone steps through them... All kinds of stuff is possible.

    If you go the BS2 route (or some other microcontroller like the SX... I'd still recommend the BS2 for a fellow newbie) then the people on this forum can help you a lot.

    If you'd prefer not to use the forum, I can help you directly via PM and email if you wish it... just remember that my knowledge is limited.
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-01-25 19:23
    JonathanD said...
    I'm not sooo keen on having to spend another $300 for some superfluous hardware that makes me feel less insecure if there another way to do the job - especially when I'm just trying to make a doorbell...! Parallax mentions 'motion detector alarm' as a possible use for the sensor - but provide no clues or hints at how to do this... it's unfortunate.

    You won't need to spend anywhere near $300 for the hardware, but you will need a microcontroller of some sort, because, as Ugha points out, the interface is not simply analog or simply digital, but involves controlling and reading pulse widths (exactly what a microprocessor is good at). It might be possible to set up something that doesn't need one, but it'd be much harder to set up in the first place, much harder to adjust (so that the sensitivity is right, for example), and not much less expensive.

    On the product page you'll see a .zip file labeled

    BASIC Stamp Example Code (.zip)

    If you unzip that, you'll see sample code for several processors, including the BS1. You can get a BS1 project board for $30:

    http://www.parallax.com/Store/Microcontrollers/BASICStampDevelopmentBoards/tabid/137/CategoryID/12/List/0/SortField/0/Level/a/ProductID/119/Default.aspx

    You could set that up with the Ping)) and whatever devices you wanted to serve as alarm (buzzers, lights, whatever, or your interface to the store sound system), using the sample program as your guide. Whatever you set up without a microcontroller would need those buzzers and lights and so on anyway, so going that route, the microcontroller costs you $30.

    For $31 you could use a BS2 OEM module, if you're willing to solder it together yourself (and you're going to need to do some soldering anyway to build a working alarm):

    http://www.parallax.com/Store/Microcontrollers/BASICStampOEM/tabid/135/CategoryID/10/List/0/SortField/0/Level/a/ProductID/21/Default.aspx

    Because the BS2 is quite a bit more powerful and easier to use than the BS1, this is the route I'd suggest.

    Be aware that in either of these cases, you'll either need a computer with a standard serial port or a working USB/serial adapter, like this one ($15):

    http://www.parallax.com/Store/Accessories/CablesConverters/tabid/166/CategoryID/40/List/0/Level/a/ProductID/378/Default.aspx?SortField=ProductName,ProductName

    All-in-all, once you've got the Ping already, the rest of what you need shouldn't cost you more that about $60 total, quite a bit of which is power supply and alarm parts. Again, I don't think you'd do much better with a non-Microcontroller version, and you'll be a LOT happier with it.

    In addition, you could add a $10 PIR module, which simply sends out a 5V signal when it detects any motion*:

    http://www.parallax.com/Store/Sensors/ObjectDetection/tabid/176/CategoryID/51/List/0/Level/a/ProductID/83/Default.aspx?SortField=ProductName,ProductName

    A little clever but fairly simple programming and you could set up a two-sensor system that does a pretty good job of avoiding false alarms while still signaling true intrusions, all for around $100 total (including the PIR and PING modules plus a BS2).

    * Okay, yeah, I wrote this before reading the rest of the thread. Still, not a bad idea.
Sign In or Register to comment.