MaxSonar Daisy Chaining

Hi all,

I'm working on using the Maxsonar Sensors, in this case EZO to position people in a space and send details to processing to play instruments based on the position.

I'm getting inconsistent readings which i think could be due to the fluctuations coming from sensors interfering with each other or insufficient power.

I've set up the sensors to be chained rx to tx as suggested in the below pdf, but my electronics knowledge isn't great and i'm not sure if I'm wiring things in the right place and if with multiples of these sensors I need an external power source as too much current is flowing out through ground when resistance is low.

http://www.maxbotix.com/documents/LV_Chaining_Constantly_Looping_AN_Out.pdf

Based on the diagrams In these recommendations pdf, i'm using 5v and ground from the board, digital pin 6 to pulse the rx and then reading using analog pins 0 and 1. I'm pulling BW high with the 5v too from the arduino.

The reason I wonder about current is that the reading are consistent up until about 1 meter. i.e, accurate but once it goes beyond that one sensor always drops back. I could run the sensors with 12v and resistors/ transistor to pull it down.

int ultraSoundSignalPins[] = {0,1}; // 2 Ultrasound signal pins 
int ultraSoundTriggerPin = 6;        // output pin to start Ultrasound signals 


void setup() { 
   Serial.begin(9600); 
   for(int i=0; i < 2; i++) { 
       pinMode(ultraSoundSignalPins[i], INPUT); // Switch signalpin to input 
   } 
   pinMode(ultraSoundTriggerPin, OUTPUT); // set this pin to output 
  //give the sensors time to boot up 
   delay(250); 
   // send RX pin high to signal to chain to ping 
   digitalWrite(ultraSoundTriggerPin, HIGH); 
   delayMicroseconds(30); 
   digitalWrite(ultraSoundTriggerPin, LOW); 
   pinMode(ultraSoundTriggerPin, INPUT); // electrically disconnects the pin 
   delay(50); 
} 
void loop() 
{ 
   unsigned long ultrasoundValue; 
   unsigned long echo; 
   delay(50); 
   for(int i=0; i < 2; i++) 
   { 
//Now the values from each sensor can be read: 
       echo = analogRead(ultraSoundSignalPins[i]); //Listen for echo 
       ultrasoundValue = (echo / .58138); 


       Serial.println();
       Serial.print("UltraSound Value");
       Serial.print( ultraSoundSignalPins[i]);
       Serial.print(  "= ");
       Serial.print(ultrasoundValue);
       

       
   delay(500); 
   
   }
  
}

Maxsonar Sensors, in this case EZO

never heard of it, this one???

looks interesting, thanks
datasheet says

G N D – Return for the DC power supply. GND (& Vcc) must be
ripple and noise free for best operation.

probably an understatement, do you best here.
otherwise isolate them accoustically and see if that makes a difference.

good luck with your project!

Describe the environment.

Hey all, thanks for the replies.

The environment physically is a 3m x 3m room at the moment where i'm set up in a corner.

Electronically I'm set up with all power coming from the 5v on the arduino, that includes the 6 wires going to BW as descibed in this pdf
( http://www.maxbotix.com/documents/LV_Chaining_Constantly_Looping_AN_Out.pdf ) and the 6 wires going to PWR on the sensor. I feel sure that I must need more power here, as that seems like a huge ask on the arduino, to tie 6 logic pins high and run a current through 6 sensors to be measured. I'm just not sure how to do it.

I've been through my wiring and made sure that is all tight and neatly soldered everything in place to rule this out as a problem and I'm happy that the wiring (they call it daisy chaining) that I've done for the six sensors matches the recommendation. My code now looks like this:

int ultraSoundSignalPins[] = {0,1,2,3,4,5}; // 6 Ultrasound signal pins 
int ultraSoundTriggerPin = 7;        // output pin to start Ultrasound signals 
int arraysize = 5;  //quantity of values to find the median (sample size). Needs to be an odd number
int rangevalue[] = {0, 0, 0, 0, 0};    //declare an array to store the samples. not necessary to zero the array values here, it just makes the code clearer


void setup() { 
   Serial.begin(9600); 
   printArray(rangevalue, arraysize);
   for(int i=0; i < 6; i++) { 
       pinMode(ultraSoundSignalPins[i], INPUT); // Switch signalpin to input 
   } 
   pinMode(ultraSoundTriggerPin, OUTPUT); // set this pin to output 
  //give the sensors time to boot up 
   delay(250); 
   // send RX pin high to signal to chain to ping 
   digitalWrite(ultraSoundTriggerPin, HIGH); 
   delayMicroseconds(30); 
   digitalWrite(ultraSoundTriggerPin, LOW); 
   pinMode(ultraSoundTriggerPin, INPUT); // electrically disconnects the pin 
   delay(50); 
} 
void loop() 
{ 
   unsigned long ultrasoundValue; 
   unsigned long echo; 
   delay(30); 
   for(int i=0; i < 6; i++) 
   { 
     
     for(int x = 0; x < arraysize; x++){
//Now the values from each sensor can be read: 
       rangevalue[x] = analogRead(ultraSoundSignalPins[i]); //Listen for echo 
//       Serial.println();
//       Serial.print("UltraSound Value");
//       Serial.print( ultraSoundSignalPins[i]);
//       Serial.print(  "= ");
//       Serial.print(ultrasoundValue);
          
   delay(30); 
     }
     
     
     
//     Serial.print("unsorted ");
//   printArray(rangevalue, arraysize);
//   Serial.println();
//   isort(rangevalue, arraysize);
//   Serial.print("sorted ");
//   printArray(rangevalue, arraysize);
//   Serial.println();
     
   // now show the medaian range
    int midpoint = arraysize/2;    //midpoint of the array is the medain value in a sorted array
	//note that for an array of 5, the midpoint is element 2, as the first element is element 0
     Serial.print("median range value for sensor ");
     Serial.print(ultraSoundSignalPins[i]);
     Serial.print(" : ");
     Serial.print(rangevalue[midpoint]);  
    Serial.println();  
   }
   
    Serial.println();
     Serial.println();  
  
} 

//*********************************************************************************
// sort function
void isort(int *a, int n)
		   //  *a is an array pointer function
{
  for (int x = 1; x < n; ++x)
  {
    int j = a[x];
    int k;
    for (k = x - 1; (k >= 0) && (j < a[k]); k--)
    {
	a[k + 1] = a[k];
    }
    a[k + 1] = j;
  }
}
//***********************************************************************************
//function to print array values
void printArray(int *a, int n)
{

  for (int x = 0; x < n; x++)
  {
    Serial.print(a[x], DEC);
    Serial.print(' ');
  }

  Serial.println();
}

and it returns these results currently. Certainly sensors 0-2 should be returning bigger values, I feel like the current running across the other sensors must be impacting on the ability of all sensors to read properly. The only true read in the set is probably that first reading on sensor 0 where it is bouncing back diagonally from the other side of the 3m room. All the sensors are pointing the same way and the environment for this read remained the same through out ( I triggered them with the mouse from the far corner and stood very still.)

median range value for sensor 0 : 394
median range value for sensor 1 : 101
median range value for sensor 2 : 101
median range value for sensor 3 : 103
median range value for sensor 4 : 43
median range value for sensor 5 : 33

median range value for sensor 0 : 184
median range value for sensor 1 : 99
median range value for sensor 2 : 99
median range value for sensor 3 : 101
median range value for sensor 4 : 41
median range value for sensor 5 : 33

median range value for sensor 0 : 166
median range value for sensor 1 : 101
median range value for sensor 2 : 99
median range value for sensor 3 : 101
median range value for sensor 4 : 43
median range value for sensor 5 : 33

median range value for sensor 0 : 155
median range value for sensor 1 : 99
median range value for sensor 2 : 99
median range value for sensor 3 : 99
median range value for sensor 4 : 41
median range value for sensor 5 : 35

median range value for sensor 0 : 169
median range value for sensor 1 : 101
median range value for sensor 2 : 99
median range value for sensor 3 : 94
median range value for sensor 4 : 41
median range value for sensor 5 : 33

median range value for sensor 0 : 183
median range value for sensor 1 : 99
median range value for sensor 2 : 99
median range value for sensor 3 : 101
median range value for sensor 4 : 41
median range value for sensor 5 : 33

median range value for sensor 0 : 178
median range value for sensor 1 : 101
median range value for sensor 2 : 101
median range value for sensor 3 : 101
median range value for sensor 4 : 43
median range value for sensor 5 : 35

m