Multiple Ultrasonic Distance Sensors SRF05

The final aim is to produce a 3D trace of xyz co-ordinates in a cad program, using 3x SRF05 sensors on UNO v3 with an adaption of Rob Tillaart's code. Picture a tetrahedron with three ultrasonic detectors at known x,y,z co-ordinates on a ground plane (z=zero) and an ultrasonic emitter tracing a free form locus in the air above the ground plane. Maths for the fourth vertex of the tetrahedron can be derived from the u,v,w formulars in geometry - Finding the coordinates of the fourth vertex of tetrahedron, given coordinates of "base" vertices and the distances to them - Mathematics Stack Exchange

The specific problem - How to trigger one ultrasonic emitter that's tracing the free form locus and read its distance from the three US detectors on the ground plane. The electronics of the SRF05 modules doesn't lend itself to altering this -

SRF05 SRF[3] = {
// SRF(trig, echo)
  SRF05(4, 5),
  SRF05(6, 7),
  SRF05(8, 9)
};

to this -

SRF05 SRF[3] = {
// SRF(trig, echo)
  SRF05(4, 5),
  SRF05(4, 7),
  SRF05(4, 9)
};

Advice please - Would this need an adaption of the code, or could it be better solved by removing the three emitters and rewiring a single emitter to all three modules, maybe with diode separation?

//  Based on Tillaart's code
//  FILE: SRF05_demo.ino
//  AUTHOR: Rob Tillaart
//  PURPOSE: demo distance sensor
//     URL: https://github.com/RobTillaart/SRF05

#include "SRF05.h"

#define sensors 3

SRF05 SRF[sensors] = {
// SRF(trig, echo)
  SRF05(4, 5),
  SRF05(6, 7),
  SRF05(8, 9)
};

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.println(__FILE__);
  Serial.print("SRF05_LIB_VERSION: ");
  Serial.println(SRF05_LIB_VERSION);
  Serial.println();
  for (uint8_t i = 0; i < sensors; i++) {
    SRF[i].setCorrectionFactor(1.035);
  }
}

void loop() {
  for (uint8_t i = 0; i < sensors; i++){
    Serial.print(SRF[i].getTime());
    Serial.print("\t");
    Serial.print(SRF[i].getMillimeter());
    Serial.print("\t");
  }
  Serial.println();
  delay(500);
}

//  -- END OF FILE --

Doesn't it? What makes you say that?

Did you try it and what was the result?

1 Like

Post an annotated schematic showing how you connected this.

How would three sensors listen at the same time to the same echo? I would use three sensors and time-share their use.

@PaulRB - I tried triggering one unit and reading the echo on another and it gives zero. Both units work ok when reading the echo of their own unit.

@xfpd - Timeshare like this -

void loop() {
  for (uint8_t i = 0; i < sensors; i++){
    Serial.print(SRF[i].getTime());
    Serial.print("\t");
    Serial.print(SRF[i].getMillimeter());
    Serial.print("\t");
  }
  Serial.println();
  delay(500);
}

@gilshultz - Units A, B, C are on the ground plane. Unit D floats above them. For the test this

SRF05 SRF[sensors] = {
// SRF(trig, echo)
  SRF05(4, 5),
  SRF05(6, 7),
  SRF05(8, 9)
};

was altered to this -

SRF05 SRF[sensors] = {
// SRF(trig, echo)
  SRF05(2, 5),
  SRF05(2, 7),
  SRF05(2, 9)
};

Hi, @feraltek

What sort of resolution do you expect?
What is the beam width of the SRF05 ?

Have you just tried the data from ONE SRF05 and plotted it on your CAD to see what measurements you get?

What you propose to do is usually done with laser based equipment.

Tom... :smiley: :+1: :coffee: :australia:

Did you trigger the second unit at the same time you triggered the first so it would know to listen for an echo and set it's output when the echo arrived?

2 Likes

Does it have to be ultrasonic, which is directional?

Could the sound be audible? A tick heard by electret microphones for example? Those are very sensitive, it would not have to be loud. if a flash of light were emitted at the same moment as the sound or nearly so (led flash generated by a piezo disk being struck to make the tick) then light detect could serve as a synch signal to any number of detector/timer MCU's.

Wouldn't a laser have a much more narrow beam? How would three lasers track a moving point in space?

You could wire all the triggers to the same pin and read one with the library and read the durations of the other echoes directly with micros(). You’d need to disable the emitters on the other sensors

I don't know C++ enough to do that, but it sounds like a solution. The emitter at the point in space travels in one direction to the detector while the emitter on the detector travels twice as far - that would help differentiate between the two.

Thanks. I'll think about that.

That's probably the easiest suggestion for me to test. Thanks.

Muffle the 2 unwanted emitters with a wad of cotton or foam rubber, if the trigger current is less than 10 mA (?), connect all trigger pins to the same Arduino output pin.

1 Like

You didn't say the object was moving.
What EXACTLY are you trying to do?

How big is your object?
What range is your object from the SRF05s?

Please post a diagram of how you envisage positioning your SRF05s with respect to the object in space.

Again, what resolution are you aiming for?

Tom.. :smiley: :+1: :coffee: :coffee: :coffee: :australia:

Like this.

Yours triggers and reads them in sequence just like the code I used. But it misunderstands what I want. I want to trigger the emitter on D and read it via the detector on A, then emit on D and read on B, then emit on D and read on C - all three in quick succession. I haven't had a chance yet to try a couple of the suggestions.

One project is to construct some cabinets that fit neatly to the curved inside of my small teardrop caravan. Resolution of up to +/- 1cm would be ok because a NURB curve plotted through the points in Rhino 3D CAD will smooth out inconsistencies.

And a few other potential projects that don't require mm accuracy or resolution.

HI,
Why don't you horizontally scan with one SRF05 and a servo.
Move the assembly up or down to produce a layer of scans to build up a picture.

Not sure of the precision of your readings with 15deg beam width on a concave surface.
Many reflections.

Tom... :smiley: :+1: :coffee: :australia:

No reflections. The aim (again) is to have an emitter following the locus of the shape, being read by three ground plane detectors. Four units forming an irregular tetrahedron.