From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Arduino addressing

Is there any function in LIFA_Base to assign different addresses or IDs to a set of  different Arduinos connected to Labview over USB?. I would like to connect more than one Arduino to labview and then have labview retrieve the ID of each Arduino on different com ports.  Also if there is a function to do this will the Arduino keep its ID on a restart? Also is there a reference on LIFA_Base explaining its functionality for someone who knows no C programming

0 Kudos
Message 1 of 14
(6,244 Views)

This is not natively implemented but you can do it.  I did it for one of my projects so that I could have two Ardunios and alwayw know which is which.  I created a new LIFA function that sends an integer back to LabVIEW.  This integer was changed before uploading it on to the individual Arduinos.  So, I changed the value to 1 for the first Arduino and uploaded it.  Then I changed the value to 2 and uploaded to the second Arduino.  Finally, you use the LabVIEW VI that you create to retrieve that value.

I think I posted my code here somewhere for an older version of LIFA.

0 Kudos
Message 2 of 14
(4,542 Views)

A "one LIFA_Base fits all" solution would would be to wire in something along the lines of a hex switch to the Digital I/O and then have the Arduinos report the encoded value back to LabView.

0 Kudos
Message 3 of 14
(4,542 Views)

Ooo . . I like this idea.  Good suggestion jbliss.  Something like this would work.

0 Kudos
Message 4 of 14
(4,542 Views)

Nathan don’t know c yet so this could be a little tricky for me. I was thinking I will try to change the firmware name to a different name for each arduino. I should be able to get LV to tell me what to look for in the code then make a make the change there and retest with LV and see if it responds to my change. I will test this and get back with my findings as soon as my boards get here which shouldn’t be long.

jbliss yes that was my fall back option, I was thinking dip switches but the encoder would make life a lot simpler, this is a option on something like a mega but on a mini or uno resources are a little tighter but still definitely still viable

0 Kudos
Message 5 of 14
(4,542 Views)

Hey Nick!

After spending one week on trying to get it fixed, it´s kinda easy

you just have to change the LabVIEWInterface as i did.

/*********************************************************************************
** LIFA Maintenance Commands
*********************************************************************************/
case 0x00: // Sync Packet
  Serial.print("sync1");
  Serial.flush();   
  break;
case 0x01:// Flush Serial Buffer 
  Serial.flush();
  break;
 

I just changed the Serial.print to "sync1". Have a look at the picture!

In order to identify the Arduinos, i made a VI.arduLIFAreadID.PNGlifa.PNG

0 Kudos
Message 6 of 14
(4,542 Views)

Hi michi_ries!

I wonder if what you did can work in multiple arduino connected through Xbee?

I have 3 arduinos, each having Xbee and would send their data to the coordinator. Would this also work?

0 Kudos
Message 7 of 14
(4,542 Views)

The changes that he made, is only for identifying the Arduino uniquely.  Each Arduino still requires it's own COM port.

0 Kudos
Message 8 of 14
(4,542 Views)

That would require 3 Xbees in coordinator. Are there any option that I can use?

0 Kudos
Message 9 of 14
(4,542 Views)

Correct.  I don't know.  I'm waiting on hrh1818 to respond in the other thread since I'm not all that familar with xbee.  So, I would probably just wait until he says something in that thread.

Message 10 of 14
(4,542 Views)