Arduino Yun


Author: Dave
Date: 10.23.15 - 6:13pm



So the Arduino yun is an interesting product. I'm not going to do a full review or even cover the basics I'm just going to list some random thoughts I have after use and getting to know it a little bit.
  • the Arduino side starts to run immediately, the linux side take 60 seconds to boot
  • calling Bridge.Begin() in your sketch set up, will cause Arduino to hang until Linux is ready if you have a display, you might want to run code first to show something before calling this so the user is not left waiting.
  • to load a file off of the SD card, I had to wait until loop and then even add a delay or I could get file not found errors. I am not sure that filesystem.begin is quite ready by the time it returns? To read a config file in the root of the SD card drive, you would use the following path FileSystem.open("/mnt/sd/config.txt", FILE_READ);
  • the linux side can host websites. I am not sure yet if it supports any active content by default? You would put your webpages on the SD card in the path /arduino/www/ you would then access them through the following URL http://[ip]/sd/[page.html] this is probably mostly meant to host client-side JavaScript pages and images to use with Ajax requests?
  • the rest API allows you to query pin values and send configuration data to the Arduino sketch through HTTP requests. You could do the following for example: http://[ip]/arduino/config/john/6/
    loop()
    YunClient client = server.accept();
    
    if(client)
    {        
        String command;
        command=client.readStringUntil('/');
    
        if(command=="config"){
             String uname = client.readStringUntil('/');
             command=client.readStringUntil('/');
    	 int uid = command.toInt();
        }
    
  • even with just basic parsing using the YunClient/server will take up about 10% of available program memory (ouch)
  • memory on this thing fills up fast, it seems very capable but I wish it was mega sized.
  • If you want to get the local ip of the arduino yun from a sketch for display you can use the following: (~7% of available memory)
    char 
    
    localIP[25] = {0};
    
    if(localIP[0] == 0){
    	if( yun_localIp() ){
    		  tft.setCursor(0, 0);
    		  tft.print("ip: ");
    		  tft.println(localIP);
    	}
    }
    
    bool yun_localIp() {
      
      Process p;         
      p.begin("ifconfig");  
      p.run();      
    
      String output = p.readString();
      int wlan = output.indexOf("wlan0");
      if(wlan < 1) return false;
    
      int ip = output.indexOf("inet addr:", wlan);
      if(ip < 1) return false;
    
      ip+=10;
      uint8_t i = 0;
      while(output.charAt(ip) != ' ' && i < 23){
    		localIP[i] = output.charAt(ip);
    		i++;
    		ip++;
      }
      localIP[i] = 0;
      
      IFS(Serial.print("Local Ip: ");)
      IFS(Serial.println(localIP);)
    
      return true;
    }
    
  • I'm pretty sure I read references that you can SSH into it and install more packages such as PHP. I haven't experimented with this yet, but that probably also means that you can add files to the default website for configuration. Currently the wireless config Web UI is done in Lua. Its source tree can be found here. The local path on the Yun for it is usr/lib/lua/luci/controller/arduino/index.lua
  • in the documentation you see references to visit the URL http://Arduino.local this utilizes the zeroconf/rendezvous/Bonjour service which Windows machines do not come with by default. There are applications you can install which will register the service
Overall I like the capabilities of this device. I was unfamiliar with REST type API, it seems convenient and really built for Ajax. The memory constraints feel quite tight to have a full sketch but maybe I am doing it wrong. Maybe the real intent is to run most of your code on the Linux side and only use the sketch for things like display output and sensor reading. I am still looking at it through the lens of primarily using the Arduino side and just leaving Linux side for the networking.

I still have to explore this platform more to see how I can make it sing.




Comments: (0)

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 68 + 97 = ? followed by the letter: T 



About Me
More Blogs
Main Site
Posts:
2024 (1)
     Caddx Moonlight VTX Fried
2023 (2)
     Circuit board holders
     ADT System Retrofit
2019 (1)
     Electronic dividing head
2017 (3)
     Crawl Space Forklift
     Remote Control Snowblower
     Arduino RC motor control
2016 (6)
     Keyboard Emulation
     Arduino w/ win2k
     Arduino Snowblower chute control
     Attic Fan Remote Control
     Robotic Arm
     ATTiny Watchdog
2015 (7)
     ESP-LINK Huzzah
     Arduino Bugs
     Arduino INI library
     Arduino Yun
     long watchdog
     Arduino runtime config
     CNC Rotary table
2014 (1)
     Humidor AutoWater