Ultrasonic sensor accuracy

For my project I am using five ultrasonic sensors at a distance of 35cm each, to monitor a users walk, each sensor is only supposed to take two readings for the users two legs, as of right now the sensors are picking up multiple readings. I have narrowed the sensors beam width by putting a 2.5cm tube on the receiver sensors it worked on a singular sensor but when put on the full device multiple readings are picked up again.

so I have two questions

Does anyone have any suggestions on how to optimise the sensors so they only pick up two readings each?

Is there a way to turn each sensor off after it has picked up two readings? turning them all back on and doing it two more times?

The code i am currently using (it works)

#include "SR04.h"
#define TRIG_PIN 12
#define ECHO_PIN 11


//SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN);

SR04 sensor1 = SR04(11,12);
SR04 sensor2 = SR04(8,9);
SR04 sensor3 = SR04(6,7);
SR04 sensor4 = SR04(5,4);
SR04 sensor5 = SR04(3,2);

long a;
long b;
long c;
long d;
long e;

void setup() {
   Serial.begin(9600);
   delay(1000);

  Serial.println("Hello World");
}

void loop() {
   a=sensor1.Distance();
   b=sensor2.Distance();
   c=sensor3.Distance();
   d=sensor4.Distance();
   e=sensor5.Distance();

    Serial.print(millis());
    Serial.print(", ");
   
   //Serial.print("Sensor 1 ");
   Serial.print(a);
   Serial.print(", ");
   //Serial.print("cm  ");
  
   
   //Serial.print("Sensor 2 ");
   Serial.print(b);
   Serial.print(", ");
   //Serial.print("cm  ");


   //Serial.print("Sensor 3 ");
   Serial.print(c);
   Serial.print(", ");
   //Serial.println("cm");


   //Serial.print("Sensor 4 ");
   Serial.print(d);
   Serial.print(", ");
   //Serial.println("cm");

 
   //Serial.print("Sensor 5 ");
   Serial.print(e);
   Serial.println(", ");
   //Serial.println("cm");
   
   //delay(1000);

   
}

Give echoes time to die down, don't try to take readings of different sensors in too quick succession. 10-100 ms is usually what's needed, depending on the environment, how echoe-y it is.

Remember, each time you command the transmitter, it send 8 pulses and then waits for the first echo return. The remaining sound pulses are still out there!
Paul

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.