Shop OBEX P1 Docs P2 Docs Learn Events
ultrasonic sensor — Parallax Forums

ultrasonic sensor

edited 2009-11-24 05:59 in Accessories
Hello!
Does anyone know how to convert the output signal from the PING ultrasonic sensor into a 0-5 volt or 4-20ma signal.
I want to connect the PING to one of my industrial P.L.C.s.
Thanks for the help and your time.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-24 01:50
    You will need some kind of microcontroller to trigger the PING, measure the width of the pulse returned from the PING, then generate a 0-5V signal using any of a variety of techniques depending on the microcontroller you want to use. Any kind of Stamp could do it.
  • edited 2009-11-24 03:30
    Thanks a lot,Mike!
    I have a bs2p and a boe.
    Where do i find source code for that?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-11-24 05:59
    There is sample code for the PING on the Parallax webstore page for the PING. That will show you how to trigger the PING and read the pulse that provides the echo time. That will provide you with a number for the pulse width in units of 0.8us which you can scale to any units you want. Remember that the BS2p executes faster than the BS2 and some timing values are different (like the 0.8us for the BS2p vs. 2us for the BS2).

    The BASIC Stamp Syntax and Reference Manual chapter on the PWM statement will show you how to use the PWM statement to generate a voltage given a number. You may need an op-amp buffer if the PLC input is not a high-impedance input.

    The Manual can be downloaded by going to the main Parallax webpage and clicking on the Downloads tab, then the "BASIC Stamp Documentation" link.
Sign In or Register to comment.