Hardware Reference
In-Depth Information
overwrite the original i rmware—something that could be undone later if needed.
An entire generation of routers were designed around this initial product, and
the new i rmware was released under the name OpenWRT.
The power of OpenWRT was not only that it added advanced features, but
it also contained a package manager, meaning users could install their own
programs. The i lesystem is also read/write-capable, meaning that users could
create and update i les. A simple WRT54G device could be placed anywhere, act
as a sensor, and log the results to a data i le. The router was no longer a router
but a small computer.
Since its early days, OpenWRT has been under heavy development, becom-
ing an extremely complex distribution, no longer limited to Linksys devices.
One device to which the OpenWRT has been ported is the Arduino Yún. This
board is actually two devices in one; on one side, it has an ATMega32u4, which
is the “Arduino” side. The other side is based on an Atheros AR9331. This chip,
with its corresponding RAM, Ethernet, and Wi-Fi chip, hosts an OpenWRT
distribution called Linino. To allow the AVR to communicate with the Atheros,
a library was created: Bridge.
NOTE You can modify fi les on the root fi lesystem of the Yún; however, it is strongly
advised to use external storage. The Arduino Yún has an on-board micro-SD slot to
expand fi lesystem space.
Bridge
The Arduino side of the Yún can send commands and data requests to the Linux-
side of the device; these instructions are interpreted by a Python 2.7 interpreter
on OpenWRT. In order to begin communications, you must import the Bridge
library. This can be done inside the Arduino IDE, by going to the menu Sketch 
Import Library
Bridge, or by adding the include lines manually:
#include <Bridge.h>
#include <YunClient.h>
#include <Process.h>
#include <Mailbox.h>
#include <HttpClient.h>
#include <Console.h>
#include <YunServer.h>
#include <FileIO.h>
The i rst include, Bridge.h , is required for intersystem communication. The
other includes are required only when using specii c portions of the library. The
YunClient.h include is required for HTTP client operations, similar to Ethernet
client includes. Similarly, YunServer.h is required when the Arduino becomes
 
Search WWH ::




Custom Search