How to connect Ultrasonic Sensor HC-SR04

  • I’d like to connect the Ultrasonic Sensor HC-SR04 to the Onion Omega 2+ and Power Dock.

    Is there any package to do this? Do I need the ARDUINO DOCK R2 to do it?

    The sensor has the following pins
    VCC = +5VDC
    Trig = Trigger input of Sensor
    Echo = Echo output of Sensor
    GND = GND

    Sensor Spec:

    I’ve been googling but couldn’t find any tutorial or similar. I’m new to Omega and would highly appreciate a little help to get started.

    Thanks in advance!

  • @freizeitnerd
    Hmm, seems like reading 5V inputs ain't a good idea.

    "Warning: Connecting a signal to an input pin below the minimum LOW or above the maximum HIGH voltages may damage your Omega!

    Standard 5V logic devices typically accept 3.3V as a logical HIGH, however, they output logical HIGH in the range of 4.4V to 5V. This means that the Omega can output to a 5V logical device, but input from the 5V logic device would damage the GPIO input circuitry."

  • Probably late answer but if somebody is searching like I was :)
    One of the solution is to use HC-SR04+ version (support 3.3v)
    I have tested it on my Omega2+ and it works fine. Or if you already have 5v version just use resistors (plenty examples on net). I played little bit with c++ using Patryk27 Omega2-GPIO library. You can check my code and compiled app at github:. I'm still playing with this script.

Log in to reply

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.