Yun to labview TCP/IP wireless

I think you can control Yun with less heavier solutions. If you are using labview just as a GUI, then it is an overkill IMO.

ShapeShifter: But Labview IS NOT a tool for network analysis!

From http://www.ni.com/labview: I certainly don't think the teacher is a fool for trying to teach an appropriate instrumentation control system. Easily controlling equipment (and collecting data from it) is what it's designed to do.

@ShapeShifter, After sometime, I recalled Labview. It is a very good analysis tool. But it is an overkill for developing Apps. Labview was widely used in the valley (Silicon Valley) for some time until Network engineers decided it was an overkill.

For instance, if I was going to design a Switch system with Multiple types of technologies from say ISDN to IP, then Labview would definitely be in my arsenal. But if I just wanted to talk to the Arduino Yun or Ethernet Switch with 100 channels, I'd just use my laptop. Now, if that Ethernet Switch had issues that could NOT be determined by unplugging subnets, then Labview is great.

Just to be clear on this point, NI sold (or gave) this software to lots of teleco's and I'd seen them used, but mostly I'd seen these systems gather dust. Labview is a great tool; it's just not well understood. Hell, I even forgot about it, till yesterday.

Jesse

mart256: I think you can control Yun with less heavier solutions. If you are using labview just as a GUI, then it is an overkill IMO.

Yes, there are more efficient ways of doing things. But teaching scenarios often introduce artificial constraints in order to introduce new concepts. Simply controlling the output of a Yun using Labview is overkill, but I'm guessing it's an early baby step towards introducing more complex control scenarios.

jessemonroy650: Labview was widely used in the valley (Silicon Valley) for some time until Network engineers decided it was an overkill.

I just don't see network engineers being a target market for Labview, it's no wonder they don't use it.

The prime market I see for it is in a laboratory setup where a chemist/technician/engineer wants to hook up a bunch of lab instruments to a computer, remotely control them, and collect data from them. That may not be the most efficient way, but it's a way to accomplish the task without having to learn a programming language, having to figure out how to talk to all of the different instruments, or figure out a complex API for each machine. Just load up the drivers that provide a high level abstraction of each instrument and connect it all together with the graphical programming environment. I see it as the laboratory equivalent of a PLC: it's used to connect and automate a bunch of test instruments in a similar way as a PLC would be used to control a bunch of industrial machines.

You're right in that I just don't see it being used for networking control or analysis. But I do see it controlling lab equipment, and I do see the OP's project as a first step to integrating an arbitrary machine into such an environment (if only as a learning experience.) Sure there are different ways to do it, and Labview wouldn't be my first choice either, but you aren't going to get good grades in a class if you don't do the assignment as instructed. I remember an early algorithms class where I had to write a program to do a Gauss-Jordan reduction in FORTRAN, thinking that it's silly because I could do it in one operator using APL: while that would've been much more efficient, it would've given me failing grade in that FORTRAN algorithm assignment!

Yeah . I think LabView is more like a teaching tool . Anyway , I want to sent 1 or 0 to turn off my relay from my labView GUi to my YUN. Since TCP is all strings , how can I tell it to turn the relay on and off? How can I code this in the IDE ? Sorry but this is quite advance for a beginner user in both platforms.Is anyone able to help me?

robotboy27: Yeah . I think LabView is more like a teaching tool . Anyway , I want to sent 1 or 0 to turn off my relay from my labView GUi to my YUN. Since TCP is all strings , how can I tell it to turn the relay on and off? How can I code this in the IDE ? Sorry but this is quite advance for a beginner user in both platforms.Is anyone able to help me?

@robotboy27, No problem. I think ShapeShifter is likely right in this task. Let's get you moving.

On the Yun side, you'll be using the Bridge Library. You specifically want the Bridge Tutorial Example loaded on the Yun, then access that sketch via your laptop with your webbrowser.

Specifically, you'll be using the REST API. Get it working on your laptop or desktop, then copy the URL over to the Labview system and set it up.

In other words, you can turn your relay on and off with a 0 (zero) or 1 (one) - just with your laptop, then it will be a matter of making labview do the same thing.

FWIW: there is an LED (#13) on the Yun that is part of the tutorial. You can test the sketch and the REST API just with that.

I hope I've given you enough. If not, someone else will chime in. Jesse

robotboy27: Yeah . I think LabView is more like a teaching tool . Anyway , I want to sent 1 or 0 to turn off my relay from my labView GUi to my YUN. Since TCP is all strings , how can I tell it to turn the relay on and off? How can I code this in the IDE ? Sorry but this is quite advance for a beginner user in both platforms.Is anyone able to help me?

Load this code first:

Console Pixel example from IDE:

#include 
const int ledPin = 13; // the pin that the LED is attached to
char incomingByte;      // a variable to read incoming Console data into
void setup() {
  Bridge.begin();   // Initialize Bridge
  Console.begin();  // Initialize Console
  while (!Console);   // Wait for the Console port to connect
  Console.println("type H or L to turn pin 13 on or off");  
  pinMode(ledPin, OUTPUT); // initialize the LED pin as an output:
}
void loop() {
  // see if there's incoming Console data:
  if (Console.available() > 0) {
    incomingByte = Console.read();  // read the oldest byte in the Console buffer:
    Console.println(incomingByte);
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);  // if it's a capital H (ASCII 72), turn on the LED:
    }
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);   // if it's an L (ASCII 76) turn off the LED:
    }
  }
}

Test Above code

ssh root@ yourYunsName.local 'telnet localhost 6571'

type "H" will be on, type "L" will be off.

Now we need redirect port 8888 of Arduino Yun ip (i.e. 192.168.0.102) to localhost 6571.

opkg update
opkg install socat
(socat TCP-LISTEN:8888,fork TCP:127.0.0.1:6571) &

Now you should be able access Yun from PC which runs LabView via:

telnet 192.168.0.102 8888

type "H" will be on, type "L" will be off.

At LabView select TCP...

socat - 1.7.2.1-1 - SoCat (for SOcket CAT) establishes two bidirectional byte streams and transfers data between them. Data channels may be files, pipes, devices (terminal or modem, etc.), or sockets (Unix, IPv4, IPv6, raw, UDP, TCP, SSL). It provides forking, logging and tracing, different modes for interprocess communication and many more options.

sonnyyu: Now we need redirect port 8888 of Arduino Yun ip (i.e. 192.168.0.102) to localhost 6571.

Very Nice! 8)

Up until now I had a clumsy time accessing the Console by any method other than the Serial Monitor button on the IDE (if the Yun even showed up on the Port menu.)

But this is simple and it works! Now I can make a direct connection from PuTTY or an application without having to jump through hoops.

I'll say it again: Very Nice! 8)

ShapeShifter:

Quote from: sonnyyu on Today at 11:54 am

Now we need redirect port 8888 of Arduino Yun ip (i.e. 192.168.0.102) to localhost 6571.

Very Nice! 8)

::::SNIP::::

@ShapeShifter,
I knew Sonny would give us a better solution. I used to use netcat, but this (so-cat) a better solution. 8)

Jesse

jessemonroy650: ... I knew Sonny would give us a better solution. I used to use netcat, but this (so-cat) a better solution. 8) ...

The netcat should worked as well.

opkg  update
opkg install netcat
mkfifo /tmp/fifo
(netcat -l -p 8887 < /tmp/fifo | netcat 127.0.0.1 6571 > /tmp/fifo) &

How do you success of using it at the end?

This reply is meaningless. Please explain yourself, or be banned.

Poor translation I think Nick. His other post is just a touch better.

@Nick, Agree with crossroads.

This subject in particular has been annoying. Some professor, some where in Europe (we think) is assigning students to have Arduino Yun talk to Labview. What makes it silly is theses students don't know a thing about TCP/IP networking. Which means all we can do is hand them a canned answer. Answers they cannot expand - because they don't understand the answer; let alone the question.

Jesse

How to use labview and Arduino yun's Wireless Protocol??