Main Site Documentation

Problem w/Multiple Maxsonar maxbotix EZ1 device on same system


#1

I am not sure what I missing, but I have been trying to wire multiple maxbotix EZ1 devices on the same system, but so far not successful their readings are so unusable.

have anyone try to put multiple maxsonar maxbotix EZ1 devices on the same system? according to my research they should work fine with Sequentially Read method, read sensor 1, wait or 50ms read sensor 2, etc. but that clearly didnt work for me. I couldn’t get it run produce stable readings regardless whose driver I use MarkH’s, GHI’s.

I have not try the diasy chain method describe here yet. but why shouldnt it work with seq read?




        public static int getSensorReading()
        { 
           IDistanceSensor sensorC7 = new MaxBotixAnalogue((AnalogIn.Pin)FEZ_Pin.AnalogIn.An7, MaxBotixAnalogue.SupplyVoltage.FiveVolt);
           IDistanceSensor sensorC6 = new MaxBotixAnalogue((AnalogIn.Pin)FEZ_Pin.AnalogIn.An6, MaxBotixAnalogue.SupplyVoltage.FiveVolt);

          //FEZ_Components.Maxbotix sensorC7 = new FEZ_Components.Maxbotix(FEZ_Pin.AnalogIn.An7, FEZ_Components.Maxbotix.MaxbotixSensorType.LV_EZx_5V);
          //FEZ_Components.Maxbotix sensorC6 = new FEZ_Components.Maxbotix(FEZ_Pin.AnalogIn.An6, FEZ_Components.Maxbotix.MaxbotixSensorType.LV_EZx_5V);

            double left  = 0;
            double right = 0; 
            right = sensorC6.GetDistanceInCM();
            sensorC6.Dispose();

            Thread.Sleep(50); //interfere prevention
            left = sensorC7.GetDistanceInCM();
            sensorC7.Dispose();

the weird thing is if I have one sensor 1 hook up to An6 port it works just fine, but as soon as I plug the sensor 2 wire into An7 (even not being used) reading starts going banana


#2

This is the type of readings as soon as i plug another unused EZ1 onto the system

L: 0.00, R: 215.13
L: 0.00, R: 225.69
L: 0.00, R: 220.09
L: 0.00, R: 222.69
L: 0.00, R: 221.34
L: 0.00, R: 220.30
L: 0.00, R: 219.65
L: 0.00, R: 217.31
L: 0.00, R: 216.87
L: 0.00, R: 224.31
L: 0.00, R: 221.65
L: 0.00, R: 180.22
L: 0.00, R: 125.89
L: 0.00, R: 83.70
L: 0.00, R: 58.55
L: 0.00, R: 98.60
L: 0.00, R: 62.81
L: 0.00, R: 221.76
L: 0.00, R: 215.33
L: 0.00, R: 217.96
L: 0.00, R: 220.82
L: 0.00, R: 219.05
L: 0.00, R: 220.02
L: 0.00, R: 221.13
L: 0.00, R: 221.11
L: 0.00, R: 213.88
L: 0.00, R: 203.71
L: 0.00, R: 150.60
L: 0.00, R: 106.51
L: 0.00, R: 65.99
L: 0.00, R: 117.62
L: 0.00, R: 76.91
L: 0.00, R: 208.99
L: 0.00, R: 218.51
L: 0.00, R: 221.52
L: 0.00, R: 222.04
L: 0.00, R: 218.90
L: 0.00, R: 219.16
L: 0.00, R: 220.17
L: 0.00, R: 219.44
L: 0.00, R: 225.79
L: 0.00, R: 214.58
L: 0.00, R: 172.78
GC: 3msec 20784 bytes used, 43596 bytes available
Type 0F (STRING              ):     96 bytes
Type 11 (CLASS               ):   4788 bytes
Type 12 (VALUETYPE           ):     36 bytes
Type 13 (SZARRAY             ):    408 bytes
Type 15 (FREEBLOCK           ):  43596 bytes
Type 17 (ASSEMBLY            ):  10296 bytes
Type 18 (WEAKCLASS           ):     48 bytes
Type 19 (REFLECTION          ):     24 bytes
Type 1B (DELEGATE_HEAD       ):    144 bytes
Type 1D (OBJECT_TO_EVENT     ):    168 bytes
Type 1E (BINARY_BLOB_HEAD    ):    348 bytes
Type 1F (THREAD              ):   1152 bytes
Type 20 (SUBTHREAD           ):    144 bytes
Type 21 (STACK_FRAME         ):    660 bytes
Type 22 (TIMER_HEAD          ):     72 bytes
Type 27 (FINALIZER_HEAD      ):   1296 bytes
Type 31 (IO_PORT             ):    216 bytes
Type 34 (APPDOMAIN_HEAD      ):     72 bytes
Type 36 (APPDOMAIN_ASSEMBLY  ):    816 bytes
L: 0.00, R: 100.27
L: 0.00, R: 82.01
L: 0.00, R: 137.43
L: 0.00, R: 98.71
L: 0.00, R: 218.61
L: 0.00, R: 217.13
L: 0.00, R: 216.06
L: 0.00, R: 219.44
L: 0.00, R: 221.68
L: 0.00, R: 218.32
L: 0.00, R: 218.74


#3

I wouldnt be able to look at this until thursday night Hai, have you tried the RS232 serial? That’s meant to daisychain (make sure you use a TTL-232 converter!)


#4

Mark,

I affraid I don’t know how use TTL-232, really i dont know what the purpose of TTL-232
I am going to try to wire this to netduino and see if the issue occurr there as well.

-thanks


#5

do you happen to have a MAX232 IC around? that will convert RS232 to TTL serial (so you can use the SerialPort class)


#6

Mark,
No i dont have MAX232 IC at all.

BTW: same issue found on netduino plus, do you think this IC will definitely eliminate the issue or is it still a try-and-see type of recommendation, because i am pretty eager to get these sensors work correctly on my robot

thanks!


#7

Hai, I think you need to modify your circuit. Look at maxbotix FAQ http://www.maxbotix.com/MaxSonar-EZ1__FAQ.html Daisychaining is queation 6f. There is 3 ways to do the job you want.

In general, errors in reading occurs because both of sensors are measuring at the same time and inerference at each other. Your sensors measuring all the time and you just read them with gap. You can put both of sensors in oposite direction and I’m sure your readings will be just fine with what you have now.

Cheers


#8

Just a general comment on diagnosing this kind of issue where you’re not sure if an electrical sensor “should work”… I always try to make sure I test a sensor on both pins individually to make sure I get results I expect before tring to combine them. That way you know they both work individually and the observations you make are just from the combination process.


#9

I’ve been using 2 Maxbotix sensors on an Arduino board in the Daisy Chaining mode with Constantly Looping, as described in the FAQ and this pdf. Thats works great, sequential reading doesn’t work. You’ll need sensors with newer firmware (marked with a brown dot).


#10

Brett ,
Done that so many times.

RobotFreak,
I look that site yesterday too and that was how I started with Sequential Read. The reason I didn’t start doing Diasy Chain method because one of the methods it suggested was sequential read, as ALWAYS WORK, though it didn’t work for me and you.

Another reason was because, I was not quite understand what the statement below refering to, is it handled by software? if so do you have a sample code for this?

Hold the RX pin
high for more than
20uS and up to
400uS. Do not
continuously leave
this pin high, as
then all of the
sensors will free

Also “Wire BW to logic High” to logic high is to where? to to a 3.3V?
Thanks


#11

Here is the schematic for my setup. Remember I did this with an Arduino.
The problem I see, with a FEZ device, is the 20 µs delay. I can only show you the Arduino code (will take a while to find it). BW is connected to VCC (5V).


#12

RobotFreak,
This helps. Thanks You!


#13

Found the Arduino code for the Maxbotix initialization:


void initMaxbotix(void)
{
  // init Maxbotic sensors
  pinMode(strobePin, OUTPUT);
  digitalWrite(strobePin, HIGH);
  delayMicroseconds(20);
  digitalWrite(strobePin, LOW);
  pinMode(strobePin, INPUT);
  delay(250);  
} 

For porting to FEZ I would suggest to use a tristate Port. Only problem, I don’t know how to make a 20µs delay in .NET :frowning:


using System;
using System.Threading;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;

namespace FEZ_Domino_Application1
{
    public class Program
    {
        static void MakePinOutput(TristatePort port)
        {
            if (port.Active == false)
                port.Active = true;
        }
        static void MakePinInput(TristatePort port)
        {
            if (port.Active == true)
                port.Active = false;
        }
        public static void Main()
        {
            // initialize Maxbotix sensors for Daisy Chaining with Constantly Looping
            // see http://www.maxbotix.com/uploads/Chaining_Application_Notes__AN_Output_Constantly_Looping_.pdf
            TristatePort StrobePin = new
            TristatePort((Cpu.Pin)FEZ_Pin.Interrupt.Di2, false, false,
            Port.ResistorMode.Disabled);
            MakePinOutput(StrobePin);// make pin output
            StrobePin.Write(true);   // set ppin HIGH
            // todo: wait for 20µs
            StrobePin.Write(false);  // set pin LOW 
            MakePinInput(StrobePin); // make pin input
            Thread.Sleep(250);       // wait for sensor stabilisation  
            while (true)
            {
                // todo: read Maxbotix sensors
                Thread.Sleep(500);
            }
        }

    }
}


#14

I think that is 20uS minimum but it can be more. So just set pin high and low with no delay and you will be fine. No need for delay since calling native methods will take about 10uS. If it didn’t work then you can read the system tick to create delays


#15

How about using OutputCompare()? :stuck_out_tongue:


#16

Thanks Guys,
I am wiring it now, will see if it works,

Thanks!


#17

I have good news to you All.

It is the first time in a very, very, very , very , very , very , very , very , very , very , very ,very, very , very , very , very , very , very , very , very , very , very long time since I see a real stable reading on these sensors. Though my testing was caried out on NetDuino Plus board, due to my FEZ mini being hookup to the robot, after this test I will disemble the sensors and wire them to FEZ mini and see if everything still be OK.

Thank You for all your helps especially RobotFreak. Thanks for the code and nice the diagram.

updated:
seems works fine on FEZ as well. for your information, for some reasons I could not get these sensors work with 5V, (both on FEZ and NetDuino) they work fine on 3.3V