LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Addressing of multiple Arduinos over RS485 half-duplex [UPDATE]

Hello Everyone!

I'm quite new to LV and LIFA and for my project at the university I would like to connect 5 (later 10 arduinos) running LIFA to one .vi-File over RS485 (half-duplex).

Until now I successfully could read one arduino transmitting over RS485  with the VISA package only. With LIFA it wasn't working probably due to the half-duplex setup.

My UNO was connected through the pin 0 (RX), pin 1(TX) and pin 2 (change of the transmission mode) to the MAX481 chip which was connected to an isolated RS485/USB converter (EX9530) which is connected to my PC running LV 2011.

The idea is to be able to send and receive data from various arduinos over RS485 (half-duplex) . Time isn't so crucial.

I would really appreciate if you could give me some opinions if this idea is realizable? Also with one vi.file?

Would it be working with LIFA if I modify the LIFA_Base.file or LABVIEWInterface.file  with an extra address command and an extra command for the change of the transmission mode (From RX to TX and back to RX-Mode)?

Any recommendations where I should put those?

I'm looking forward to your recommendations!
Cheers, Matt

0 Kudos
Message 1 of 5
(6,628 Views)

An alternate approach for connecting multiple Arduinos to Labview is to use I2C instead of RS485.  See:

<http://hacknmod.com/hack/how-to-connect-multiple-arduino-microcontrollers-using-i2c/>

hrh1818

0 Kudos
Message 2 of 5
(4,267 Views)

Hi hrh1818,

thank you very much for your message.

I was also thinking about I2C, but in my design I forgot to mention that each arduino has to be galvanic isolated, i.e the communication over the MAX481 chip will be isolated and each arduino will get his own power supply and ground. Besides each of the arduino will have his own I2C - DAC.=)

But still thanks for the links! It will help me to establish the connection between arduinos and I2c-DAC shields.=)

0 Kudos
Message 3 of 5
(4,267 Views)

Hi,

I would like to post my LIFA code specified for RS485 half duplex communication and the modified .vis.

I did following changes to the codes and unfortunatelly I cannot get any response from my Arduino. The Send Receive.vi seems not getting any data in Labview or serial monitor from the Arduino when the correct ID is selected.

In the LIFA_Base.ino, I included following variables and functions:

  1. const int ArduinoID = 5; which should provide me an unique Arduino ID. Would it be better to put it in the header file?
  2. within the void loop()

          int rx2txPin = 2; // defines the  transmission PIN

           pinMode(rx2txPin,OUTPUT); // here or in the header file?

           digitalWrite(rx2txPin, LOW); // => receiving mode of the MAX481 Chip

In the LabViewInterface.ino I add following:

  1. I had once again to add  int rx2txPin = 2;
  2. The 15 byte structure has been changed by an address byte after the header byte; command[1] has been changed to command[2]=command byte and so on with the other commands.
  3. if(command[0] == 0xFF && command[1] == 0x05 && checksum_Test(command) == 0)

          If received ArduinoID=0x05 is correct, the arduino should continue; if it is wrong should do nothing.

    4.  To every command from the Serial.class (flush, write, print) inspite of Serial.available() I've attached following commands in the following structure:

         digitalWrite(rx2txPin, HIGH); /Enables the SEND MODE of PIN 2

        Serial.flush();

        delaymicroseconds (207);  //Arduino needs to wait until the transmission is complete before changing the transmission mode

                                                       // wait 2 characters: 1/9600=104,16us => 209us

        digitalWrite(rx2txPin, LOW); // Back to the listening mode

Within Labview I did following changes:

  1. New command for the choise of the Arduino ID (ID from 0 to 9)
  2. In the Packetize.vi I included the Arduino ID at the index 1; data is  from the index 2 to 13
  3. All other vi.s have been extended with the Arduino ID where it was needed; Mainly in the folders: LOW LEVEL, UTILITY + Init.vi

Do you see errors in the arduino addressing procedure or code?

Why is arduino not answering?

Here the Link to my modfied LIFA files:
https://www.dropbox.com/sh/tcst317gla2fz2l/PW9xjPrKNG

0 Kudos
Message 4 of 5
(4,267 Views)

I try to connect a couple of Arduino via RS485. I have read many posts, but the discussion often ended without success. The slaves should send the measurements to the master and then evaluate over Labview. Does it make sense to program the master so that it appeals to the slaves and collects the information, or is it easier to solve it with Labview (The Management). I also read a lot about the Modbus, would this be possible ?
It would be great if someone could help me or give me an advice.

0 Kudos
Message 5 of 5
(4,267 Views)