Sending info over ethernet using Yun

Hi everyone!

I'm embracing a new project than involves sending some data over ethernet. Since It's been a long time since I used an arduino I bought the new Yun as it has the hardware features I need and, along side, can even enjoy some good things of having a Linux software on the same board.

After reading all the documentation I have some doubts that you cna hopefully help me with. I have package that I'd like to send it to a specific IP.

Some googling tells me with an ethernet shield+ethernet libs it would be easy to do but, with the yun, I cannot find any help.

All the examples I find consider a server/client situation instead of just a sender(talker,streamer). This is specially hard in my situation since I'd like not to have any client on my side since that, in a limit situation, some information might me broadcasted.

Any help with this would be truly appreciated.
Cheer everyone!

Nope, I almost made the same mistake. Yun has two (2) separate processors. The second processor has full Linux system on-board.

READ:

Arduino Yún

Guide to the Arduino Yún

THIS IS YOUR PROGRAMMING INTERFACE
Bridge Library for Arduino Yún

Make sure to upgrade your system:

Upgrading the OpenWrt-Yun image on the Yún

Finally, you'll be using the mini-USB to log into the Arduino at first, the you should be able
to SSH in:

Using the command line for communication with SSH and cURL

Best of Luck, Let me know how it goes.

Jesse

You are in a client/server type situation. All you need to do is open the connection and send the data.

If you need to send data from the AVR to Linux then you use the bridge lib.

Mark

jessemonroy650:
Nope, I almost made the same mistake. Yun has two (2) separate processors. The second processor has full Linux system on-board.

(...)

THIS IS YOUR PROGRAMMING INTERFACE
Bridge Library for Arduino Yún

(...)

Jesse

Mistake? Like a "you can't do it" mistake?

I've already read all the docs and I understand that the bridge lib is where I want to dig in (Alongisde with yunclient and yunserver) but unfortunately there is no easy way to do it nor any function that can do the same as a write(specificIP,port,data);

holmes4:
You are in a client/server type situation. All you need to do is open the connection and send the data.

If you need to send data from the AVR to Linux then you use the bridge lib.

Mark

Unfortunate no. I'm not in a client/server situation because I have no server/client running. I.e., if I launch the server on the yun I will not be able to send info because no one is connected (no clients). IF I create a client on the yun I don't have any server to connect to.

This happens because my project has many different platforms, OS, etcetc. I'd like to make the information that comes out of the yun as agnostic as possible. As I said, a: write(IP,port,info) would do the trick.

Thank you for your help!

JohnMdz:
Mistake? Like a "you can't do it" mistake?

I've already read all the docs and I understand that the bridge lib is where I want to dig in (Alongisde with yunclient and yunserver) but unfortunately there is no easy way to do it nor any function that can do the same as a write(specificIP,port,data);

::::

JohnMdz,
forgive me for not being clear enough. Again, the Yun has two (2) processors. The second processor controls the Ethernet and the Wifi. That second processor is a mostly Complete Linux Operating System. You can use the other processor to talk the Linux Side, and with the Bridge - the Linux can talk to the Arudino.

You can SSH into the Linux side and add code, OR you can run code from the Arduino side.

READ AGAIN:
http://arduino.cc/en/Reference/YunBridgeLibrary

You can use Process.run() to run something on the Linux side from the Arduino.
(In this case, you have no control - you just launch something.)
http://arduino.cc/en/Reference/YunProcessRun

You can use Console() to run a shell on the Linux side directly from Arduino.
(In this case, you have control over what runs, but at lose of some speed and memory.
http://arduino.cc/en/Reference/YunConsoleConstructor

You can use the Mailbox to pass data in both directions:
http://arduino.cc/en/Reference/YunMailboxConstructor

I hope I'm clear. Please read again. The solution is available.

TIA
Jesse

JohnMdz:
I've already read all the docs and I understand that the bridge lib is where I want to dig in (Alongisde with yunclient and yunserver) but unfortunately there is no easy way to do it nor any function that can do the same as a write(specificIP,port,data);

If you are including an IP address in your write call, it sounds like you want to send UDP packets (although you don't say this.) The Bridge library client and server classes only support TCP streams, they don't support UDP. You will have to program the UDP communications on the Linux processor; you can then talk to that Linux process from the Arduino side using other Bridge classes.

Take a look at this: [Solved] Send packets via Wifi to udp port - Arduino Yún - Arduino Forum

Just write a python script on the linux side to access the ethernet port and send udp/tcp package. Google python and tcp/udp there must be lot of info.

Hi all,

Thank you for your help. I had to stop with the project for some time but now I'm back.

Yes, indeed I want to send some UDP packs. Due to some problems I'd prefer to use only the arduino side of the yun and not directly work with the linux part. I find it a little bit strange and misleading that a "normal" arduino with a shield can send UDP packs and a yun does not have that function out of the box. I even find that this info should be clear and explicitly written somewhere (apart from foruns :slight_smile: ). Just my personal thought :slight_smile:

Once again, thank you for the help! SOLVED :smiley:

JohnMdz:
Hi all,

Thank you for your help. I had to stop with the project for some time but now I'm back.

Yes, indeed I want to send some UDP packs. Due to some problems I'd prefer to use only the arduino side of the yun and not directly work with the linux part. I find it a little bit strange and misleading that a "normal" arduino with a shield can send UDP packs and a yun does not have that function out of the box. I even find that this info should be clear and explicitly written somewhere (apart from foruns :slight_smile: ). Just my personal thought :slight_smile:

Once again, thank you for the help! SOLVED :smiley:

JohnMdz,
I find I must agree with you. I also think it is a bit misleading that the Arduino Yun DOES NOT have a native UDP library, and users/developers must resort to using the Linux side.

On that point, writing a UDP library should be trivial for most programmers. And as many of my fellow developers point to, the code is on the hard disk. ON mine, the TCP code is at: arduino-1.5.8/libraries/Bridge/src/. However, even with that code written (for the Arduino side) there would still needs to be code on the Linux side to handle socket duties.

Best of Luck with your project.
Jesse

JohnMdz:
I find it a little bit strange and misleading that a "normal" arduino with a shield can send UDP packs and a yun does not have that function out of the box.

I'm not so sure about calling it misleading, but I agree it would be nice to have native UDP support on the Arduino side of the Yun. You are not the first person to be tripped up by this.

Hopefully, someone who is good at this sort of stuff will open an issue on GitHub, and work on an addition to the Bridge.

ShapeShifter,
I just looked at all the code to get a UDP library done. It's about 2 days work; including documentation & testing. However, it is NOT on my radar. So, if anyone is inclined to:

The Official Arduino Yun Bridge code

My Simple UDP Client & Server

Again, this is doable, but it's not on my list. If someone is willing to take it on, I can help 3-4 hours per week (at best).

On the code, let me state it is the simplest of examples. It does not, for instance, handle or report errors.

Jesse