ArduinoYunOpenWrt101
Arduino Yun and OpenWRT 101
This tutorial covers a little introduction to video recording with on the awesome Arduino Yun board!
I assume that the reader has a pc or a mac (named Bob) and an Arduino Yun, named Arduino. Moreover, I suppose the reader is quite familiar with the computer in general and know a little bit of shell/linux commands. In particular I in my case Bob is a mac os/x and, and everything is starting with an iTerm2 session where everything begin with a dollar sign ($)..
Some tricks
What I'm using (but not strictly needed if not specified) is iTerm2 as shell terminal on Bob with Oh-My-Zsh as shell, and Sublime Text 2 as a free text/code editor (that is a nice cross-platform generic text editor).
Let's become confident with the board
arduino.local does not always resole, so safely to use the ip number (192.168.240.1, for initial configuration) then the host name.
SSH from Bob to Arduino
To log into the yun via ssh (from Bob shell):
$ ssh root@192.168.1.13
Now you're logged in the Arduino Yun linux board. We are inside an embedded linux machine, in particular a child of OpenWrt. For briefness I will differentiate what is happening inside the iTerm session in Bob with $ and what is happening inside the yun shell accessed via ssh with ~.
Know where we are
See which distribution, kernel version, etc:
~ cat /proc/version Linux version 3.8.3 (federico@smilzo) (gcc version 4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #8 Mon Aug 19 16:22:39 CEST 2013
See devices already mounted:
mount
After each installed package, to see free space on the hard disk:
~ df -h Filesystem Size Used Available Use% Mounted on rootfs 7.5M 4.9M 2.6M 66% / /dev/root 7.0M 7.0M 0 100% /rom tmpfs 29.9M 372.0K 29.5M 1% /tmp tmpfs 512.0K 0 512.0K 0% /dev /dev/mtdblock3 7.5M 4.9M 2.6M 66% /overlay overlayfs:/overlay 7.5M 4.9M 2.6M 66% / /dev/sda1 7.4G 848.0K 7.4G 0% /mnt/sda1
Basic networking
Find out the ip of Arduino Yun
Upload a sketch that via Bridge library (for instance Process class) run the netstat command and print out the result on Serial Monitor.
Run a python server from Arduino
To run a python server
~ python -m SimpleHTTPServer
To grab a file from Bob via the brand new Http server just open a browser and ...
See open port on Arduino
See if python server is running (from Bob):
$ nmap 192.168.1.13 Starting Nmap 6.40 ( http://nmap.org ) at 2014-04-30 13:03 CEST Nmap scan report for 192.168.1.13 Host is up (0.19s latency). Not shown: 995 closed ports PORT STATE SERVICE 22/tcp open ssh 53/tcp open domain 80/tcp open http 443/tcp open https 8000/tcp open http-alt Nmap done: 1 IP address (1 host up) scanned in 39.77 seconds