From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

getting and displaying distance (from SRF05+Arduino) on Labview

Hi,

I'm new to both Labview and Arduino but my project consists in displaying the distance measured by one SRF05 (firstly I'll try with one sensor but then at the end I have 4 SRF05!)

I found a similar topic on the website and there were these questions so I think it might help anyone who would like to answer me :

  • What version of LIFA are you using? I have no LIFA for now. What should I do?
  • What version of LabVIEW are you using? Labview 7.1
  • What version of the Arduino IDE are you using? Arduino 1.0.6
  • What mode does the sensor is running in?  The sensor is running in mode with 4 wires : +5V, ground, trigger and echo

My code is :

#define ECHOPIN 2                            // Pin to receive echo pulse

#define TRIGPIN 3                              // Pin to send trigger pulse

void setup(){

  Serial.begin(9600);

  pinMode(ECHOPIN, INPUT);

  pinMode(TRIGPIN, OUTPUT);

  pinMode(5,OUTPUT);

  digitalWrite(5, HIGH);                         // I supply my sensors with outputs of the Arduino in order to let the other 3 sensors OFF and consume less                                                            // when one sensor is already measuring

}

void loop(){

  digitalWrite(TRIGPIN, LOW);                   // Set the trigger pin to low for 2uS

  delayMicroseconds(2);

  digitalWrite(TRIGPIN, HIGH);                  // Send a 10uS high to trigger ranging

  delayMicroseconds(10);

  digitalWrite(TRIGPIN, LOW);                   // Send pin low again

  float distance = pulseIn(ECHOPIN, HIGH);        // Read in times pulse

  distance= distance/58;                        // Calculate distance from time of pulse

  Serial.println(distance);                   

  delay(50);                                   // Wait 50mS before next ranging

}

The fact is that I just begin in Labview so I would like to know if something already exists for my request and if so, can anyone provide me with something please, in order to getting started?

I hope what I tried to describe is clear and that someone will be able to help.

Thank you very much!!

Message 1 of 4
(5,241 Views)

billbourrin,

What operating system are you running on your computer?

I ask this because you have some major challenges ahead of you.

1. LabVIEW 7.1 is quite dated. NI does not support it on modern Windows operating system. See chart. I have heard that some people got it to work on Windows 7 but I personally have not tried.

2. LabVIEW 7.1 is not supported on LIFA. Read these FAQs. This will help you understand what LIFA is and that it specifically does not actually program the arduino. That is done with sketches.

3. LIFA is actually dated as well and the developer has moved on to its replacement called LINX. What this means is that LIFA will not see any updates or development of new sensor requests etc.

Where does that leave you?

This depends on your project. It sounds like it might be robotics?

Do you really want or need to use LabVIEW for this? Remember that LabVIEW is kind of like a dog leash to the arduino because it needs to communicate between the two. You can replace this leash with RF (bluetooth, wifi, zigbee etc) but this will increase cost and complexity.

If at all possible I would get a more modern version of LabVIEW. Here is a option if you are not restricted by cost or export control.

I would eat this elephant one bite at a time. I would start by using the Arduino IDE and its associated serial monitor to test the sketch to make sure it works first. Here is one quick example of this.

LINX has native support for the HC-SR04 so it might (no guarantee) just natively support the HY-SRF05.

Hope this helps.

Now Using LabVIEW 2019SP1 and TestStand 2019
Message 2 of 4
(3,777 Views)

I finally managed to install Labview 2011 !! I'm using window vista.

My project is industrial and yes, I really need to use Labview because the informations of distance from the sensors will be displayed on Labview along with other informations of the process.

Today I tried 2 vi from this website : https://physicslight.wordpress.com/2014/07/14/arduino-labview-serial-write-read/

Unfortunately when trying to run the first one "autodetect_arduino" I got an error so I'll try the LINX interface tomorrow and get back to the forum if I need so.

Thank you for your answers!

Message 3 of 4
(3,777 Views)

Hi billbourrin,

I have updated the auto_detect_arduino.vi .

It is now searching for Arduino string in your ASRL?*::INSTR and it returns an error if you Arduino is not connected to the machine.

I suggest to use the Arduino analog read using LabVIEW for your project. The project description is available at this link and the LabVIEW project on github

Hope this helps, if you have any questions please comment on physicslight blog so I can read it

cheers

0 Kudos
Message 4 of 4
(3,777 Views)