Yun as end-node

Hi,
I am looking at the yun as a cost-saving component in an automation system I am currently building.

The system uses an embedded Linux system (BeagleBone) to host Web Services for front end devices (iPhone, Android, and browser) to control various home components, particularly Hot water timers. The Web Services talk to a Pub/Sub hub called Mosquitto, which then uses the open-source MQTT protocol to communicate with downstream nodes. In most cases, these nodes are Arduino Mega2560 s, with Wi-Fi shields. (Mega2560 because the software stack for MQTT, WiFi, JSON, and application exceeds 32K)

I would like to produce a cheaper version, without the hub, and I thought the Yun might be the answer. But having looked at it, I don't think so. Perhaps someone with more extensive knowledge of the device can either validate my reason, or (hopefully) point out the error of my ways.

While my model uses the Arduino in "Slave" mode, the design philosophy behind the Yun seems to put the Arduino / Linux SOC in a Client-Server relationship. The Arduino code uses the C++ half of the Bridge to invoke a Python Server program on the Linux system, by effectively keystroking into the Linux console, and then listens for replies on the console.

I could, I think, just forget the Bridge, and write a Serial listener on the Arduino, which would listen for incoming requests on the Serial (eg Read Existing Timers), and then answer these requests over the same Serial port. Then on the Linux side I would have a Web Service which would handle incoming requests from the world, invoke the Aruino API (Using the Console) , read the reply, and answer the Web Service.

But.... the flaw, at least as far as I can see. This is the Linux Console. Linux will generate messages on the console from time to time. These messages will be picked up by my Arduino listener, and could cause havoc.

Surely using the Linux Console as an inter-processor bus is a bad idea? :fearful:

Cheers,
Con

I'm trying to use the Yun in a similar manner. I've also been struggling with this too. I'm simply having to put a lot of filtering in to the console communications between the Arduino and the Linino side to look for odd strings. I'd rather use the Arduino as a slave to the Python script running on Linino. I asked a question on the forum about what the /dev/tty* is for the arduino so see if I could communicate over that. I didn't get an answer so I presume its not documented.

I think that communicating over console is possible since that is what bridge does. If you read the bridge code they use a heavy error correcting protocol. Every request is accompanied by a CRC and wrapped in a retry loop. I can only assume that the console is not reliable. Indeed my experiments indicate just this. I'm having to make my code resilient in the face of dropped bytes. Sigh. Programming using a Raspberry Pi communicating to an Uno is much simpler, and robust. At this point I'm pretty disappointed. I've invested many, many hours in getting a "python-first" solution implemented and have not been successful.