5 min read

Arduino is an open source electronics platform that makes it easy to interface with sensors, lights, motors, and much more with a small standalone board. Arduino Yún combines a standard Arduino micro-controller with a tiny Linux computer, all on the same board! The Arduino micro-controller is perfectly suited to interfacing with hardware like sensors and motors, and the Linux computer makes it easy to get online to the Internet and perform more intensive tasks. The combination really is the best of both worlds. This post will introduce Arduino Yún and give you some ideas of the possibilities that it opens up.

Arduino Yun - powerful programming over wifi

The key to the Yún is that it has two separate processors on the board. The first provides the normal Arduino functions using an ATmega32u4 micro-controller. This processor is perfect for running “low-level” operations like driving timing-sensitive LED light strips or interfacing with sensors. The second processor is an Atheros AR9331 “system on a chip” that is typically used in WiFi access points and routers. The Atheros processor runs a version of Linux derived from OpenWRT and has built-in WiFi that lets it connect to a WiFi network or act as an access point. The Atheros is pretty wimpy by desktop standards (400MHz processor and 64MB RAM) but it has no problem downloading webpages or accessing an SD card, for example—two tasks that would otherwise require extra hardware and be challenging for a standard Arduino board.

One selling point for the Arduino Yún is that the integration between the two processors is quite good and you program the Yún using the standard Arduino IDE (currently you need the latest beta version). You can program the Yún by connecting it by a USB cable to your computer, but much more exciting is to program it over the air, via WiFi! When you plug the Yún into a USB power supply it will create a WiFi network with a name like “Arduino Yun-90A2DAF3022E”. Connect to this network with your computer and you will be connected to the Yún! You’ll be able to access the Yún’s configuration page by going to http://arduino.local in your web browser and you should be able to reprogram the Yún from the Arduino IDE by selecting the network connection in Tools-> Port.


There’s a new access point in town

Being able to reprogram the board over WiFi is already worth the price of admission for certain projects. I made a sound-reactive hanging light sculpture and it was invaluable to adjust and “dial in” the program inside the sculpture while it was hanging in the air. Look ma, no wires!

Programming over the air

The Bridge library for Arduino Yún is used to communicate between the processors. A number of examples using Bridge are provided with the Arduino IDE. With Bridge you can do things like controlling the pins on the Arduino from a webpage. For example, loading http://myArduinoYun.local/arduino/digital/13/1 in your browser could turn on the built-in LED. You can also use Bridge to download web pages, or run custom scripts on the Linux processor. Since the Linux processor is a full-blown computer with an SD card reader and USB, this can be really powerful. For example, you can write a Python script that runs on the Linux processor, and trigger that script from your Arduino sketch.

The Yún is ideally suited for the “ Internet of Things”. Want to receive an e-mail when your cat comes home? Attach a switch to your pet door and have your Yún e-mail you when it sees the door open. Want to change the color of an LED based on the current weather? Just have the Linux processor download the current weather from Yahoo! Weather and the ATMega micro-controller can handle driving the LEDs. Temboo provides library code and examples for connecting to a large variety of web services.

The Yún doesn’t include audio hardware, but because the Linux processor supports USB peripherals, it’s easy to attach a low-cost USB sound card. This tutorial has the details on adding a sound card and playing an mp3 file in response to a button press. I used this technique for my piece Forward Thinking Sound at the Art Hack Day in Paris that used a Yún to play modem sounds while controlling an LED strip. With only 48 hours to complete a new work from scratch, being able to get an mp3 playing from the Yún in less than an hour was amazing!

Arduino Yun with USB sound card and LED strips

Yún with USB sound card, speakers and LED strip. Forward Thinking Sound at Art Hack Day Paris.

The Arduino Yún is a different beast than the Raspberry Pi and BeagleBone Black. Where the other boards are best thought of as small computers (with video output, built-in audio, and so on) the Arduino Yún is best thought of as the combination of an Arduino board and WiFi router than can run some basic scripts. The Yún is unfortunately quite a bit more expensive than a standard Arduino board, so you may not want to dedicate one to each project. The experience of programming the Yún is generally quite good—the Arduino IDE and Bridge library make it easy to use the Yún as a “regular” Arduino and ease into the network/Linux features as you need them. Once you can program your Arduino over WiFi and connect to the Internet, it’s a little hard to go back!

About the author:

Michael Ang is a Berlin-based artist and engineer working at the intersection of art, engineering, and the natural world. His latest project is the Polygon Construction Kit, a toolkit for bridging the virtual and physical realms by constructing real-world objects from simple 3D models. He is one of the organizers of Art Hack Day, an event for hackers whose medium is tech and artists whose medium is technology.


Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.

LEAVE A REPLY

Please enter your comment!
Please enter your name here