Meshcentral.com
Advanced Mesh Usages
For Intel® Galileo Boards
Making use of a cloud connected
Intel® Galileo.
Version 0.0.3
December 5, 2013
Matt Royer, Matt Primrose, Ylian Saint-Hilaire
© 2013 Intel Corporation. All Rights Reserved.
Arduino-over-Mesh
Meshcentral.com
Legal Notices and Disclaimers
Disclaimers
INTEL CORPORATION MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE. INTEL CORPORATION ASSUMES NO RESPONSIBILITY FOR ANY
ERRORS THAT MAY APPEAR IN THIS DOCUMENT. INTEL CORPORATION MAKES NO COMMITMENT
TO UPDATE NOR TO KEEP CURRENT THE INFORMATION CONTAINED IN THIS DOCUMENT.
THIS SPECIFICATION IS COPYRIGHTED BY AND SHALL REMAIN THE PROPERTY OF INTEL
CORPORATION. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE TO ANY
INTELLECTUAL PROPERTY RIGHTS IS GRANTED HEREIN.
INTEL DISCLAIMS ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY
PROPRIETARY RIGHTS, RELATING TO IMPLEMENTATION OF INFORMATION IN THIS
SPECIFICATION. INTEL DOES NOT WARRANT OR REPRESENT THAT SUCH IMPLEMENTATIONS WILL
NOT INFRINGE SUCH RIGHTS.
NO PART OF THIS DOCUMENT MAY BE COPIED OR REPRODUCED IN ANY FORM OR BY ANY MEANS
WITHOUT PRIOR WRITTEN CONSENT OF INTEL CORPORATION.
INTEL CORPORATION RETAINS THE RIGHT TO MAKE CHANGES TO THESE SPECIFICATIONS AT ANY
TIME, WITHOUT NOTICE.
Legal Notices
Intel software products are copyrighted by and shall remain the property of Intel Corporation. Use,
duplication or disclosure is subject to restrictions stated in Intel's Software License Agreement, or
in the case of software delivered to the government, in accordance with the software license
agreement as defined in FAR 52.227-7013.
The Intel logo is a registered trademark of Intel Corporation.
Other brands and names are the property of their respective owners.
i
Arduino-over-Mesh
Meshcentral.com
Table of Contents
Legal Notices and Disclaimers .......................................................................................................... i
Disclaimers....................................................................................................................................... i
Legal Notices ................................................................................................................................... i
1.
Introduction ............................................................................................................................. 1
2.
Mesh Messaging ..................................................................................................................... 1
2.1
Getting setup ................................................................................................................... 2
2.2
Sending messages .......................................................................................................... 3
2.3
Sample web based messaging ........................................................................................ 4
3.
Arduino IDE Meshcentral Sketch Upload Extension .............................................................. 5
3.1
How it works .................................................................................................................... 5
3.2
Installation Guide ............................................................................................................. 6
3.2.1
Preparation .............................................................................................................. 7
3.2.2
Installation ................................................................................................................ 7
3.3
Compile and upload a sketch using Meshcentral ............................................................ 8
3.4
Limitations and Known Issues ......................................................................................... 9
4.
Sketch Management Web Site ............................................................................................... 9
4.1
Use................................................................................................................................. 10
5.
License .................................................................................................................................. 11
6.
Telnet Enabling ..................................................................................................................... 12
ii
Arduino-over-Mesh
Meshcentral.com
Document Changes
December 3, 2013 – 0.0.1
Initial version by Matt Royer.
December 4, 2013 – 0.0.2
Ylian added Mesh Messaging.
December 5, 2013 – 0.0.2
Added Matt Primrose remote sketch management.
iii
Arduino-over-Mesh
Meshcentral.com
1. Introduction
This document covers various new usages that are possible when using Meshcentral.com along
with Intel Galileo. This document assumes that the reader has already set up an Intel Galileo
board with Meshcentral.com. To do this, follow instructions given here:
https://meshcentral.com/info/documents/MeshGalileo.pptx
A binary file package is associated with this document; it contains all of the files referenced. The
packages can be obtained at:
https://meshcentral.com/info/downloads/MeshGalileo.zip
Once installed and working, this document covers three new usages.
Mesh Messaging. Allows a user to send and receive messages from a web page to Intel
Galileo. This is much like having an internet chat session with every deployed Intel
Galileo device.
Arduino IDE Meshcentral Sketch Upload Extension. This extension allows the user to
take a standard sketch created within the Intel® Galileo Arduino software and upload it to
the Galileo Arduino device through the Meshcentral framework.
Web based sketch management. This is a sample web page with javascript code for
remotely managing sketches on Galileo devices. You can use this to upload and manage
running sketches on Intel Galileo devices over the Internet.
These three advanced usages will help you make the most of your cloud-connected Intel®
Galileo board.
2. Mesh Messaging
The mesh messaging system allows users to send and receive text messages from a web page
to any Intel Galileo board over the Internet using Mesh. To do this, the Mesh Agent must already
be installed- a special sketch is provided that will set up a communication path between the
Sketch and the Mesh Agent.
1
Arduino-over-Mesh
Meshcentral.com
Once set up the sketch will receive messages from a console and can reply to these. You can, for
example, send a “light on” command to a Galileo board sketch to turn on a light or perform other
operations. Users can also send a message to a sketch to start receiving notifications when
sensors on the board are triggered.
2.1 Getting set up
Start the Arduino IDE and load the “MeshMessagingSketch” (it’s in the package associated with
this document). Open the file “MeshMessagingSketch.ino” and you should see a series of tabs
load like this:
Only the first “MeshMessagingSketch” tab is important. It will start the MeshAPI, hook up to the
mesh agent and start listening for mesh messages. Upload the sketch to the Intel Galileo device
2
Arduino-over-Mesh
Meshcentral.com
and start the serial monitor right away. If you start the monitor quickly after the transfer
completes, you should see this:
This indicates that the sketch found the Mesh Agent running on the device. It displays the
device’s unique mesh identifier.
2.2 Sending messages
When the sketch is running correctly, go to Meshcentral.com, click on the device and hit the
“chat” link at the bottom of the device page.
This will bring up the chat dialog. You can then type mesh message commands that will be sent
to the sketch. For example, typing “hello” will show the following on the serial port:
3
Arduino-over-Mesh
Meshcentral.com
The sketch will send an “ECHO!” message back, so the chat window on the web site will show
this:
In the response, we see “5507B750:40396”. This is the start of the nodeid of the device and the
UDP port used by the sketch. This information can be ignored.
2.3 Sample web based messaging
In addition to the chat dialog box on Meshcentral.com, the package that is associated with this
document also includes a sample web page for sending messages to a sketch directly from
Javascript. Look in the “Mesh Messaging Web Page” folder of the package that is associated with
this document and click on “sample.html”. You can fill in the username, password and nodeid for
your node. Hit “Connect” to connect to Meshcentral, type a message and hit “Send”.
4
Arduino-over-Mesh
Meshcentral.com
The web application will receive the “ECHO!” message from the Galileo board. The NodeID of a
device can be easily obtained by clicking on a device on Meshcentral, then cutting & pasting the
long hexadecimal string in the URL bar.
3. Arduino IDE Meshcentral Sketch Upload Extension
The Intel® Galileo Arduino IDE Meshcentral Sketch Upload Extension & Meshcentral Sketch
Management will allow you to take a standard sketch created within the Intel® Galileo Arduino
software and upload it to the Galileo Arduino device through Meshcentral framework. By
enabling the Intel® Galileo Arduino software to upload sketches through Meshcentral, you
remove the need to physically connect the USB / Serial Cable for sketch management, increasing
the remote reach of your Arduino device across diverse and complex network configurations.
3.1 How it works
Normally, developers create sketches (applications) for the Intel® Galileo board using the
Arduino user interface. This interface is intended to take compiled binaries and transfer them to
the target board using a serial link. Intel Galileo boards support a Serial-over-USB interface, but
users are required to physically connect the board to the development computer in order to
transfer sketches.
5
Arduino-over-Mesh
Meshcentral.com
Users can freely connect their Intel® Galileo boards to Meshcentral.com so that they can be
remotely managed using a web based user interface. In this document, we add support for
Meshcentral into the Arduino environment so that sketches can be securely sent over the Internet
to the boards without the need for a direct serial connection.
Once enabled, developers can write and update sketches to boards that are deployed anywhere
in the world, as long as they have administrative permissions. In addition, developers can update
many Intel® Galileo devices at once.
This makes it significantly simpler to update a sketch on a large number of devices easily. This is
something that would be difficult with the conventional serial-over-USB method.
3.2 Installation Guide
6
Arduino-over-Mesh
Meshcentral.com
The extension package can be found in the “Arduino Sketch Upload Extension” folder of the file
package that is associated with this document. Once installed, you will be able to select a new
type of device in the Arduino environment.
3.2.1 Preparation
1. If you have not already done so, download the “Intel® Galileo Arduino SW 1.5.3 for
Windows” from https://communities.intel.com/community/makers/software/drivers and
extract it.
2. Ensure Windows* PowerShell* is installed on the development computer. Note that
Windows* PowerShell* is installed by default on Widows 7 / Windows 8.
3. Create backup copies of the following files:
a. <Galileo Arduino IDE Root Folder>\hardware\arduino\x86\boards.txt
b. <Galileo Arduino IDE Root Folder>\hardware\arduino\x86\platform.win.txt
4. Ensure that the Meshcentral Agent has been installed on your Intel® Galileo Arduino
device and is associated with Meshcentral. Instructions to install Mesh Agent can be
found here: https://Meshcentral .com/info/documents/MeshGalileo.pptx
3.2.2 Installation
1. Unzip Galileo_Arduino_IDE_Meshcentral_Sketch_Upload_Extension.zip to the root of
Galileo Arduino IDE folder. Unzipping the zip file into the IDE root directory will:
 Replace the .\hardware\arduino\x86\boards.txt file
 Replace the .\hardware\arduino\x86\platform.win.txt file
 Create the new folder "mesh" in .\hardware\arduino\x86\tools\ directory
 Add the .\hardware\arduino\x86\tools\account.txt file
 Add the .\hardware\arduino\x86\tools\meshcommand.exe file
 Add the .\hardware\arduino\x86\tools\meshnodes.txt file
 Add the .\hardware\arduino\x86\tools\parsemessnodes.bat file
 Add the .\hardware\arduino\x86\tools\sketchmessupload.bat file
2. Modify .\hardware\arduino\x86\tools\account.txt file with a Meshcentral username and
password that has permission to the Meshcentral Galileo Arduino node(s) you want to
access.
7
Arduino-over-Mesh
3.
Meshcentral.com
Modify .\hardware\arduino\x86\tools\meshnodes.txt file with at least one Meshcentral
Galileo Node. Place each Meshcentral Galileo Node on a new line in the meshnodes.txt
file. If there is only one Meshcentral Galileo Node, just have that one Meshcentral
Galileo Node in the meshnodes.txt file. The Mesh Node Name in the meshnodes.txt file
should be listed as a label in Meshcentral.
3.3 Compile and upload a sketch using Meshcentral
In this section we look at how to take an existing sketch and compile and upload it to an Intel
Galileo board through Meshcentral.
1.
Open Sketch Install Galileo Arduino IDE.
2.
Select Tool  Board  Intel® Galileo managed by Meshcentral
3.
Even through the Sketch is uploaded through Meshcentral instead of a serial
interface, the IDE will still require a serial port to be selected. Select any of the
Serial / COM devices listed under Tools  Serial Port.
8
Arduino-over-Mesh
4.
Meshcentral.com
Upload Sketch normally by either clicking Upload icon, select File  Upload, or by
pressing Ctrl-U. You should receive a completion notice when the upload has
completed.
3.4 Limitations and Known Issues

This Sketch Upload extension is only supported on the Windows Intel® Galileo Arduino
SW; Intel® Galileo Arduino SW for MacOS and Linux have yet to be enabled.
4. Sketch Management Web Site
The file package associated with this document includes a sample remote sketch management
web site. It’s in the “Sketch Management Web Site” folder with a simple “index.html” file you can
open with any common browser. This web site allows a user to log in to Meshcentral.com, display
all of the Intel® Galileo devices and remotely upload, start and stop sketches. This sample is
9
Arduino-over-Mesh
Meshcentral.com
intended to demonstrate how someone can build a completely separate web site that still uses
Meshcentral.com but with a completely different user interface.
In addition to having the files in the file package, we are also hosting this sample web site at:
https://meshcentral.com/galileo
This makes it easy for anyone to immediately give the site a try. Of course, with the local version
you can also edit the site at will.
4.1 Use
To use this sample, you must already have a Meshcentral.com account and an Intel® Galileo
device added to the account and online. Simply click on the “index.html” file and login to your
Meshcentral.com account. You should see the list of all your devices.
On this screen, we see only one device. We can click on it to show the active sketches. In this
case, 3 sketches are running at the same time on the device.
10
Arduino-over-Mesh
Meshcentral.com
The sketch control dialog box has controls to start, stop and delete the sketch. The
button ,
turns a sketch into the default sketch. It actually takes a sketch and renames it to “sketch.elf”,
replacing the existing one if needed. The “sketch.elf” is special since it’s launched at device boot.
At the bottom of the dialog, you can select a “.elf” file which is a sketch compiled using the
Arduino environment. Select the file and hit “upload” to upload and launch the binary file.
In the example above, we uploaded both a slow and fast blink sketch. The result will be the LED
turning on and off at an odd rate, as both binaries are turning the LED on and off on top of each
other.
5. License
The Sample Sketches, Sample HTML pages, Javascript code, Sketch Upload extension and
MeshCommand tool are Copyright 2013 Intel Corporation and licensed under the Apache
License, Version 2.0 (the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
11
Arduino-over-Mesh
Meshcentral.com
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the specific language governing permissions and
limitations under the License.
6. Telnet Enabling
It’s sometimes useful to enable Telnet on the Intel® Galileo device for remote debugging. An
easy way to do this is to run the following sketch.
void setup() {
system("telnetd -l /bin/sh");
}
void loop() {
system("ifconfig eth0 > /dev/ttyGS0");
sleep(10);
}
This will enable Telnet and print the current network interface information to the serial port every
10 seconds. If uploading and running this script using Meshcentral, the serial output is not
needed since Meshcentral can route TCP connections automatically.
Once Telnet is enabled, PUTTY can used to connect to the device and get the Linux prompt.
12