Start with Arduino Yun

Arduino Yun First use:

This guide will show, step by step, how to install and use for the first time your Arduino Yun.

First Connect your Arduino Yun to the computer through micro-USB connector.

Search your Arduino board between the WiFi networks available on your PC, it should appear in the form Linino-XXXXXXXX.

If you would reset the Arduino’s Wifi you must press the wlan reset button for 5-30 seconds. 

Open a web browser and write the follow address http://linino.local or the ip address in the address bar. 
After a few moments, a web page will appear asking for a password.

Web panel: Log in  

Enter default password: doghunter  
and click Log In button.

(Note: if you upgrade the board to the latest version the new password is "arduino" and it changes the Webpage)

You will find a page with some diagnostic information about the current network connections. The first is your WiFi interface, the second is your ethernet connection. Press the Configuration button to proceed.

Linino web panel: Home  

On the new page, you will configure your Yún, giving it a unique name and identifying what network you want to connect to. In the Yún NAME field, give your Arduino a unique name. You'll use this to refer to it in the future. Choose a password of 8 or more characters for your Arduino. If you leave this field blank, the system retains the default password of arduino. If you wish, you can set the timezone and country. It is recommended to set these options as it may help connecting to local WiFi networks. Setting the local timezone also selects the country's regulatory domain. Enter the name of the wiFi network you wish to connect to. Select the security type, and enter the password. 
Linino Web panel: Configutation setup 1/2  Linino Web panel: Configuration setup 2/2  

At the bottom of the page, you will see toggles for changing the access of Reset API . 
REST is an acronym for "Representational State Transfer". It is a software architecture that exposes various parts of the Arduino hardware through URLs. 
By default, the REST API access is password protected. It is possible to change this to access the services without a password, clicking on Open.

After that you have completed click “Configure & Restart”. 
After few moment, the configuration will be saved and the Arduino Yun will be restart. 
Web panel: Save configuration

Arduino Yun Examples

How to use Arduino Yun board

Guide linino OS upgrade step by step

It is very important follow this guide if you use for first time your board 
Follow these steps to upgrade the latest release of linino OS: 
1) Connect your board via SSH: 
for Linux user using comand Shell: >ssh root@linino.local ; 
for Windows user for example using Putty; 
Putty configuration 
2) Login as "root"; 
Linino Login 
3) Insert the password: doghunter (default or the new password if you have changed it); 
Linino password 
4) Insert the command: linup latest or linup specif release ; 
Note:If the linup command doesn't exist follow this other guide 
Linino homepage 
5) Respond "y"; 
linup latest 
6) Wait the loading; 
Upgrade the board 
7) Choose the option "2": Upgrade and revert to default settings; 
Choose as to upgrade the board 
8) Wait the end of upgrade. 
PLEASE NOTE: In this case the new root password will be “doghunter” without quotes.

Download the IDE. 

It’s possible to choose ARDUINO STUDIO or ARDUINO IDE 1.7.x choosing the release for your system, from the link

Differences from the Arduino Leonardo

In addition to the 32U4 chip, the Yún has an additional processor, an Atheros AR9331, which runs a distribution of Linux for embedded systems named LininoOS, based on OpenWrt. A full install of Python 2.7 is included as well. 
The Yún has a number of different physical characteristics and connectors than the Leonardo. There is an on-board SD slot, Ethernet jack, and a USB-A Host connector. There is no power barrel connector on the Yún; it can be powered from the micro-USB connector. 
There is no built in 5V regulator. If you power your Yún with more than 5V, you will likely damage it. If you are not powering the Yún from the micro-USB connection, you can apply power to the VIN and 5V pins on the board. If using the VIN pin, you cannot provide more than 5V, it will damage your board. It is recommended to power the Yún from the USB connection whenever possible. 
The SD, Ethernet, and USB-A connectors are not physically connected to the 32U4 processor, they are connected to the AR9331. 
The Yún's 32U4 functions in the same way as the Leonardo, except you cannot use Serial1. It is reserved for communication with the AR9331 processor. 
The Yún also has a WiFi module built on board, allowing it to connect to a wireless router, or act as an access point. 
The 32u4, WiFi, and AR9331 processors all have their own reset buttons.

Yun board

There are several status LEDs on the Yún, indicating power, WLAN connection, WAN connection and USB. Additionally pin 13 is connected to one of the status lights.

Yun LEDs

OpenWrt LininoOS

lininoOS is based on OpenWRT distribution with about 3000 package built and available. LininoOS provides a fully writable filesystem with package management with GPG signature. Integrated with LininoIO it is a complete linux system for IoT space. 
LininoOS features many innovations for your Arduino Yun.

  • LininoIO is a software framework able to integrate microcontroller features inside the microprocessor environment. You can simply write your application using Node.js, Python, Bash, etc., on linux side using LininoOS to control completely the board and all the devices attacched.
  • Node.js with Ideino Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices. Ideino is an embedded editor to write and debug your node.js application.
  • AllJoyn supported, which is an open source project which provides a universal software framework and core set of system services that enable interoperability among connected products and software applications to create dynamic proximal networks.


An installation of Python 2.7 is included with LininoOS, which you can use to write applications or scripts. 
For more on Python, visit the Python 2.7 documentation pages.

Install additional software on Linux

The Yún comes with several pieces of software pre-installed on LininoOS, including "curl" and "python". You may want to install other software on the Yún. On Linux systems, additional software can be installed using a tool called the "opkg". 
You can find pre-compiled packages for LininoOS on their latest version, here.

External storage on the Yún

You're discouraged from using the Yún's built-in non-volatile memory, because it has a limited number of writes. 
You can use external memory like a microSD card or thumb drive for saving data, or your own scripts, web pages, etc. For the Yún to access and store information on these drives through the 32U4, they need to have a directory named arduino in the root of the volume.

Resetting the processors (AR9331, WiFi, and 32U4)

To restart the AR9331, which reboots LininoOS, press the "YÚN RST" reset button that is close to the analog inputs pins and the LEDs of the board. 
To restart the the 32U4 and restart the currently installed Arduino sketch, tap the button next to the Ethernet port two times. 
The WiFi reset button is located next to the USB-A connector. It is labeled "WLAN RST". When you press the button, the WLAN LED will flash.

Yun Reset Buttons

If you move to a different network and can no longer wirelessly access the Yún through its web interface, you can reset the Yún's network configuration by pressing the WiFi reset button (WLAN RST) for longer longer than 5 seconds, but less than 30, the AR9331 processor will reboot. The WiFi configuration will be reset and the Yún will start its own WiFi network Linino-XXXXXXXXXXXX. Any other modification/configuration will be retained.

To reset the LininoOS distribution to its default state, press the WiFi reset button (WLAN RST) for at least 30 seconds. The board reverts to the original settings: like just taken out of the box or to the latest update of the LininoOS image you have reflashed before. Among other things, this removes all installed files and network settings.

Resetting the password

The webpanel password can be reset and changed. Connect the Arduino Yún to your computer with an USB cable and upload the YunSerialTerminal sketch. It can be found in the Bridge examples in the Arduino IDE. When the Yún boot is complete, open the serial monitor, select New Line character in the dropdown menu and press Enter. Something like this should appear in your serial monitor:


Now you have to execute the passwd command to change the password. Type passwd into the serial monitor input and press enter. You will be asked to type the new password, and re-type it to confirm. If you want, you can ignore the weak password error. If both passwords you typed match, the system password will be changed and you will be able to access to the webpanel with the new password.

Serial re-enumeration on reset.

Since the Yún does not have a dedicated chip to handle serial communication, it means that the serial port is virtual — it's a software routine, both on your operating system, and on the board itself. Just as your computer creates an instance of the serial port driver when you plug in any Arduino, the 32u4 creates a serial instance whenever it runs its bootloader. The board is an instance of USB's Connected Device Class (CDC) driver. 
This means that every time you reset the 32U4 processor, the USB serial connection will be broken and re-established. The board will disappear from the list of serial ports, and the list will re-enumerate. Any program that has an open serial connection to the Yún will lose its connection. This is in contrast to the Arduino Uno, with which you can reset the main processor (the ATmega328P) without closing the USB connection (which is maintained by the secondary ATmega8U2 or ATmega16U2 processor). This difference has implications for driver installation, uploading, and communication.

No reset when you open the serial port.

The Yún won't restart your sketch when you open a serial port on the computer. That means you won't see serial data that's already been sent to the computer by the board, including, for example, most data sent in setup(). 
This also applies to the Console, described below.

This means that if you're using any Serial or Console print(), println() or write() statements in setup(), they won't show up when you open the serial monitor or Console connection. To work around this, you can check to see if the port is open like so:

//stops the program until Serial Monitor is opened
   while (!Serial) ;
// stops the program until Console is opened
   while (!Console) ;

Configuring the onboard WiFi

Programming the 32U4 over WiFi 
If you Yun is in your computer's same network, you can upload a sketch using the Wireless Connection. 
After configuring your Yún, connect to the network you specified in the configuration settings. Open the Arduino IDE. 
Under the Tools > Port menu, you should see an entry that lists your Yún's name and its IP address. Under the Board menu, select Arduino Yún. 
Open the Blink example (File > Examples > 01Basics > Blink) and upload the sketch to the board. You will be prompted for the administrator password. Use the one you entered in the configuration screen. 
Once the program is uploaded, the 32U4 processor will restart. You should see the LED connected to pin 13 blinking. 
Using the onboard Ethernet 
When you connect the Yun to a wired network with an ethernet cable, it will try to connect automatically via DHCP. The board will show up on the ports menu just as it would over WiFi. 
If you want to connect the Yun directly to your computer, either configure the computer's interfaces to have a static IP address, or act as a DHCP server.

NB: the ethernet interface is eth1, not eth0

Communicating with LininoOS via Bridge

The Bridge library enables communication between Arduino and LininoOS. There are several different utility classes that facilitate different kinds of communication between the two, described below, and more in depth on the Bridge library reference pages. 
The WiFi and Ethernet interfaces, USB host, and SD card are all connected to the AR9331. The Bridge library allows you to work with these devices, as well as run scripts and communicate with web services.

The Console

The Console, based on Bridge, enables you to send information from the Yún to a computer just as you would with the serial monitor, but wirelessly. It creates a secure connection between the Yún and your computer via SSH. 
Load the following onto your Yún :

const int ledPin = 13; // the pin that the LED is attached to
int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:

  while (!Console) {
    ; // wait for Console port to connect.
  Console.println("You're connected to the Console!!!!");
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);

void loop() {
  // see if there's incoming serial data:
  if (Console.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte =;
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);

To see the Console, select your Yún's name and IP address in the Port menu. The Yún will only show up in the Ports menu if your computer is on the same LAN as the Yún. If your board is on a different network, you won't see it in the Ports menu. Open the Port Monitor. You'll be prompted for the Yún's password. 
You can also see the Console by opening a terminal window and typing "ssh root@yourboardname.local" 'telnet localhost 6571' then pressing enter. 
Note: If you are using Windows, you must install a terminal emulator. PuTTY is a reasonable choice, but you will have to enter the two commands above separately. 
Type 'H' to turn the LED on pin 13 on and type 'L' to turn it off.


The Process commands allow you to run Linux processes on LininoOS through the Arduino. 
In the following example, the LininoOS will connect to a server with curl, and download some ASCII text. It prints the text a serial connection.
#include <Process.h>

void setup() {
// Initialize Bridge

// Initialize Serial

// Wait until a Serial Monitor is connected.
while (!Serial);

// run various example processes

void loop() {
// Do nothing here.

void runCurl() {
// Launch "curl" command and get Arduino ascii art logo from the network
// curl is command line program for transferring data using different internet protocols
Process p; // Create a process and call it "p"
p.begin("curl"); // Process that launch the "curl" command
p.addParameter(""); // Add the URL parameter to "curl"; // Run the process and wait for its termination

// Print arduino logo over the Serial
// A process output can be read with the stream methods
while (p.available()>0) {
char c =;
// Ensure the last bit of data is sent.

Using Bridge to pass information between processors

Bridge allows you to pass information between the two processors using a key/value pairing. 
This example shows how to use the Bridge library to access the digital and analog pins on the board through REST calls. It demonstrates how you can create your own API when using REST style calls through the browser. 
When running this example, make sure your computer is on the same network as the Yun. 
When you have have programmed the board, you can request the value on a pin, write a value to a pin, and configure a pin as an input or output. 
When the REST password is turned off, you can use a browser with the following URL structure :
http://myArduinoYun.local/arduino/digital/13 : calls digitalRead(13);
http://myArduinoYun.local/arduino/digital/13/1 : calls digitalWrite(13,1);
http://myArduinoYun.local/arduino/analog/9/123 : analogWrite(9,123);
http://myArduinoYun.local/arduino/analog/2 : analogRead(2);
http://myArduinoYun.local/arduino/mode/13/input : pinMode(13, INPUT);
http://myArduinoYun.local/arduino/mode/13/output : pinMode(13, OUTPUT);

You can use the curl command from the command line instead of a browser if you prefer. 
You need to include the Bridge, YunServer, and YunClient libraries :

#include <Bridge.h>
#include <YunServer.h>
#include <YunClient.h>

Instantiate a server enabling the the Yun to listen for connected clients using the object YunServer server; 
In setup(), start serial communication for debugging purposes, and turn the built-in LED on pin 13 high while Bridge begins. Bridge.begin() is blocking, and should take about 2 seconds to complete. Once Bridge starts up, turn the LED off.

void setup() {
digitalWrite(13, LOW);
digitalWrite(13, HIGH);

In the second part of setup(), tell the instance of YunServer to listen for incoming connections only coming from localhost. Connections made to LininoOS will be passed to the 32U4 processor for parsing and controlling the pins. This happens on port 5555. Start the server with server.begin().


In loop(), you'll create an instance of the YunClient for managing the connection. If the client connects, process the requests in a custom function (described below) and close the connection when finished. 
Putting a delay at the end of loop() will be helpful in keeping the processor from doing too much work.

void loop() {
YunClient client = server.accept();

if (client) {

Create a function named process that accepts the YunClient as its argument. Read the command by creating a string to hold the incoming information. Parse the REST commands by their functionality (digital, analog, and mode) and pass the information to the appropriately named function.
void process(YunClient client) {
String command = client.readStringUntil('/');

if (command == "digital") {
if (command == "analog") {
if (command == "mode") {
Create a function to deal with digital commands. Accept the client as the argument. Create some local variables to hold the pin and value of the command.
void digitalCommand(YunClient client) {
int pin, value;
[Get Code]
Parse the client's request for the pin to work with using client.parseInt().

If the character after the pin is a "/", it means the URL is going to have a value of 1 or 0 following. This value will assign a value to the pin, turning it HIGH or LOW. If there is no trailing "/", read the value from the specified pin.

pin = client.parseInt();

if ( == '/') {
value = client.parseInt();
digitalWrite(pin, value);
else {
value = digitalRead(pin);
Print the value to the client and update the datastore key with the current pin value. 
By wrapping the value to the client in F(), you'll be printing form the flash memory. This helps conserve space in SRAM, which is useful when dealing with long strings like URLs. 
The key will be the pin, and type. For example D2 will be saved for for digital pin 2. The value will be whatever value the pin is currently set to, or was read from the pin.
client.print(F("Pin D"));
client.print(F(" set to "));

String key = "D";
key += pin;
Bridge.put(key, String(value));
Set up a function to handle analog calls in the same fashion, except setting the key to A instead of D when working with the analog input pins :
void analogCommand(YunClient client) {
int pin, value;

pin = client.parseInt();

if ( == '/') {
value = client.parseInt();
analogWrite(pin, value);

// Send feedback to client
client.print(F("Pin D"));
client.print(F(" set to analog "));

String key = "D";
key += pin;
Bridge.put(key, String(value));
else {
value = analogRead(pin);

client.print(F("Pin A"));
client.print(F(" reads analog "));

String key = "A";
key += pin;
Bridge.put(key, String(value));
Create one more function to handle pin mode changes. Accept the YunClient as the argument, and create a local variable to hold the pin number. Read the pin value just as you did in the digital and analog functions.
void modeCommand(YunClient client) {
int pin;
pin = client.parseInt();
[Get Code]
Check to make sure the URL is valid

if ( != '/') {
If it's a valid URL, store the URL as a string. If the mode is an input or output, configure the pin and report it to client. If the string doesn't match those values, return an error.
String mode = client.readStringUntil('\r');

if (mode == "input") {
pinMode(pin, INPUT);
// Send feedback to client
client.print(F("Pin D"));
client.print(F(" configured as INPUT!"));

if (mode == "output") {
pinMode(pin, OUTPUT);
// Send feedback to client
client.print(F("Pin D"));
client.print(F(" configured as OUTPUT!"));

client.print(F("error: invalid mode "));

What is LininoIO?

LininoIO is a software framework able to integrate microcontroller features inside the microprocessor environment.
You can simply write your application using Node.js, Python, Bash, etc., on linux side using LininoOS to control completely the board and all the devices attacched.

How works LininoIO Start and Stop?

Once rebooted and logged again in by means of SSH, you have to perform the final step by running the lininoio script to fully enable the lininoIO functionalities :
$ lininoio -h USAGE : lininoio <-f> <start/stop> - enables/disable the LininoIO features with the optional `force` switch       lininoio -v : prints out the versioning details of the LininoIO operating system       lininoio -s : shows the current status of the LininoIO features (ENABLED/DISABLED)       lininoio -h : prints out this HELP
please also pay attention to the fact that you have to run this script when logged in by means of SSH otherwise you might damage your board. So once gained root access at the shell type :
$ lininoio start
and a disclaimer will appear :
WARNING ! Please be sure to run lininoio when connected by means of SSH to your board, otherwise you could damage your board !Do you want to proceed ? y/n
then answer YES (y) and another question will pop-up before starting the actual process :
Do you want to enable the LininoIO OS features ? y/n
and answer YES (y) again. At the end of the process you will be asked to reboot your board, just answer YES (y) one more time and then wait a couple of minutes before logging in again.

Why use LininoIO Start and Stop?

When you want to use your board as a "classic Arduino user", use the Stop command. This you need, if you want to upload your sketch with your IDE. You can, however, use the Linux, using the library Bridge.

When you do not want to program the MCU via sketches, but want to use the board from Linux, then starts to LininoIO with the Start command.