LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Arduino ID with Labview

Hello,

I am trying to read the ID of my Arduino UNO boards using Labview, but I can not find the right way how to do that.

I tried sending a "*IDN?" command, but I am getting errors.

Does anybody know how can I read the ID of an Arduino board using Labview?

Thanks,

0 Kudos
Message 1 of 9
(5,959 Views)

*IDN? is a GPIB command and is not supported by the Arduino.

-Sam K

LIFA Developer

0 Kudos
Message 2 of 9
(4,569 Views)

I appreciate your indication Sammy_K.

But how can I read the ID of an Arduino board using Labview?

0 Kudos
Message 3 of 9
(4,569 Views)

What are you wanting to use the ID for?  In my project, I needed to initiate two arduinos and identify them uniquely so that the correct functions were sent to each.  So, what I did was made a custom LIFA function that would return an ID that I hardcoded in each of the firmwares.  It was actually quite simple.  I used the same firmware for both but I had a #define ARDUINO_ID or something near the top that I changed for each of the Arduinos.  We had a total of 8 arduinos and each had it's own ID from 1 to 8.

0 Kudos
Message 4 of 9
(4,569 Views)

Thanks Nathan_B.!

The application that I will do is quite the same as what you wrote. I need to connect several Arduino's to a computer. Each Arduino has a different functionality (some turn on LEDs, some move motors...) and I want to control them with the same Labview program. The problem is that when I connect more things the Arduinos are changing of port and I don't want to look to it everytime.

What I want is that when I connect the Arduinos to the computer the program looks wich is the right Arduino (reading the ID of each). In this case you will always control the right one.

So, I'm only interested in a way that the Labview can read the ID of each Arduino to use the right one everytime.

I'm not that expert. The problem that I have is that I don't know how can I create this LIFA to read the ID of the Arduinos. I can imagine that you have to send a command with a Visa write block and then Read what is on the bus, but wich commands do I have to use for that?

What I tried is to add the "#define ARDUINO_ID 1" to the LIFA_Base in the LabWIEWInterface.h tab. I loaded it in the Arduino without errors. Is that correct? But now, how can I read the ID from the Labview?

Can you send me a more detailed mail with the procedure that I have to follow?

Thanks,

0 Kudos
Message 5 of 9
(4,569 Views)

Below is what I wrote for this.

Notes:

  • You will need to update the code for the latest IDE because this is written to run on Arduino 0022 or 0023 (Using anything newer meant that we couldn't use 115200 for the baudrate with the Mega2560 sadly).
  • There are no longer .pde files and are now .ino files.
  • You will need to change the command value in both LabVIEW and the firmware (so that match) to a value that is unused.

LabVIEWInterface.h

// Arduino Identity
#define ARDUINO_ID 5

LabVIEWInterface.pde (inside of "switch(command[1])")

case 0x20: // Identify Self
     Serial.print( (unsigned char)ARDUINO_ID, BYTE);
     break;

Get Arduino Identity.vi

GetArdunioIdentity.png

0 Kudos
Message 6 of 9
(4,569 Views)

Thank you Nathan_B.!!

You solved the problem I had. I followed this steps and it is working perfect!

0 Kudos
Message 7 of 9
(4,569 Views)

If you mark my post as "the answer" it will be easier for others to find it when searching for similar issues that you were having.

0 Kudos
Message 8 of 9
(4,569 Views)

Sorry, but I can not find the option to mark it as "the answer". It does not appear below the messages.

0 Kudos
Message 9 of 9
(4,569 Views)