Communication between Arduino Yun and the Intel Edison

Hello all,

I have an Arduino Yun running the Bridge sketch.

I want to be able to send the REST calls to the Yun via an Intel Edison, and I'd like to do this programming through the Arduino IDE (as I do not know node.js well).

The documentation on this process is not very well outlined online, so I am looking for some guidance. Everything I have come across has to do with middleware, which I do not want to use.

At the end of the day, I want to use wifi communication and simple commands to pass I/O data from the Edison, to the Yun.

Can someone point me in the right direction here?

Thank you.

If I understand you properly, you want to implement a REST API on the Yun, using the sketch and not getting into Linux programming. And then you want to access that API from the Edison. The Edison is the client making the requests, and the Yun is the server that responds to them. Is that correct?

If so, it sounds like the Bridge Example is what you need. You can find it in the IDE under File | Examples | Bridge | Bridge.

While the sketch as-is gives you basic pin level analog and digital I/O abilities, you are free to extend it as needed. The process() function is the top level API handler, and it decodes the first token in the REST request ("digital", "analog" or "mode".) If you want to add additional top level tokens, you would add additional if statements to this function.

Once process() decodes the top level token, it calls a function to handle the details of that verb. In there is where you would look for additional data in the URL to further refine the action, and where you would do the actual processing for the request.

So, to add more features, add a new "if" check to process(), and have it call a new command handler function.

Then, it's just a matter of making the requests from the Edison, and processing the results. You're on your own on that end, I have no familiarity with that platform.

Just keep in mind that you should be able to fully test your REST API from a standard web browser, by manually typing in the various URLs. I would recommend you implement the REST API on the Yun first, and test it fully using a web browser. Don't try to make the calls from the Edison until you know the Yun side is fully working. It's a classic divide and conquer strategy: get one side working fully before working on the other side. If you try to implement the Yun and Edison sides of the API at the same time, you will have trouble trying to figure out which side is at fault when you run into trouble. But if you have the Yun side fully working and testing, and run into trouble when trying to call it from the Edison, then you can be reasonably certain the problem is in the Edison side of things.

Thank you very much for your reply ShapeShifter.

" The Edison is the client making the requests, and the Yun is the server that responds to them. Is that correct?"

Yes, this is correct. I have the Bridge sketch on the Yun, and testing passed via the web browser entries (even from my cell phone on the same network, which I got pretty excited about!). So the Yun side is working properly.

What I am having troubles finding information on, is how to send these requests from the Edison using the Arduino IDE.

Are there any examples available on how to connect the Edison as a client on a local server, and send REST requests via the Arduino IDE? (I think I got all that right, haha).

Thanks again!

I'm sorry, but I have no experience with the Edison. Maybe someone else will be along to give an answer.

There are examples of how you would do this with an Arduino and an Ethernet Shield, or an Arduino and a WiFi Shield, or a Yun using a sketch, or a Yun using the Linux processor. In each case, the methods are different, because different networking techniques and libraries are used. I assume the Edison uses yet another networking interface and set of libraries, so any of those other examples are likely not much help to you.

This sounds like a question that is very specific to the Edison, perhaps there is a support forum just for the Edison that you can try?

Intel® Edison with Kit for Arduino - Arduino Yun VI

Hi Sonny,

Thank you for the reply.

I have the Arduino breakout for the Edison.

My apologies, but I am not sure what you are trying to convey here. I have read all there is there, and the communication links, but it still does not offer any documentation on how to implement the communication between boards over the network, using the Arduino IDE.

Yun is based on Openwrt - Linux
Intel® Edison is based on Yocto - Linux

The list of programming language Yun/Yun Shield supports:

  • Erlang (a general-purpose concurrent, garbage-collected programming language and runtime system)
  • Java
  • JavaScript
  • Lua
  • PHP
  • Perl
  • Python
  • Ruby
  • 4th (an imperative stack-based computer programming language and programming environment)
  • eggdrop (Eggdrop is a popular IRC bot and the oldest still in active development)
  • sigscheme (SigScheme is a R5RS Scheme interpreter for embedded use.)
  • slsh (Interpreter for S-Lang scripts)
  • tcl (Tool Command Language)
  • vala (C-sharp like language for the GObje)
  • C
  • C++
  • MIPS Assembly Language
  • Shell Scripts
  • Fortran

Intel® Edison support more less same except X86 Assembly Language.
first select flip a coin which language to use.

The rest is TCP/IP programming.

It would definitely have to be on Arduino/C++ because that's all I know.

Do you think running the HTTPClient sketch on the Edison would help me send commands to the Yun server? Good place to start?

OK, flip a coin which language to learn.

I guess that's a no then, huh? Haha

Do you think running the HTTPClient sketch on the Edison would help me send commands to the Yun server? Good place to start?

Probably not, if you are talking about the HTTPClient examples that come with the Arduino IDE. Unless the sketch is written specifically for the Edison, I would be surprised if it works. The Yun networking sketches are written for the Bridge Library, which uses a serial port between the microcontroller and the Linux system, and which relies on a bunch of code on the Linux side. The Edison has a completely different architecture, I'll bet the code won't even compile. The generic HHTPClient examples are written to use the networking provided by the WiFi or Ethernet libraries, which are written specifically for the Arduino WiFi Shield and Ethernet Shield. Again, the Edison uses a different networking architecture.

You really need to be looking at resources that are specific to the Edison, I doubt you're going to find much information here.

Okay, good information to know. Thanks again.