Communicating with Yun over WiFi

I want to be able to send commands to the Yun from a computer or smartphone, and receive messages back as well. The device talking to the Yun will always be on the same LAN as the Yun - no need to talk to the Yun over the internet. I've looked at a few options, and don't see anything as simple as there probably is out there. "Pusher" looked promising, but after looking at the code, it appears that Pusher requires you to connect to the pusher "broker" at ws.pusherapp.com. I don't want to have to assume that there is WiFi connectivity to the internet, so that doesn't work.

Could someone please recommend a method of inter device communication?

Thanks!

  • Dave

You can use Python for the Yun, it provides libraries to communicate via TCP/IP https://wiki.python.org/moin/TcpCommunication.

Then you have to implement the same on your smartphone but I can't help you with it :D

Bluetooth, easy to implement just needs a cheap chip and you dont need networking. Android apps available.

Thanks, but I do want to use wifi and want the code to be C/C++ that runs on the Arduino CPU, not on the Unix CPU. I guess I'll just use sockets. I thought there'd by something more elegant and straightforward.

dptdpt: Thanks, but I do want to use wifi and want the code to be C/C++ that runs on the Arduino CPU, not on the Unix CPU. I guess I'll just use sockets. I thought there'd by something more elegant and straightforward.

But you can't use sockets on the Arduino side, it has not network capabilities. The network interface is managed by the Linux side so you have to use it if you want WiFi.

You can use the process class to launch processes on the linux side or you can write a script that runs on linux and communicates with the sketch.

With the process class you can launch curl commands to communicate through the network interface.

It's not that I don't want to leverage code on the Linux side, I just don't want to write it.

So can't I use the WebSocket class, which is built on top of the EthernetClient class?

One thing I'm not clear on - will the EthernetClient class communicate over WiFi? In another thread yesterday, someone said that it only worked on the Ethernet port in tåçket class to use YunClient instead of EthernetClient, and YunClient ~does~ use Wifi...

EthernetClient works only with the Ethernet shield, why not using directly YunClient?

Ok, update on this. I settled on using Pusher. It's awesome - very easy to set up and gives you remote procedure call type functionality. Here's a link.

The problem is that it's (relatively) a memory pig. Out of the 28kb of RAM I have available on my YUN, it uses fully half of that. I'm having a hard time getting the code I need to fit into the remaining 14K.

So - anyone know of a more streamlined version of Pusher, or another API that gives you REST access to the YUN without eating up 14K?