Connect with us

controlling hc-sr04 more than one at the same time

Discussion in 'General Electronics Discussion' started by ikhsanrino, Apr 15, 2016.

Scroll to continue with content
  1. ikhsanrino

    ikhsanrino

    8
    0
    Jan 9, 2016
    hello guys, i have a project related with ultrasonic sensor, i have no problem when i control just one sensor. but when i start to control more than one hcsr04 sensors it doesn't work simultaneously . what i want to do is the all of the sensors generate the ultrasonic wave and receive the echo at the same time. when i put something in front of #UltrasonicSensor 1 so the buzzer1 will ring, when i put something in front of #UltrasonicSensor2 then buzzer2 will ring and if i put something in front of them all buzzer will ring together. if you guys dont mind please check the pic of my code , if you find any mistakes or have any idea to help me ,it we'll be really good and i appreciate a lot. thanks guys, if you still dont understand what i mean just comment or PM me thanks a lot
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      10 KB
      Views:
      93
    • 2.PNG
      2.PNG
      File size:
      10.6 KB
      Views:
      112
    • 3.PNG
      3.PNG
      File size:
      11.3 KB
      Views:
      83
    • 4.PNG
      4.PNG
      File size:
      12 KB
      Views:
      73
  2. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    Please explain what your code is suppose to do. And what in particular is not working?
    Adam
     
  3. ikhsanrino

    ikhsanrino

    8
    0
    Jan 9, 2016
    what i want to do is make the two sensors work simultaneously, when the first sensor generate the ultrasonic wave the second generate ultrasonic wave too. with current code, it works alternately. and i want when there is an object in front of sensor1, then buzzer1 will ring, if the object in front of sensor2 then buzzer 2 will ring, and i the object is in the middle of both sensors, then both buzzer will ring. my code still cant control like that , that's the problem. thanks for your comment i appreciate it alot
     
  4. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    What sensors are you using? Do you have a data sheet?
    Thanks
    Adam
     
  5. ikhsanrino

    ikhsanrino

    8
    0
    Jan 9, 2016
    i use HC-SR04 sensor mate, and the data sheet on this pic
     

    Attached Files:

    • 5.PNG
      5.PNG
      File size:
      78.5 KB
      Views:
      69
    • 6.PNG
      6.PNG
      File size:
      152.5 KB
      Views:
      95
  6. Arouse1973

    Arouse1973 Adam

    5,165
    1,087
    Dec 18, 2013
    Have you tried to put a delay between the two measurments, say 1 second.
    Adam
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-