Arduino Yun, Linino, OpenWRT



  • One of the features that makes the MySensors platform so compelling is the simplicity of using reliable hardware like the ATMega328 and the nRF transceivers which use hardware serial instead of relying solely on the newer ATMega32u4-based chipsets that use a virtual "software" serial port.
    However, the major disadvantage to the hardware serial approach is it requires a separate controller like the Raspberry Pi to connect to the cloud. As cheap as the RPi is, it still seems like a suboptimal use of something with the capabilities of a full PC.
    Another approach can be traced to an old hack that reflashed cheap travel routers made by TPLink with a Linux-based firmware called OpenWRT. By soldering a serial header to the repurposed router, hackers were able to connect an Arduino to the cloud with the full capabilities of a Linux OS.
    More recently this process was simplified by adding the same chipset used on the travel router to an Arduino Leonardo to create an entirely new board called the Arduino Yun. The Yun enables communication between the 32u4 microcontroller and the OpenWRT chipset through a dedicated "Bridge" library.
    A year after its introduction the success of the Yun has motivated even smaller versions of the same concept like the "LininoONE" which has a footprint barely larger than an Arduino Micro. A Chinese distributor called 'Dragino" even offers a "Dragino Shield" which allows you to create a standard Leonardo into a Yun through a detachable shield while also offering the OpenWRT chipset as a standalone SoC.

    I wonder how difficult it would be to integrate the MySensors library with the bridge Library? In theory, doing so would eliminate the need for a separate controller altogether. On the other hand it might also complicate the initial simplicity that comes with a hardware serial connection.
    Thoughts?


  • Hero Member

    However, the major disadvantage to the hardware serial approach is it requires a separate controller like the Raspberry Pi to connect to the cloud. As cheap as the RPi is, it still seems like a suboptimal use of something with the capabilities of a full PC.

    Many controllers can run on a PC.

    For me the serial, Ethernet and MQTT gateway are simple and cheap enough not wanting it to port to some kind of other platform. Although porting is maybe simple it is additional effort that I think can be spent better.



  • @daulagari
    I think you misunderstood my point. The promise that embedded Linux/OpenWRT holds (e.g Linino, Yun etc...) is it doesnt require "porting" anything at all! Rather it only involves adding support for an existing library that comes default with newer versions of the Arduino IDE.

    The serial, Ethernet and MQTT Gateways are certainly very simple means of transferring a bunch of numbers from one place to another, but if those numbers are going to have any kind of relevance, they will in turn require an additional controller. The controller then needs to either host a heavy native application or it needs to connect to a web service. Between the web service, the controller, the gateway and the sensors the end result is something that is far from simple!

    I am all- too- aware of how many controllers run on PC, my point is that it is a waste of resources to dedicate a full PC to the job of controller. Support for Linino/Yun/OpenWRT would not only free up MiniPC hardware for use elsewhere but it would also allow you to merge together the gateway and the controller functions into a single board.

    On the other hand, such a workflow might appeal more to those in the programming field then it might to those with electrical expertise. As I mentioned, I can see advantages in both approaches. In any case, if I were really that concerned about how efficiently I spend my time experimenting with such things, I probably wouldn't bother with Open Source...


  • Hero Member

    @humblehacker : Yes, I think I misunderstood your point.

    The promise that embedded Linux/OpenWRT holds (e.g Linino, Yun etc...) is it doesnt require "porting" anything at all!

    Let's see, based on what you wrote above ("I wonder how difficult it would be to integrate the MySensors library with the bridge Library?") it seems you are not completely sure.

    The controller then needs to either host a heavy native application or it needs to connect to a web service.

    Can a Raspberry Pi "host a heavy native application" in your mind?

    I think a Raspberry Pi is great as controller and think Linino/Yun/OpenWRT would be too thin.



  • I think the Vera board that mentioned here in this site a lot is basically an openwrt box with customized lua scripts...



  • Resurrecting a slightly old thread here, but I was wondering if there was any progress on the gateway running on a Yun?

    A particular reason for asking is that I now have a fairly complete emulation of the Vera platform's Luup environment running on any generic Unix machine. I've recently put it on a Yun and it works a treat. Most Vera plugins work without modification, and I'm keen to integrate this with the MySensors gateway running on the Arduino processor on the same board.

    As an aside, the 400 MHz cpu running OpenWRT is more than fast enough to make this an excellent controller. The web interface is provided by the excellent ALTUI plugin written by @amg0 on the Vera forum.


  • Admin

    Did you create a Vera emulator??



  • @hek said:

    Did you create a Vera emulator??

    Yes, details (some posts with images of ALTUI running on it) here: http://forum.micasaverde.com/index.php/topic,32315.msg235161.html#msg235161



  • Just to close the loop on the question in the original post...

    @humblehacker said:

    I wonder how difficult it would be to integrate the MySensors library with the bridge Library? In theory, doing so would eliminate the need for a separate controller altogether.

    It turns out that it was not too difficult to add support for the Yún's Bridge library, details here: Ethernet Gateway on Arduino Yún

    @humblehacker also said:

    Support for Linino/Yun/OpenWRT would not only free up MiniPC hardware for use elsewhere but it would also allow you to merge together the gateway and the controller functions into a single board.

    This also works, details of the controller I'm using in openLuup - a Vera emulator for all platforms

    And to address this concern...
    @daulagari said:

    I think [...] Linino/Yun/OpenWRT would be too thin.

    ...it turns out that, in this case, it's not.

    I am currently moving my 'production' HA system to a Yún where the Linux processor itself is running a configuration managing the MySensors network (yet to be fully populated), two WiFi connected Netatmo systems, the DataYours plugin suite logging key events to a Whisper (RRD) database on a CIFS-mounted remote NAS, the ALTUI interface, and a remotely bridged Vera with around 70 devices.

    Even with the relative low-power processor the Linux cpu is only running at about 5% average loading and the whole system fits in around 10 Mbytes. Also, unlike Vera, it runs continuously and does not spontaneously reset.

    Just by way of demonstration, here's an ALTUI-produced map of the current device network handled by the Yún (the purple spot in the middle.)

    Yun Network.jpg



  • Wow! I had forgotten about this thread until I just checked in today... Thank you @akbooer for your excellent follow up!
    Its interesting to look back on what was being discussed a year ago as the idea of truly low-cost wifi via the ESP8266 was only just taking hold. Nevetheless, as some of the original replies to this thread illustrate, a lot of people still have a hard time imagining how a home network could go beyond a typical microcontroller=client/microPC=host configuration. While OpenWRT/ATMEGA boards like the YUN might have been eclipsed by the ESP8266 as a cheaper/more popular wifi CLIENT, I still see the Bridge Library as a very relevant example of the where the IOT needs to evolve if we're ever going to move beyond the cluttered incompatible state of the present automation market.
    @akbooer- your network is a great example of how we can start to move out of the hub and spoke model! I like the graphic you posted too! Might I ask what you used to create it! I've been having a heck of a time simply finding graphing tools that would help me visualize a more distributed automation network. Mind Mapping tools can get me part of the way, but mind mapping is still inherently heirarchical. I need something more like context mapping, but these are much more difficult to find...



  • It's a force-directed graph, see https://en.m.wikipedia.org/wiki/Force-directed_graph_drawing

    Actually built into the UI that I'm using (AltUI by @amg0) as part of my controller ( openLuup, see Controllers page) and it also runs on a Vera controller.

    It's implemented in JavaScript in a browser.


  • Hardware Contributor

    @akbooer: very nice work you've done! I will look at it more carefully when I will be ready, as I am working on a new board. At first, I started to design it with esp, but I needed more features, and for same reason humblehacker mentioned , I moved to dragino/openwrt.. can't wait to finish it and test your great work 🙂



  • I remember when the Yun first came out, everybody seemed to be using the Raspberry Pi as a microcontroller through its GPIO pins... Now with the ESP8266, we have a device which was originally designed to function like an RF module with wifi capabilities, being pushed into a role it wasn't designed for. As a major advoc ate of affordability, I see much to love in the ESP8266... Yet I still can't shake the thought that the Linino-Yun approach still makes the most efficient use of a CPU and MPU together.
    If the ESP popularity has one important lesson however its that affordability can outweigh accessibility and capability. And unfortunately, at $70, its looking like the Yun is becoming the LEAST affordable IOT option... I wonder if there are more cost-effective means of deploying the Bridge Library and Linino/OpenWRT? The closest I have yet found are the Dragino HE Modules which at $21 each, are still pretty pricy for a bare surface mount component. My original idea was to make a custom Yun by mounting an HE Module with a Pro Micro. This would probably require a custom breakout design however. I did notice a new OpenWRT dev board called the WRTnode. While it also uses a MIPS CPU the WRTnode is based on an MTKMT7620N chipset instead of the AR9331... I wonder if Linino or the Bridge Library would run on this alternate chip?



  • @akbooer: I'm currently running the SerialGateway sketch on my Yun.

    Simply replace the Serial calls with Console, and add in the relevant includes at the top.

    Performance isn't stellar, but it's "good enough" for most use-cases. OTA firmware updates are quite slow - you could speed these up significantly by replacing the Yun Bridge with a PySerial bridge at 250kbps.



  • @pdey So what controller are you running on the OpenWRT processor, or are you just using this as a serial gateway?



  • @akbooer: Just using it as a Serial/Ethernet gateway.

    Though there's plenty of documentation available on getting node.js working on the Yun; which you could use to run up the sample node.js controller from MySensors.


Log in to reply
 

Suggested Topics

  • 2
  • 4
  • 2
  • 17
  • 2
  • 5

13
Online

11.4k
Users

11.1k
Topics

112.7k
Posts