Go Down

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

robotboy27

Hi . I have connected my computer to my yun network. Am I able to use labview TCP/IP to communicate to Yun wirelessly? Has anyone done this before?

Angelo9999


jessemonroy650

Hi . I have connected my computer to my yun network. Am I able to use labview TCP/IP to communicate to Yun wirelessly? Has anyone done this before?
@robotboy27,
it appears you can use  labview TCP/IP to communicate with the Yun wirelessly, but it is a real over kill for any purpose the Yun was designed for. I have not used the product, but I did read the literature.

What are your trying to do?

Jesse

robotboy27

Hi . What do you mean by over kill? What I would love to do is to control my arduino yun wirelessly using Labview GUI with TCP/IP . Do you know other ways I can control my arduino yun using this way?

jessemonroy650

Hi . What do you mean by over kill? What I would love to do is to control my arduino yun wirelessly using Labview GUI with TCP/IP . Do you know other ways I can control my arduino yun using this way?
@robotboy27,
it depends on what you are trying to do, but typical development is to use CURL. It is a command line utility to send not just packets, but files, if needed. Otherwise, the YUN is a fully functional Linux box, so it can be configured as a server. You can login using ssh, or use the YunSerialTerminal to issue command, it also has a webserver running so you can use that. Or you can install your own set of tools.

Jesse

robotboy27

Oh so sorry . Right now I am using Yun's network . I am trying to communicate with my computer labview(client) to my yun (server). I tried to communicate  using TCP/IP but no data was recieved nor sent out.Here below is what I have done . Please guide me on where am I wrong.

Here is the code I used for my yun
i change it a little from the example
 
#include <SPI.h>
#include <Ethernet.h>
#include<Console.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = {
0x90, 0xA2, 0XDA , 0XF0 , 0X24 , 0X23
};
IPAddress ip(192, 168, 240, 117);
EthernetServer server(3477);
boolean alreadyConnected = false; // whether or not the client was connected previously
void setup() {
// initialize the ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
Bridge.begin(); // Initialize Bridge
Console.begin();

// Open serial communications and wait for port to open:
while (!Console);

Console.print("Chat server address:");
Console.println(Ethernet.localIP());
}
void loop() {
// wait for a new client:
EthernetClient client = server.available();
// when the client sends the first byte, say hello:
if (client) {
if (!alreadyConnected) {
// clead out the input buffer:
client.flush();
Console.println("HI");
client.println("Hello, client!");
alreadyConnected = true;
}
if (client.available() > 0) {
// read the bytes incoming from the client:
char thisChar = client.read();
// echo the bytes back to the client:
server.write(thisChar);
// echo the bytes to the server as well:
Console.write(thisChar);
}
}
}
 
I am unable to send nor receive . HELPP!!
I am getting error 63 and tcp open connection in untitled one

jessemonroy650

#6
May 19, 2015, 10:14 am Last Edit: May 19, 2015, 10:15 am by jessemonroy650
@robotboy27,

Okay. This common. You have a misunderstanding about the Yun. The answer below is a canned answer. It is not the question you asked, but it will answer many of your questions.

To be clear, you code shows that you have a misunderstanding. Please read the section below, it will help you get started in the right direction.

Again, there is a misunderstanding about how the Yun works. Read below.

But before you follow any of the steps below read the whole thing, and first read this:
Guide to the Arduino Yún
http://www.arduino.cc/en/Guide/ArduinoYun


= [Q:] I cannot connect to My Arduino Yún. What do I do? =


First it's good to know, when  Arduino Yun cannot find the AP you have set it for (like your home wifi), it has a script that puts it back into default SSID and AP mode.

Next, you may have already watched this video, but it's worth watching again. Pay extra attention to the part with the sketches.
Getting started with Arduino Yún - tutorial (6:53)
https://www.youtube.com/watch?v=9-hPhWHWnvs

Then, read these short instructions. We (the volunteer support group) already know these steps by heart, so be familiar with the different reboot methods, and especially the 30+ second wifi reset. Also, not mentioned on that page, if you reset the Wifi/Linux part of the Yun, it will take from 2-8 minutes for the reboot. Lastly on this part, YOU MUST WAIT for the Linux portion to fully boot BEFORE YOU PRESS ANY of the REST buttons.
Resetting the processors (AR9331, WiFi, and 32U4)
http://arduino.cc/en/Guide/ArduinoYun#toc6

'''Then start over''', plug your Yun into the USB port, run this sketch, and hit the ''Wifi Reset button''  (for 5-10 seconds). (See Image below for location of buttons.)
http://arduino.cc/en/Tutorial/YunSerialTerminal

The ''YunSerialTerminal'' provides a simplified console access to the Linux part of the Yun. It works via the USB port (the one that powers the Yun - the microUSB). From there you'll be able to run a few commands to give us a better idea of problems.

Also, be ready with this sketch YunWiFiStatus. This sketch will help us see the status of your home AP. The sketch prints the wifi status to the console every 5 seconds or so. This sketch might seem familiar as it was in that first video link (above).

Let us know how it goes.
Post results from the YunSerialTerminal, if you are still having problems.
Please use markup when posting results. (See image below)

Lastly, if you are not familiar with Linux, you may want to read this:
http://arduino.cc/en/Tutorial/LinuxCLI

Jesse

robotboy27

hmmmm... but I have to set up a link from my arduino to labview using TCP/IP . How do I do it?

ShapeShifter

Here is the code I used for my yun
i change it a little from the example
 
#include <SPI.h>
#include <Ethernet.h>
#include<Console.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network.
// gateway and subnet are optional:
byte mac[] = {
0x90, 0xA2, 0XDA , 0XF0 , 0X24 , 0X23
};
IPAddress ip(192, 168, 240, 117);
EthernetServer server(3477);

boolean alreadyConnected = false; // whether or not the client was connected previously
void setup() {
// initialize the ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();

Bridge.begin(); // Initialize Bridge
Console.begin();
What example did you start with? It looks like you made a LOT of changes. This will never work.

The code highlighted in red is for the Arduino Ethernet shield. The Yun's networking is completely different and the code in that library cannot be made to work with the Yun.

On the other hand, the code highlighted in blue is from the Yun's Bridge library, and is the correct code to use.

Step 1: pretend that anything in the standard Ethernet or WiFi libraries doesn't exist - they will not work with Yun.

Step 2: read up on the Yun Bridge Library, everything network related goes through that library.

Step 3: specifically study the YunServer and YunClient classes, they are the closest to the server and client objects you used in your sketch.

ShapeShifter

A little more information:

I think the code IN THIS POST is close to what you posted above, and might be a starting point for you.

This may also be helpful: Beginner's Introduction to Yun Web Services

jessemonroy650

hmmmm... but I have to set up a link from my arduino to labview using TCP/IP . How do I do it?
@robotboy27,

I'm not being clear. YOUR CODE is NOT correct. You are using libraries that are intended for use the Leonardo, the Uno and others. The Yun is different. You need to use a different library or send the data to the Linux side to be able to see your data.

USING labview will get you nothing because your code is written wrong. Please watch the videos provided.

Jesse

robotboy27

Alright . Wow I did not know that . Sorry the Yun is so confusing . Thank you guys . So if I changed my codes ,  TCP/IP labview will be able to read it right?

jessemonroy650

#12
May 20, 2015, 05:39 am Last Edit: May 20, 2015, 10:13 pm by jessemonroy650
Alright . Wow I did not know that . Sorry the Yun is so confusing . Thank you guys . So if I changed my codes ,  TCP/IP labview will be able to read it right?
@robotboy27,
if you insist on using labview, you can; but it is an overkill. You should be able to write an application in an hour or so, if you start from one or the tutorials.

I have to ask again, what are you going to use labview for?

Labview is not intended for application development. It is a tool for network analysis. This is like using a pair of paper scissors when you only need a sewing needle.

Jesse

robotboy27

Oh I am using labview as my GUI . What I am doing is building energy management system. And my teacher wanted it to be wireless so I have no choice that I will have to use TCP/IP. All I want is to use it to turn on a relay using my Labview GUI . That's what I have to do.

ShapeShifter

Alright . Wow I did not know that . Sorry the Yun is so confusing . Thank you guys . So if I changed my codes ,  TCP/IP labview will be able to read it right?
I don't know about that, I haven't used Labview in 20 years, and it was only a cursory use back then over GPIB, not a network. I don't know what's involved in getting Labview to talk over a network.

But I do know how to get the Yun to listen for incoming connections from other computers, and that's what the code I linked to earlier does. Making the connection is only half of the battle, understanding the Labview protocols and commands is the bigger part of it. I'm sorry, but you're on your own there.

Labview is not intended for application development. It is a tool for network analysis.
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.

Go Up