Saturday, April 25, 2015

Arduino Packaging

Adafruit made an interesting suggestion regarding the Arduino vs. Arduino lawsuit. Adafruit noticed that the packaging for the Arduino Uno and Leonardo includes a pamphlet that states:

Manufactured under license
from Arduino by

Smart Projects is the former name of Arduino Srl. Arduino Srl is claiming to be the trademark holder and has forked the Arduino IDE.

If Arduino Srl feels they own the trademark, why would they include this statement in their packaging?

Here are my package inserts from retail Arduino packages over the past couple years.  They all have the license text.

Unlike Sparkfun who decided to walk a line between the companies, I believe the - the original founders - as holding the Arduino ecosphere rights (it was their creative work from which the project was born).

Monday, April 6, 2015

Using the Arduino IDE to Program the Raspberry Pi and Other Devices

Ever wish you could prototype a Raspberry Pi program as easily as prototyping on Arduino?

The Arduino IDE allows nearly any processor to be programmed with the same easy to use language. Back in 2012, this was possible: it takes architecture changes by the Arduino group (, some programming by code library developers (,, many others), and from users to get all of this working.

The parts are now in place to do this: the latest Arduino IDE releases are in a new 1.6.x branch, the latest as of this article is 1.6.3.  This release is revolutionary in having the following:
  • A new library manager - libraries can be installed with several clicks from a website without downloading code and installing it in a specified place on the user's PC.
  • The capability to specify new boards that are not quite the same as Arduino boards. Companies have done this by hacks and creating special versions of the Arduino IDE which can get confusing after a bit.
  • A mechanism to easily specify and use code compilers other than the Atmel AVR.  The Atmel SAM series is available after installing the 1.6.3 version if you request it. 
In the same manner as the SAM (Arduino Due) capability can now be an add-on once the initial IDE is installed, other companies are working (quickly) to add the capability to incorporate their products. Obvious candidates include:
  • Non-Arduino Atmel AVR boards
  • Arduino "compatibles" - like the Teensy series which is very popular
  • Boards based on ARM cores Cortex M0, M0+, M3, etc.
Take this a step further.  While running "simple minded microcontroller code" on more powerful boards seemed nonsensical not long ago as cost inefficient, those costs have plummeted. Development boards using powerful processors have come down in price thanks to Raspberry Pi, BeagleBone, and many others.  The $50, $35, $25, $12, and $8 price points all have different boards that can be used.  Even at $2 to $5, new boards like the ESP8266 Wifi controller are coming in.  So, extend your thought to using the Arduino IDE to actually run Arduino code (not just program an AVR) on:
Some will say "Why Arduino?"  The Arduino IDE and language specification, started in 2005 and extended since, has a proven track record for allowing users to easily get code running that actually interacts with the "real world".  Millions of lines of Arduino code have been released under open source licenses, allowing reuse by anyone. With such a vast repository, why not leverage this onto other microcontroller and microcomputer architectures?  With the compatibility to use C and C++ code, it is even more compelling.

Raspberry Pi as an Arduino Target

If I have some interesting Arduino code, say for controlling a near-field card reader, and wanted to port this to Raspberry Pi, I'd face a tough choice.  Think about reprogramming in Python and hope there is manufacturer library support for Python, or consider programming in C and know that I'd have to rewrite the Arduino library to work on the Pi.  Unsavory choices.

If the Arduino IDE would create a Raspberry Pi Linux executable of my Arduino sketch (program), I'd be nearly done.  Due to differences in programmable pin (GPIO) numbering, some items would require changes but those are numbers and not wholesale code structure changes.
This could increase (rapidly) the available uses for a Raspberry Pi.

With a huge body of Open Source coders who may have the interest and time, I looks like there will be many more places where we will see Arduino code running.

Friday, March 27, 2015

Arduino Day 2015 Project - Air Quality Display

Arduino Day gives folks the opportunity to showcase their work with these easy to use microcontrollers.  Today's project is something I've wanted for awhile: an Internet connected air quality display.  Folks looking to go outside want a quick glance look at how the air quality is that day.  This includes runners, those with breathing problems, and young children.


There are several blocks to the project, both hardware and software:
  • Arduino Uno Microcontroller
  • Arduino Ethernet Shield
  • Adafruit LCD Display (select one that does not require hardware SPI that conflicts with the select line).
Software used:

How it works

The ethernet shield is connected to your home network.  The software sketch ensures all the pieces are communicating, then it obtains the air quality based on the latitude and longitude of the project.  This is available in the United States for free from the U.S. Environmental Protection Agency (EPA) via their free AirNow API.  In other countries, there are some data service providers, the code would need to be written to read the other service's API and data, see the list at 

Once the data is collected, the specific data desired is parsed out of the HTTP code and API output.  Then the data is written to an LCD display.  A color display is important as the U.S. EPA has specific colors for specific air quality levels:

AQI NumbersAQI Category (Descriptor)AQI Color  Hexadecimal Color ValueCategory Number
0 - 50GoodGreen  (00e400)1
51 - 100ModerateYellow  (ffff00)2
101 - 150Unhealthy for Sensitive GroupsOrange  (ff7e00)3
151 - 200UnhealthyRed  (ff0000)4
201 - 300Very UnhealthyPurple  (99004c)5
301 - 500HazardousMaroon  (7e0023)6
So the display should be clear seen from a distance using the EPA colors what the status is.  For a 24 bit (3 byte RGB) color display, the color values specified above can be sent.  I tried to use two other displays: a large touchscreen (conflicted with the Ethernet SPI control) and a display shield (I probably have a wiring issue with it) so I jumped to a trusty display I have written about used with the Arduino Esplora.  The problem is it is discontinued and it is only 16 bit color.  SO I had to tweak the Adafruit driver library code to compile under the Arduino IDE Version 1.6.x and to use 16 bit colors.  I have tried to get similar colors but I suggest you select colors that you find are closest to the colors above.  If you can find a color picker for 16 bits, place a comment below.

You will need to get an API key from  The key is free but you need to sign up.  Replace my key in the code (please!) with your own.


I'll admit the code is not as elegant as that in many of my Adafruit tutorials.  I had to change displays late in the project.  And I did not use a GPS shield to keep the project simple but that does not help in portability.  Also I've selected the US service with a link to other countries' air quality services.  Each will probably have their own data format which will require the correct code to parse the data, that has not been done here except for the US formatting.  I'd like to have several projects from simple to more complex to show the variations, but life intervenes....

  Air Quality Monitoring
  Uses the Arduino Uno, Ethernet Shield, and Adafruit 1.8"
  display shield

  Check out the links above for our tutorials and wiring diagrams

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Based on code written by Limor Fried/Ladyada for Adafruit Industries.
  MIT license, all text above must be included in any redistribution
#include <Ethernet.h>
#include <SPI.h>      

#include <Adafruit_GFX.h>      // Core graphics library
#include <Adafruit_HX8340B.h>

// Display Color definitions
#define BLACK           0x0000
#define BLUE            0x001F
#define RED             0xF800
#define GREEN           0x07E0
#define CYAN            0x07FF
#define MAGENTA         0xF81F
#define YELLOW          0xFFE0  
#define WHITE           0xFFFF
#define ORANGE          0xF500

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; // Ethernet shield MAC address

char server[] = "";    
IPAddress ip(192, 168, 0, 178);  // select for your home network - it will try DHCP first though

EthernetClient client;

uint8_t lineCount = 0;

// TFT display will NOT use hardware SPI due to the SPI of the Ethernet shield
// SO other pins are used.  This makes the display a bit slow
#define SD_CS     4   // Chip select line for SD card
#define TFT_CS    9   // Chip select line for TFT display
#define TFT_SCLK  6   // set these to be whatever pins you like!
#define TFT_MOSI  7   // set these to be whatever pins you like!
#define TFT_RST   8   // Reset line for TFT (0 = reset on Arduino reset)
Adafruit_HX8340B tft(TFT_MOSI, TFT_SCLK, TFT_RST, TFT_CS);

void setup(void) {

  Serial.println(F("Air Quality Monitor"));
  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:
    // try to congifure using IP address instead of DHCP:
    Ethernet.begin(mac, ip);
  // Give the Ethernet shield a second to initialize:
  Serial.println("Ethernet connecting...");
  // if you get a connection, report back via serial:
  if (client.connect(server, 80)) {
    Serial.println("Ethernet connected");
    // Make a HTTP request
    // Change the latitude/longitude for your location
    // You need your own API key from pasted into the string below
    // If you will go mobile, get lat/long from GPS or from your outward IP address
    //   from a service like
    client.println("GET /aq/forecast/latLong/?format=text/csv&latitude=38.8&longitude=-77.3&distance=25&API_KEY=FE62B688-EE27-4214-8BD8-9903E1AC5881 HTTP/1.1");
    client.println("Connection: close");
  else {
    // If you didn't get a connection to the server:
    Serial.println("Ethernet connection failed");
  tft.begin();           // Initialize  TFT
  tft.setRotation(1);    // Landscape display

void loop() {
  char buffer[160];      // The HTTP read buffer - the maximum line returned by the API is 158 chars
  char partInfo[4][10];  // The air quality values are placed in 4 strings of length 10 characters
  uint8_t tokenCount, valueCount;
  char *bufValue;
  char *bufPtr;

  if (client.available()) {
    byte numChar = client.readBytesUntil((char)0x0a,buffer,159);  // Read until a line feed character
    lineCount = lineCount + 1;
    if(lineCount == 11) {  // Parse first record
      Serial.print("-> ");
      bufPtr = strtok(buffer,",");
      while(bufPtr != NULL && valueCount < 10) {
        if(valueCount > 5) {
          strcpy(partInfo[tokenCount], bufPtr+1);
        bufPtr = strtok(NULL,",");
      for( uint8_t i=0; i<4; i++) {
        for( uint8_t j=0; j<10; j++) {
          if(partInfo[i][j] == '"') {  // the second quotes is the end of the string we want
            partInfo[i][j] = '\0';     //   so replace it with the C null end of string character
    } else {
      Serial.print(": ");

  if (!client.connected()) {
    Serial.println("Ethernet disconnecting.");
    /* process the values */
    uint32_t colorAQI = AQI2hex(atoi(partInfo[1]));
    //Serial.print("Color set: ");
    drawtext("Air Quality Today", BLACK, 2, 10, 10);
    drawtext(partInfo[3], WHITE, 3, 40, 40);
    drawtext(partInfo[1], WHITE, 3, 85, 80);
    drawtext("Type:", WHITE, 3, 20, 120);
    drawtext(partInfo[0], WHITE, 3, 110, 120);
      ; // Infinite loop, press reset button to get daily reading
        // It's best to have a real time clock to pull the value at midnight
        // Perhaps a GPS shield would get the time and the lat/long but be sure 
        // to deconflict the data pins if necessary.

uint32_t AQI2hex(uint16_t AQI) {   // see color tablee for mandated color coding
  if(AQI <=  50) return(GREEN); // Green
  if(AQI <= 100) return(YELLOW); // Yellow
  if(AQI <= 150) return(ORANGE); // Orange
  if(AQI <= 200) return(RED); // Red
  if(AQI <= 300) return(MAGENTA); // Purple
  return(0x8000); // Maroon

void drawtext(char *text, uint16_t color, uint8_t tsize, uint8_t x, uint8_t y) {
  tft.setCursor(x, y);

Saturday, March 14, 2015

The Wonder of Pi Day

Pi Day, the day in the calendar that comes closest to the transcendental number Pi denoted by the Greek letter π, with a value of 3.14159265......  The circumference of a circle is π times the diameter. Anyone reveling in the fact that March 14, 2015 can be written 3/14/15, like the numbers of Pi, must be rather special.

The number of articles discussing folks reveling in the science and fun of celebrating Pi on March 14th has exploded. People of all ages are going gaga with those who like science or just some fun coming out to celebrate in many way.  Celebrations often involve making and eating Pie the dessert, due to the similarity in pronunciation between Pi and Pie.

Wikipedia public domain by  GJ_on_Wiki 
More permanent celebrations of Pi are placed around the world such as this depiction at the Mathematics Building at the Technical University of Berlin.

Wikipedia CC BY-SA 3.0 Holger Motzkau
As my focus has been with the Maker movement, specifically mainly with electronics, I love projects incorporating information about Pi day.  So my project uses a very nice Adafruit 8x32 programmable LED grid as a marquee to scroll "Happy Pi Day 3.14.15" in red, green, and blue text.  A video of the project is below:

 The code for the project:

// Program for Flexible 8x32 NeoPixel RGB LED Matrix
// Scrolls text across the matrix 
// Mike Barela 3/12/2015  MIT License, attribution appreciated

#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#define PIN 12 // NeoPixel data pin on Uno

// Parameter 1 = width of NeoPixel matrix
// Parameter 2 = height of matrix
// Parameter 3 = pin number (most are valid)
// Parameter 4 = matrix layout flags, add together as needed:
//     Position of the FIRST LED in the matrix; pick two, e.g.
//     NEO_MATRIX_TOP + NEO_MATRIX_LEFT for the top-left corner.
//   NEO_MATRIX_ROWS, NEO_MATRIX_COLUMNS: LEDs are arranged in horizontal
//     rows or in vertical columns, respectively; pick one or the other.
//   NEO_MATRIX_PROGRESSIVE, NEO_MATRIX_ZIGZAG: all rows/columns proceed
//     in the same order, or alternate lines reverse direction; pick one.
//   See example below for these values in action.
// Parameter 5 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

// Example for Flexible 8x32 NeoPixel RGB LED Matrix.  In this application we'd like to use it
// as a 32x8 tall matrix.  When held that way, the first pixel is at the top right, and
// lines are arranged in columns, progressive order.  The shield uses
// 800 KHz (v2) pixels that expect GRB color data.
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(32, 8, PIN,  

const uint16_t colors[] = {
  matrix.Color(255, 0, 0), matrix.Color(0, 255, 0), matrix.Color(0, 0, 255) };

void setup() {

int x    = matrix.width();

void loop() {
  matrix.setCursor(x, 0);
  matrix.print(F("Happy "));
  matrix.print(F("Pi "));
  matrix.print(F("Day "));
  matrix.print(F("3.14.15  "));
  if(--x < -(22*5)) {  // Scrolling code - 22 characters, 5 pixels wide
    x = matrix.width();

Be sure you have a power supply big enough to power that many Neopixels.  I used Adafruit's 5V 10 amp supply but a 2 amp supply at the lower brightness might suffice, 5 amps might be a good size.

If you cannot get an Adafruit matrix, a couple (or more!) Wyolum TiM LED matrices would also be very good for a similar marquee. 

Have a happy and safe Pi Day!

Monday, February 23, 2015

Pebble Watch Due Tomorrow (Picture)

This picture from the website appears to confirm the new Pebble smart watch will have a color screen.  It appears "more square" but still a bit rectangular.

I like Pebble, I have a Kickstarter version.  I think they're well ahead of other companies in this space.


Update - apparently the picture was pulled from the Pebble website so I placed a cached image in the post.

Tuesday, February 10, 2015

The Voltera V-One Circuit Board Printer Launches - Early Bird Units Available

The Voltera V-One enables circuit boards to be prototyped within minutes, eliminating the frustrations with traditional fabrication processes and drastically reducing hardware development time.  It was an award winner at CES 2015.

The V-One launches today 2/10 at 9:00 AM EST!

There will be some early bird units available at a discounted price!

The Kickstarter is at 

The website is at

Saturday, January 31, 2015

Arduino Yun, Getting Up Fast (Work In Progress)

This is a work in progress, if you see issues, post in the comments.

The Arduino Yun is an interesting part of the Arduino family.  It provides both an Arduino Leonardo based ATmega32u4 with a Linux Wifi system on a chip.
Using this particular board for the first time, here are some tips for those who know Arduino to get up and going more quickly than going piecemeal through the official Getting Started documentation and other Internet tutorials.

Power and Connections

You will want a USB A to Micro B cable, standard for most phones and electronics these days. Ensure it is a good one (decent wire gauge, not damaged) with both data and power wires.

Safely powering Yun via a regular 500ma standard USB port

Per this post, verified roughly with my USB meter, measured current:
  • Stock system booted, no connection, no sd: 200 ma~270 ma Seems to like to hover around 235~245 ma but could peak to 300 ma.
  • Stock system booted, with wired (CAT5) networking: 277 ma
  • Stock system booted, with wired (CAT5) networking, max load: 315 ma
So a regular USB 2.0 or 3.0 port will work with some power to spare.

Powering via a Power Supply

You need a 5 Volt supply that will give you at least 500 milliamps.  Do NOT use a higher level supply and expect circuitry to handle it, it cannot.  You will connect power into the micro B USB port (kinda like Raspberry Pi).  But unlike the Pi, that port is also used to upload code to the Yun if you don't use USB uploading (more later).


Now that the Yun is powered, some of the LED status lights come on if everything is ok.  Now to start talking to the Yun.

Referring to the Yun as a local device instead of by trying to figure out its IP address every time

The Yún is set from the factory to use Bonjour services for auto-discovery on a wireless network. This service is not included with Windows by default. If you do not have Bonjour already installed, you can download the service from here. Additionally, you should make sure any anti-virus software is not blocking communication on port 5353.

Connecting to Configure Yun

There is a web page that allows you to configure many of the different options available. The interface (called LuCi) gives you access to most any setting you would need for maintaining the WiFi interface.

Configuring the onboard WiFi - see

The Yún can connect to an existing network. The Yún can connect to unencrypted networks, as well as networks that support WEP, WPA, and WPA2 encryption.

When you first power on the Yún, it will create a WiFi network called ArduinoYun-XXXXXXXXXXXX. Connect your computer to this network.

Once you've obtained an IP address, open a web browser, and enter either:
  1. http://arduino.local (if Bonjour is on) or 
  2. in the address bar (the default Yun address).  No luck?  
  3. If you open the Arduino IDE (again version 1.5.8 or higher), select Yun in Tools->Board, then look under Tools->Port and you should see the IP address the IDE has found for the Yun (after the powered-up Yun has booted up and talks to your network).  Use that IP address in your web browser.  
  4. If you still do not have a web address, check your network.  Is your wifi working and handing out addresses via DHCP (pretty standard)? 
  5. You can aleays hook a wired ethernet cable to the Ethernet jack, wait a bit and try the Arduino IDE method.  If you have a properly configured network, this should result in the Arduino IDE picking up on the address on the network.
Once you enter the address determined in the steps above into your PC's web browser, a web page will appear asking for a password. Enter "arduino" (the default password) and click the Log In button.

You will find a page with some diagnostic information about the current network connections. The first is your WiFi interface, the second is your Ethernet connection. Press the Configure button to proceed.
You might only have one connection (wired shown above) but if you have an Ethernet cable, and it has connected via WiFi, it may be connected via both with two separate addresses (that is ok).

On the new page, you will configure your Yún, giving it a unique name and identifying what network you want to connect to.

In the Yún NAME field, give your Arduino a unique name. You'll use this to refer to your Yun in the future, write it down.

Choose a password of 8 or more characters for your Arduino. If you leave this field blank, the system retains the default password of arduino - write this down also.

If you wish, you can set the timezone and country. It is recommended to set these options as it may help connecting to local WiFi networks. Setting the local timezone also selects the country's regulatory domain.

Enter the name of the wiFi network you wish to connect to. Select the security type, and enter the password.  Once you finish including the wifi, you'll get a confirmation like the one below (that person had named their wifi sharkrepellant, yours will be different.

Arduino IDE

Getting the Right Arduino IDE

You'll need version 1.5.4 or higher of the Arduino IDE.  Download the latest at this page.  As of this writing, the latest is 1.5.8 beta and I now release candidates are being tested for 1.6.0.  Be sure you do NOT download the Arduino IDE versions especially tailored for the Intel Galileo and Edison boards.

The 1.0.6 version of the IDE will not support Yun.  

Also, big bummer, 1.5.8 will INSIST you uninstall 1.0.6 to load.  I dislike not being able to install where I wish and have multiple instances but there was no way around it.

The installer will load the device driver for Windows.

IDE Settings

From the Tools -> Board menu, be sure to select Arduino Yun.  It probably is not a default value, check it.  

Linux Command Line

Getting to the Linux Command Line

For Linux or Mac, go to a command line and run OpenSSH

For Windows: Install PuTTY or Git for Windows which includes a shell that has OpenSSH.

To log in try:

C:\Users\Me\Documents\GitHub> ssh -l root MyYunName.local
where MyYunName is the Yun's name chosen above.  That is a lower-case L after the -.  You can use the IP address (like instead of the local machine name.

You'll be asked for a password:

root@MyYunName.local's password:
Type in the name of the password you choose in configuring the Yun.  The default is arduino.

You should now get the Busybox shell and OpenWrt logos and be dropped at a prompt that looks like:

BusyBox v1.19.4 (2014-04-10 11:16:02 CEST) built-in shell (ash)

Enter 'help' for a list of built-in commands.
           _______                     ________        __
          |       |.-----.-----.-----.|  |  |  |.----.|  |_
          |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
          |_______||   __|_____|__|__||________||__|  |____|

                    |__| W I R E L E S S   F R E E D O M


Enable Public Key Athentication

To enable public key based authentication for root, the authorized public keys need to be added to the following file (and not the usual /root/.ssh/authorized_keys):

cat > /etc/dropbear/authorized_keys
press the <control-z> key
chmod 0600 /etc/dropbear/authorized_keys

A complete tutorial for setting up public key based authentication on OpenWRT can be found here.

Expanding the Yun Disk/File Space

The Arduino website has a good tutorial for this.  There is only about 7.5 Megabytes free.  Adding a MicroSD card storage allows for an overlay or extroot to expand the storage.  

If you plan on adding packages that will fill up Yun's space or create files that change alot (which is not good for flash memory), you'll want to do this.

Adding Linux Software Packages

To install additional software on Yun, you need to use the the Linux package manager opkg. For more information on the manager and some common commands, see the Yún package manager page.

Ensure your Yun Software is Up to Date

With the latest improvements from both the OpenWrt community and the Arduino community, version of OpenWrt-Yun installed on your Yún may be out of date. Please check the upgrade tutorial and be sure you're running the latest version available.

Setting up SFTP / SSHFS

Another thing you probably want to do: mount the Yun's filesystem on your desktop via SSH.
Below excerpted from Getting started with Arduino Yun and Autobahn.  Note it will take about 0.5 Megabytes of flash.

Mounting over SSH allows you to edit files on the Yun using your favorite editor directly on your desktop. So you don't need to fiddle with the Linux vi or other text editor editor inside a shell.

This is accomplished via SFTP (secure FTP), which is a FTP-like protocol that runs over SSH. On the Yun side, you'll need to have the SFTP package installed, login via SSH as root and type:

opkg update
opkg install openssh-sftp-server

Now, on Windows, you can use Win-SSHFS which you can download from here. It's open-source and installs without hassles. Just "Ok-Install" everything.

You'll get a small Puffy-fish icon in your quick launch bar, double click and configure a new virtual drive:

Yun's root filesystem mounted as Windows drive "I:"

When done and mounted, a new drive appears on your Windows machine, which maps to the remote Yun's root filesystem:

Yun's root filesystem mounted as a virtual drive

On Mac OSX, there is a tutorial here that walks you through setting things up with FUSE for OS X.

On Ubuntu, you can use Nautilus or the command line.

With SFTP set up, you now can simply open, edit, create, copy, delete and move files conveniently from your desktop. Which can often be more comfortable than doing everything via command line SSH.

Disable Console on Serial

You might need to use the serial connection between the MCU and the CPU. By default, there is a console attached on the Linux side to the serial, and that would need to be disabled.

Edit the file /etc/inittab and comment the following line (by preceding it with # which comments it out):

# ttyATH0::askfirst:/bin/ash --login

The Linux SoC (CPU) and the Atmel MCU are connected via a UART (a serial connection) which maps to the device /dev/ttyATH0 on the Linux side and the serial stream class Serial1 on the Arduino side. The default inittab entry on the Linux side will start a shell connected to that serial port when Linux boots. Then, when your sketch starts the Arduino Yun bridge library (by doing Bridge.begin()), the bridge library writes a command to the serial that will in turn start a script on the Linux side which then connects to the serial port. That Linux script is essentially the Linux-side part of the Yun bridge library and will keep on running regardless of whether you reload a new sketch to the MCU or reset the MCU. It will keep on running until you reset the CPU or reboot Linux (or manually kill the script). However, as long as there is a script running and using the serial port, we cannot use the serial for our purposes. The commenting of the inittab line will disable starting a shell on the serial port altogether in the first place. This means we can use the serial port for our stuff, but it also means you won't be able to use the Yun brigde library anymore.

and reboot Linux:


Be patient, a reboot (either via the reboot command like above, or by doing a cold boot via power cycling or pressing the "Yun RST" button) can take 60-90 seconds.

Environment Variables

Some programs look for data in system environment variables rather than editing them into your code. You can look at your environment variable list by typing env at a shell prompt.

To set an environment variable that will 'stick' in the current shell, type:


You can use any name you want for MYVARIABLE but it should not use spaces (use an underscore instead).  


1. Guide to the Arduino Yún,, accessed 2015-01-31
2. Getting started with Arduino Yun and Autobahn, 2013-12-01, Tobias Oberstein
3. Environment Variables, Ubuntu, accessed 2015-02-08