Expanding your Arduino YUN

Arduino recently released an upgrade to the YUNs firmware, as well as give tips on expanding the 8MB onboard flash memory to utilise an SD card.

Sounds great doesn’t it? However, I hit a few snags along the way, and hopefully you can learn from my experiences.

First things first, make sure you have the latest Arduino IDE release (1.5.6-r2 at time of writing)

Next we need to get the new firmware onto a Micro SD card. Get it here.

Note: I have multiple YUNs, so they are named yun01, yun02… not ‘arduino’ like they come out the box. Expect to see references to ‘yun01.local’ as opposed to ‘arduino.local’, which is the default.

I already have SSL on my YUN, but you can also put the bin on there via a card-reader (I don’t have one).

Upload via SSL – I’m using Cyberduck, you’ll want to put it in ‘www/sd’

From there, follow the steps from the Arduino blog, i.e. in Terminal, open a connection to your YUN:

ssh root@yun01.local (see naming above)

run-sysupgrade /mnt/sd/arduino/www/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin

…that’s it! It’ll install and restart the board.

Note: Arduino blog used this path > run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin

 

Format SD card

Does your Yun needs to be physically connected or use will you use Wifi? I ask because I’ve had issues with Bridge when connected via the Yun’s wifi. I’m unable to use the Yun on my employers Wifi (due to multicasting, I think), so it’s currently either connected via Ethernet cable or paired with my phone – it needs to get online to ‘update software list’

IMG_8371

Get the ExpandingYunDiskSpace sketch

Open and upload to your YUN via the Arduino IDE.

Warning – if you make a mistake , i.e. use uppercase instead of lowercase or mistype, you’ll see ‘Goodbye’. Grrrrr

I had to quit the Arduino app, and upload the BareMinimum sketch, prior to uploading the Yún Disk Space Expander sketch again. If that fails, pull the USB so that it powers off and reconnect. They can be temperamental.

Upload again (if applicable)…

Say ‘yes’ a few times, and partition the SD card.

Now reset, via the Yun’s onboard button (YUN RST).

Screen Shot 2014-05-07 at 12.07.34

You’ll probably want to confirm the partitioning, so in the Serial Monitor enter:

df -h / /mnt/sda1

[Press Send] (you may have to do it twice)

 

You’ll be rewarded with:

root@Arduino:/# df -h / /mnt/sda1

Filesystem                Size      Used Available Use% Mounted on

rootfs                  516.1M     25.1M    465.1M   5% /

/dev/sda1               449.7M     16.0K    449.7M   0% /mnt/sda1

root@Arduino:/#

Note: I’m reusing cards, this one was only 1GB, so I’ve assigned 516.1MB to the ‘rootfs’ (root file system)

 

Reconfigure YUN

Next I reconfigure the Yun, as it has been reset.

http://arduino.local

password: ardunio

Configure and restart…

You’ll want to link to the Yun’s wifi at this point if not on the same network (ball-ache, I know), and I’m using Ethernet cables for this reason…

IMG_8375

Install Packages

Next we want to replace all our files that we removed.

I use a few libraries as standard for SSL, sound, webcam, Node, etc

You may want to read this first, as I found I had to send my packages to the SC card

I like to use Terminal to install packages but it can be done in the Serial Terminal (although I haven’t tried it)

 

Open Terminal

ssh root@yun01.local (or whatever your’s is called)

I hit a problem here and had to dig into /Users/your_name/.ssh/known_hosts to delete references to yun01! Grrrrrrr

If you don’t have this problem then skip ahead …

Screen Shot 2014-05-07 at 12.28.19

To do this I had to make my hidden files visible. Show Hidden files (in Terminal):

defaults write com.apple.finder AppleShowAllFiles TRUE

killall Finder

Open /Users/your_name/.ssh/known_hosts (you can use any text editor including TextEdit)

Delete the line related to your Yun’s name. Save and Close.

Back to Terminal. Hide files again (if you want):

defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Great, so that’s done, we can finally get back to installing Node, SSL, etc…

 

Install Packages (again)

Still in Terminal,

ssh root@yun01.local

 

Mount our newly partioned SD card

cd /mnt/sda1/arduino (<< not sure this step is needed?)

opkg update

opkg install openssh-sftp-server

opkg install python-openssl

opkg install node

opkg install kmod-video-uvc

opkg install fswebcam

opkg install node-serialport

…and whatever else you like.

 

How much have we just managed to install?

df -h / /mnt/sda1

Screen Shot 2014-05-07 at 14.47.08

Now we can see that over 52MB has been installed to our SD card.

Previously that little lot would have filled the onboard flash!

 

I hope this was helpful.

Happy tinkering.

 

Leave a Reply

Your email address will not be published. Required fields are marked *