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 --