Arduino Yún
Back to current versionRestore this version

Arduino Yún

The Arduino Yún (Yún which means "cloud" in Mandarin) is unusual in that it combines what is effectively a 16MHz Arduino Leonardo microcontroller with an Atheros AR9331, a 400MHz microprocessor running OpenWrt (a version of Linux), so it's a bit like a combination of an Arduino and a Raspberry Pi on one board the size of the Arduino Uno.

Here's some miscellaneous notes regarding the Yún.

Installation Notes#

Despite being a 400MHz processor and being connected directly via an ethernet cable, it is good to remember that the Yún is still quite a small computer. It's not as fast as a Raspberry Pi (a Pi 3 B+ runs at 1.1GHz) and you can run out of memory (and need to reboot) sometimes.

Once you've connected the Yún to your network via an ethernet cable (WiFi comes later) you upload the "YunFirstConfig" sketch using the Arduino IDE. Then open the serial console, and you'll be presented with some questions, including your WiFi network name, network password, the name and Linux password for your Yún. Then you can log into the Yún via a web browser and further configure it.

There's also a YunSerialTerminal sketch which permits you to open a console directly to the Yún from the Arduino IDE's serial monitor. There's a single line at the top of the monitor and a "Send" button — not quite a normal terminal experience but it works. Once the Yún is available on your WiFi network you can just remotely connect to it using ssh.

 $ ssh root@192.168.1.73
 root@192.168.1.73's password: •••••••
 BusyBox v1.28.3 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 LEDEYun 17.11, r6773+1-8dd3a6e
 -----------------------------------------------------
root@yun:~#

You use the opkg page manager rather than apt on Debian systems. The package names on OpenWrt are slightly different than Debian or other Linux flavours, so you might have to use opkg find name to find a software package (or look on the OpenWrt website for clues). You can install either python3 (the full package) or python3-light, which aims to provide most of what people need, and then just install the python3 subpackages as necessary. On a computer as small as a Yún you generally want to save as much space as possible. It wasn't an issue for me because I expanded the Yún's native drive space with a 32GB SD card (this is highly recommended, link below).

Once logged in via ssh here's what I did (abridged version):

 # opkg update -y
 # opkg install tcsh
 # opkg install blkid
 # opkg install vim-full
 # opkg install python3-light
 # opkg install python3-pip

The tcsh is just a personal preference, rather than using the native bash shell. With the customised prompt (below) I get a nice colorful prompt. And yes, it's possible to do this with bash, but tcsh has a lot of nice features that I'm accustomed to.

The Yún comes with Python 2 but I want to use Python 3, so I'll be installing vim, tcsh, Python3, and pip3. The python3 package installs the entirety of Python 3, so it seems python3-light is meant to generally suffice for most people. Based on the difference in install times, it's significantly smaller. After installing pip3 you should be able to do things like:

 # pip3 install python3-yaml

When installing git you'll also need ca-bundle in order to be able to handle https: URLs.

 # opkg install ca-bundle git
After that you should be able to perform a git clone successfully.

Important#

Tcsh changes#

I have a personal preference for tcsh. Once installed I include these three files in the home directory (/root) for configuration:

.cshrc#

#!/bin/tcsh

set path = ( \
    . \
    ~/bin \
    /usr/sbin \
    /usr/bin \
    /sbin \
    /bin )

if ( -f ~/.aliases ) source ~/.aliases
if ( -f ~/.prompt ) source ~/.prompt

umask 022

.aliases#

alias ls '/bin/ls --color=auto'
alias lsa 'ls -alF'
alias h 'history'
alias c 'clear'
alias u 'cd ..'
alias uu 'cd ..;cd ..'
alias uuu 'cd ..;cd ..;cd ..'
alias uuuu 'cd ..;cd ..;cd ..;cd ..'
alias uuuuu 'cd ..;cd ..;cd ..;cd ..;cd ..'
alias pud 'pushd'
alias pod 'popd'
alias rsrc 'source /root/.cshrc'

.prompt#

#!/bin/tcsh
if ( $?tcsh ) then
    # tcsh-specific commands:
    set prompt="\
 %{\033[3;32m%}[\!]%B %m: %b %{\033[35m%} %/%}\
 %{\033[0;37m%}...%{\033[0m%} "
endif

References#


Tags:  Arduino