LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview-Arduino I2C error 5003

Hi,

I am new to Arduino and Labview and I have an Arduino Mega and Uno that are communicating with each other using I2C. The Uno is sending data to the Mega. The communication worked when I use serial monitor to read from Mega, however when I upload the LIFA firmware to the Mega  and try and use Labview to read the data that the UNO is sending it gives me 5003 timeout error. I have tried to increase the time out but it still doesn’t work. Does anybody know what I am doing wrong? I have also attached the Uno sketch and  the Labview VI I am using. I would be grateful if anyone can help.

Download All
0 Kudos
Message 1 of 11
(14,087 Views)

You have to use the same baud rate in LabVIEW and what is in the LIFA firmware.  If you are using the latest version then you need to use 9600 and not 115200 for the Arduino Mega 2560.

0 Kudos
Message 2 of 11
(7,037 Views)

Nathan,

Thanks for your help, I changed the baud rate to 9600 but I am still getting the 5003 error which is due to a timeout while trying to read from Arduino.

0 Kudos
Message 3 of 11
(7,038 Views)

I added a 7 in : Wire.begin(7); // join i2c bus (address optional for master) in my code and I also changed the 4 to 7 in my VI for the I2C read block. It looks like I am reading something but now I am only reading 255!!!

0 Kudos
Message 4 of 11
(7,038 Views)

I have the same setup and the labview get only the last byte

any suggestions?

Thanks

my skech:

#include <Wire.h>

#include <SHT1x.h>

#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5,6,7);

// Specify data and clock connections and instantiate SHT1x object

#define dataPin  10

#define clockPin 11

SHT1x sht1x(dataPin, clockPin);

int x=0;

float temp_c;

  float temp_f;

  float humidity;

int t;

int h;

void setup()

{

lcd.begin(20,4);

lcd.print("starting program");

delay(1000);

lcd.clear();

  Wire.begin(2);                // join i2c bus with address #2

  Wire.onRequest(requestEvent); // register event

}

void loop()

{

  // Read values from the sensor

  temp_c = sht1x.readTemperatureC();

  temp_f = sht1x.readTemperatureF();

  humidity = sht1x.readHumidity();

t=temp_c;

h=humidity;

  lcd.setCursor(0, 1);

  lcd.print("Temp:");

lcd.print(temp_c);

   lcd.setCursor(0, 2);

  lcd.print("Humidity:");

lcd.print(humidity);

  delay(100);

}

// function that executes whenever data is requested by master

// this function is registered as an event, see setup()

void requestEvent()

{

Wire.write(t); //

Wire.write(h); //

        // as expected by master

}

0 Kudos
Message 5 of 11
(7,038 Views)

Hi All,

I am currently trying to do the same kind of thing ... But I got a problem ..

You can find the VI I use in screenshot below..

The problem is that I always have this error code : 5003 : LabVIEW Interface for Arduino.lvlib:I2C Read.viLabVIEW Interface for Arduino.lvlib:I2C Init.viLabVIEW Interface for Arduino.lvlib:Init.vi.  A timeout occurred while trying to read form the Arduino.

What can my problem be ? I have already tried to change the baud rate to 9600 both in the arduino soft and in tha VI, but no change, still got this error code ..

The problem can't be coming from the wiring since I've tried to transmit datas between the two arduinos with the Arduino soft and it is alright (viewing with the serial monitor such as cutluss did).

Any advice ?

Thank for your help,

BRs,

OscarVI_reception.png

0 Kudos
Message 6 of 11
(7,038 Views)

Do you ever use the "abort execution" button in LabVIEW? (the little red stop sign).

P.S.  soft???

P.P.S. Avoid using the abort execution button as much as possible when using LIFA.  Using the abort execution button between the init and close VIs may prevent the COM port from being release properly and you will get a timeout error after this happens.  When this happens, you may need to completely close LabVIEW (including the splash screen) and then re-opening your VI.  (this is based on my experience and learning this the hard way ).

0 Kudos
Message 7 of 11
(7,038 Views)

YES

AMAR CHAVAN
09665018779
09404018779
0 Kudos
Message 8 of 11
(7,038 Views)

Old thread but just to add. Try chaning one of the board that can be faulty. As I got similar problem with ADXL345, when uploaded sketch it was reading all 3 axis but not correct on "serial monitor" arduino software, but when I uploaded LIFA firm trying to comminucate in labview via I2C, I was getting same error as you do.

Replacing the ADXL345 solved all the problem !

0 Kudos
Message 9 of 11
(7,038 Views)

This program stops working when I put to read higher values of 1. When the reading value is zero (0) it works without error

0 Kudos
Message 10 of 11
(7,038 Views)