Go Down

Topic: Yun to labview TCP/IP wireless (Read 11948 times) previous topic - next topic

mart256

You better build an html webapp as GUI. Its easy and Yun can serve it.

robotboy27

Yeah I wish I could . But my teacher wants it in LabView . So now I am having a lot of problem understanding TCP/IP in Labview . I do not know how to link them . All I know is I will have to make codes for arduino and make a client TCP for Labview. But I am no way near there . :(

jessemonroy650

#17
May 20, 2015, 10:10 pm Last Edit: May 20, 2015, 10:15 pm by jessemonroy650
Yeah I wish I could . But my teacher wants it in LabView . So now I am having a lot of problem understanding TCP/IP in Labview . I do not know how to link them . All I know is I will have to make codes for arduino and make a client TCP for Labview. But I am no way near there . :(
@robotboy27,

I understand now. I thought this might be the case. Teachers understand theory, not pratice. Don't tell youd teacher I said he was a fool. Come back as often as you need to get this done.

Use the Bridge example from your laptop
http://www.arduino.cc/en/Tutorial/Bridge

Once you have it working, which should be an hour or two, then try to do the same on Labview.

Jesse

jessemonroy650

::::SNIP::::

I think you're thinking about the wrong product? Labview is a graphical programming environment designed for analytical instrument control and data collection. While it can communicate with instruments over a network, it is not a networking tool.
@ShapeShifter,
Yep, we are talking about the same thing with different words again. I said it was in #12
It is a tool for network analysis.
I have marked that section for you. ;)

Jesse

ShapeShifter

@ShapeShifter,
Yep, we are talking about the same thing with different words again. I said it was in #12
It is a tool for network analysis.
I have marked that section for you. ;)

Jesse
But Labview IS NOT a tool for network analysis!

From http://www.ni.com/labview:
Quote
LabVIEW System Design Software

LabVIEW software is ideal for any measurement or control system, and the heart of the NI design platform. Integrating all the tools that engineers and scientists need to build a wide range of applications in dramatically less time, LabVIEW is a development environment for problem solving, accelerated productivity, and continual innovation.
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.

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.

jessemonroy650

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

ShapeShifter

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.

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!

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?

jessemonroy650

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

sonnyyu

#25
May 22, 2015, 07:45 pm Last Edit: May 22, 2015, 07:54 pm by sonnyyu
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:

Code: [Select]
#include <Console.h>
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:
    }
  }
}

sonnyyu

#26
May 22, 2015, 07:54 pm Last Edit: May 22, 2015, 07:56 pm by sonnyyu
Test  Above code

Code: [Select]
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.


Code: [Select]
opkg update
opkg install socat



Code: [Select]
(socat TCP-LISTEN:8888,fork TCP:127.0.0.1:6571) &


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

Code: [Select]
telnet 192.168.0.102 8888

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


At LabView select TCP...



sonnyyu

#27
May 22, 2015, 07:58 pm Last Edit: May 22, 2015, 07:58 pm by sonnyyu
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.






ShapeShifter

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)

jessemonroy650

Quote
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

Go Up