Lab Handson: Power your Creations with Intel Edison!

Post on 05-Jul-2015

557 views 4 download

description

by Francesco Baldassarri - Come along and play with Intel Edison, for the Internet of Things? Learn about the Developer Kit for IoT, chose your preferred environment and test it – or test all the possibilities? We will be providing information and hands on training for developers interested in testing our solutions in C/C++, Javascript, Arduino, Wyliodrin and Python. Just bring you laptop and we will help you to get started. We will also provide information about our Cloud Analytics platform, and test hardware samples with the Grove Starter Kit – Intel IoT Edition. Visit us anytime and start making! What will you make?

transcript

Getting Started with Intel IoT Developer Kit – Dev

kit

Sulamita Garcia – Developer Evangelist – Twitter @sulagarcia

Milano, November 28 2014

“If we’re not a part of this,

we’re going to miss where the

future of computing is going.”

Brian Krzanich, Intel CEO

Rome Maker Faire Oct 2013

3

VALUE PROPOSITION

The Intel® Edison development

platform is designed to lower the

barriers to entry for a range of

Inventors, Entrepreneurs and

consumer product designers to rapidly

prototype and produce IoT and

wearable computing products.

Intel Confidential

Agenda

• Devkit components: hardware and software

• Setting up Galileo/Edison

• Setting up developer environment

• Running sample codes

• Creating your application

• Dev kit library (MRAA) and sensors repository (UPM)

Devkit components

Intel® IoT Developer Kit Components

Intel Galileo

Gen 1 & 2

Board

Intel Edison

Arduino

Development

Board

Yocto based Linux OS image

API Bindings C/C++, Node JS, Python

UPM (Sensor/Actuator library repository)LibMraa

NodeJS

SupportC/C++

Tool Chain

Wyliodrin

AgentIoT Cloud

Agent

Ha

rd W

are

S/W

Im

ag

e o

n Io

Tp

latf

orm

Intel XDK IoT

Edition

(coming soon)

Eclipse IDE

+

ISS

(Optional)

Wyliodrin

(Visual

Programming)

Cloud

Analytics /

Mashery

IDE

/ T

oo

ls

(Win

, M

ac, L

inu

x)

Sensors / Actuators

Arduino IDE

Intel® Galileo Development Board – Gen 2

Board I/O:

Mechanically compatible with Arduino Uno 20 digital input/output pins including 6 pins as PWM outputs

6 analog inputs

2 UART (RX/TX)

1 I2C

1 ICSP 6-pin header (SPI)

USB device connector (Host)

Micro USB device connector (client)

SD Card connector

DC power jack (7V – 15V DC input)

Ref.: http://maker.intel.com

Intel® Edison module

• 22 nm Intel® SoC that includes a dual-core, dual-threaded Intel® Atom™ CPU at 500 MHz

• 32-bit Intel® Quark™ microcontroller at 100 MHz

• 1 GB LPDDR3 POP memory

• Flash storage 4 GB eMMC

• WiFi and Bluetooth® Low Energy

• 35.5 × 25.0 × 3.9 mm (1.4 × 1.0 × 0.15 inches)

• 40 GPIOs: UART, I2C, SPI, I2S, GPIO(PWM), USB, Sd card

Ref.: http://maker.intel.com

Intel® Edison - Arduino Expansion Board and Mini

Breakout board

Board I/O: Compatible with Arduino Uno (except only

4 PWM instead of 6 PWM)

20 digital input/output pins including 4 pins as PWM outputs

6 analog inputs

1 UART (RX/TX)

1 I2C

1 ICSP 6-pin header (SPI)

Micro USB device connector OR (via mechanical switch)

dedicated standard size USB host Type-A connector

Micro USB device (connected to UART)

SD Card connector

DC power jack (7V – 15V DC input)

Ref.: http://maker.intel.com

Grove Starter Kit Plus - Intel® IoT Edition

Base Shield

Buzzer

Button

Grove-LED

Sound Sensor

Rotary Angle Sensor

Touch Sensor

Smart Relay

Light Sensor

Temperature Sensor

Grove Cables

Mini Servo

9V to Barrel Jack Adapter - 126mm

DIP LED Blue-Blue

DIP LED Green-Green

DIP LED Red-Red

LCD RGB Backlight

Target audience and developer pathArduino

Developer

Arduino

Developer

Visual Programming

(* Galileo Only)JavaScript

Developer

Wind River

(*Galileo only)C / C++

Developer

Target

AudienceMaker Beginner Intermediate Advanced

Advanced

Professional

Tools/ Libraries

OS /

Boot ImageYocto Linux

SPIYocto Linux Yocto Linux Yocto Linux VxWorks

Arduino LIbraries Wyliodrin XDK ISS

IDE

Dev EnvArduino IDE

Win / Mac/ Linux

Wyliodrin

Web

XDK

Win/ Mac/ LinuxEclipse

Win/ Mac / Linux

WR Eclipse

Win / Linux

Programming

LanguageArduino Sketch

C++

Visual

Python

JavaScript

(Node JS)C/ C++ C / C++

Work Bench / ISS

Cloud IoT Cloud AnalyticsIoT Cloud Analytics

Widget

IoT Cloud Analytics

Mashery/ 3rd party

IoT Cloud Analytics

Mashery/ 3rd PartyWR Cloud

Intel Cloud Analytics

13

Store, visualize and

analyze

your IoT data in the cloudKeep track of your devices

Graph data from your devices

Invite others to see your device

data

Send messages to your devices

Create rules to notify you when

your data gets interesting

Download your data for further

analysis

Links

14

The Web Site – www.enableiot.com

Getting Started - software.intel.com/iot

Getting started Guides / Intel IoT Cloud Analytics Guide

The API – github.com/enableiot/iotkit-api

Online documentation for reference

This presentation: http://slidesha.re/1uuFgBH

https://software.intel.com/en-us/iot/getting-started

http://intel.com/edison/getstarted

Demos

Connecting your environment

microUSB <-> USB

Ref.: https://communities.intel.com/docs/DOC-23147

Power / Arduino / flashing

OS

Serial port

Arduino for Galileo/Edison

Arduino for Galileo or Edison

https://communities.intel.com/docs/DOC-23242

Setting up other developer environments

Connect board via serial – discover port on Windows

Ref.: https://software.intel.com/en-us/iot-c-eclipse

Connect board via serial – discover port on MacOS

After connecting the serial cable, check if you have /dev/cu.usbserial(*)

LINUX - /dev/ttyUSB0

If not, you may need to install a serial-USB FTDI driver.

Example:

Ref.: https://software.intel.com/en-us/iot-c-eclipse

Connect via serial – putty, goSerial or minicom

Linux – minicom –D /dev/ttyUSB0 –s 115200

User: root, no passwordRef.: https://software.intel.com/en-us/iot-c-eclipse

Connecting Edison – configure_edison --setup

Configure password

Configure wifi

Galileo should automatically set up an IP address.

Find your Galileo/Edison IP address and write it down:

command `ip a`

Ping between board and your laptop to

check connectivity

Ref.: https://software.intel.com/en-us/iot-c-eclipse

Shortcut – if you feel comfortable with vi

If you have experience coding directly from the command line, you have:

• Busybox/vi

• Gcc

• Python

• Node.js

But we will continue with the IDEs, keep paying attention

Time to chose your path:

C/C++:

• Eclipse

Javascript:

• XDK

Arduino

• Arduino IDE for Galileo

Visual Programming (Blocky)

• Wyliodrin

Python and Node.js demo

C/C++/Eclipse

Eclipse(C/C++) – setting up

Copy to your computer

Extract the file you copied previously (iotdk-ide-${yourOS}.7z) with 7z

Treats long paths better, needed for this file.

If you need to download: http://www.7-zip.org/

Note: Better to extract the file to C:\ on Windows

Execute devkit-launcher.bat

Ref.: https://software.intel.com/en-us/iot-c-eclipse

Ref.: https://software.intel.com/en-us/iot-c-eclipse

Click on Remote System Explorer

Ref.: https://software.intel.com/en-us/iot-c-eclipse

Fill the IP address on (3)

Ref.: https://software.intel.com/en-us/iot-c-eclipse

Running a sample - Click back on C/C++

Ref.: https://software.intel.com/en-us/node/519969

Galileo - Right click 4_cpp_onboard_led

Ref.: https://software.intel.com/en-us/node/519969

Click Run, select 4_cpp_onboard_led

Ref.: https://software.intel.com/en-us/node/519969

JavaScript/Node.js/XDK

Install the file copied from the SD card, XDK directory

Ref.: http://xdk.intel.com/iot

Login/create your account

Start with a Sample (under IoT Projects) – click on “Use this

Template”

Should look like this

Select Galileo/Edison board

Toggle the console

Click Manage your daemon/IoT device menu in the bottom

taskbar. Select sync PC time w/ clock on target board to

avoid computer and device timing issues.

Click Install/Build to fetch node modules specified in

package.json and install them on device; 1st time click Build

Click Upload to upload the current project to the Galileo

board

Click Run to run the project on the device. The LED should

be blinking.

Devkit library (MRAA) and sensor repository (UPM)

MRAA lib - https://github.com/intel-iot-devkit/mraa

MRAA – random letters, doesn’t mean anything

API documentation available - http://iotdk.intel.com/docs/master/mraa/

Examples directory

Minimum code sample:

mraa_gpio_context gpio;

gpio = mraa_gpio_init(6);

mraa_gpio_dir(gpio, MRAA_GPIO_IN);

for (;;) {

fprintf(stdout, "Gpio is %d\n", mraa_gpio_read(gpio));

sleep(1);

}

mraa_gpio_close(gpio);

UPM repository - https://github.com/intel-iot-devkit/upm

List of supported sensors in C++

API documentation - http://iotdk.intel.com/docs/master/upm/

Examples directory

Minimum code example:

upm::GroveTemp* s = new upm::GroveTemp(0);

std::cout << s->name() << std::endl;

for (int i=0; i < 10; i++) {

std::cout << s->value() << std::endl;

sleep(1);

}

Just remember to use the correspondent library

Project name (right click)

-> Settings -> C/C++

Build -> Settings -> Tool

Settings -> Cross G++

Linker -> Miscelaneous

UPM API documentation – which library to use?

Recap – navigating IDZ IoT - https://software.intel.com/iot

Creating new app

If using Eclipse

Create your first app – copy&paste an existing sample

Creating your first app – if you use UPM repository

Project name (right click)

-> Settings -> C/C++

Build -> Settings -> Tool

Settings -> Cross G++

Linker -> Miscelaneous

If using XDK

Node.js

MRAA

var mraa = require(“mraa”)

UPM

Find the library name – example: libupm-grove

-> replace “lib” for “js” and you have it: jsupm_grove

Code:

require(“jsupm_grove”);

If using Python

Python

MRAA

import mraa

UPM

Find the library name – example: libupm-grove

-> replace “lib” for “py” and you have it: pyupm-grove

Code:

import pyupm_grove

If using Arduino

Go to IDZ IoT page, find your sensor

Under References, follow Grove Wiki

//Load i2clcd module

var LCD = require('jsupm_i2clcd');

//Initialize Jhd1313m1 at 0x62 (RGB_ADDRESS) and 0x3E (LCD_ADDRESS)

var myLcd = new LCD.Jhd1313m1 (0, 0x3E, 0x62);

myLcd.setCursor(0,0);

myLcd.write('Hello World');

Now, who has problems???