Understanding the Arduino Yún’s Bridge

The Arduino Yún is based on Atmel’s ATMega32u4 microcontroller (MCU) and also features the Atheros AR9331, an SoC running Linino.

Earlier this week, Bits & Pieces took a closer look at the board’s hardware and today we’ll be getting up close and personal with the Arduino Yún’s Bridge, describing how it helps facilitate communication between the two processors.

According to Arduino’s Federico Vanzati, the Bridge comprises two distinct parts. The first, written in Python, runs on the GNU/Linux processor and is tasked with three primary functions: Executing programs on the GNU/Linux side, providing a shared storage space for data and receiving/relaying commands from the Internet – passing them directly to the Arduino.

Meanwhile, the other part of Bridge is the library that runs on the 32U4, allowing users to access the Linino parts of Bridge through their sketches.

“With the Bridge you can do some awesome things by communicating between the 32U4 and the AR9331 processors,” Federico explained. “Some examples could be commanding and controlling your sketch over the Internet from a remote location, accessing remote APIs to get data for your sketch to process, or executing programs or scripts too complex to write in an Arduino sketch.”

For example, says Federico, if someone at home wanted to know if their office or workspace was comfortable enough to work in, they can simply connect a LDR sensor and thermistor to the Yún on a wireless network.

“Your sketch can access the board’s shared storage to publish the readings every second to a webpage running on the AR9331. By accessing the URL http://arduino.local/data/get you can call up those readings, letting you know if it’s bright enough but not too hot to get to work on your next project. Your sketch could also store the sensor readings on a Google Drive spreadsheet or publish them on Facebook,” he added.

In addition, the Bridge eliminates the need to upload a new version of a sketch to change text on an LCD screen, as sketches can use the shared storage to read the text to display, changing it remotely from a browser using REST based calls. Meaning, if the text to be displayed is identified by the label “lcd_text,” accessing the URL http://arduino.local/data/put/lcd_text/Hello%20World will show “Hello World” on the LCD.

Interested in learning more about the Yún’s Bridge? You can check out Arduino’s official “hands-on” guide to the Bridge here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s