66
Getting Started with Intel IoT Developer Kit – Dev kit Sulamita Garcia – Developer Evangelist – Twitter @sulagarcia Milano, November 28 2014

Lab Handson: Power your Creations with Intel Edison!

Embed Size (px)

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?

Citation preview

Page 1: Lab Handson: Power your Creations with Intel Edison!

Getting Started with Intel IoT Developer Kit – Dev

kit

Sulamita Garcia – Developer Evangelist – Twitter @sulagarcia

Milano, November 28 2014

Page 2: Lab Handson: Power your Creations with Intel Edison!

“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

Page 3: Lab Handson: Power your Creations with Intel Edison!

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

Page 4: Lab Handson: Power your Creations with Intel Edison!

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)

Page 5: Lab Handson: Power your Creations with Intel Edison!

Devkit components

Page 6: Lab Handson: Power your Creations with Intel Edison!

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

Page 7: Lab Handson: Power your Creations with Intel Edison!

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

Page 8: Lab Handson: Power your Creations with Intel Edison!

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

Page 9: Lab Handson: Power your Creations with Intel Edison!

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

Page 10: Lab Handson: Power your Creations with Intel Edison!

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

Page 11: Lab Handson: Power your Creations with Intel Edison!

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

Page 12: Lab Handson: Power your Creations with Intel Edison!

Intel Cloud Analytics

Page 13: Lab Handson: Power your Creations with Intel Edison!

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

Page 14: Lab Handson: Power your Creations with Intel Edison!

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

Page 15: Lab Handson: Power your Creations with Intel Edison!

Online documentation for reference

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

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

http://intel.com/edison/getstarted

Page 16: Lab Handson: Power your Creations with Intel Edison!

Demos

Page 17: Lab Handson: Power your Creations with Intel Edison!

Connecting your environment

microUSB <-> USB

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

Power / Arduino / flashing

OS

Serial port

Page 18: Lab Handson: Power your Creations with Intel Edison!

Arduino for Galileo/Edison

Page 19: Lab Handson: Power your Creations with Intel Edison!

Arduino for Galileo or Edison

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

Page 20: Lab Handson: Power your Creations with Intel Edison!

Setting up other developer environments

Page 21: Lab Handson: Power your Creations with Intel Edison!

Connect board via serial – discover port on Windows

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

Page 22: Lab Handson: Power your Creations with Intel Edison!

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

Page 23: Lab Handson: Power your Creations with Intel Edison!

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

Page 24: Lab Handson: Power your Creations with Intel Edison!

Connecting Edison – configure_edison --setup

Configure password

Configure wifi

Galileo should automatically set up an IP address.

Page 25: Lab Handson: Power your Creations with Intel Edison!

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

Page 26: Lab Handson: Power your Creations with Intel Edison!

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

Page 27: Lab Handson: Power your Creations with Intel Edison!

Time to chose your path:

C/C++:

• Eclipse

Javascript:

• XDK

Arduino

• Arduino IDE for Galileo

Visual Programming (Blocky)

• Wyliodrin

Page 28: Lab Handson: Power your Creations with Intel Edison!

Python and Node.js demo

Page 29: Lab Handson: Power your Creations with Intel Edison!

C/C++/Eclipse

Page 30: Lab Handson: Power your Creations with Intel Edison!

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

Page 31: Lab Handson: Power your Creations with Intel Edison!

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

Page 32: Lab Handson: Power your Creations with Intel Edison!

Click on Remote System Explorer

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

Page 33: Lab Handson: Power your Creations with Intel Edison!

Fill the IP address on (3)

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

Page 34: Lab Handson: Power your Creations with Intel Edison!

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

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

Page 35: Lab Handson: Power your Creations with Intel Edison!

Galileo - Right click 4_cpp_onboard_led

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

Page 36: Lab Handson: Power your Creations with Intel Edison!

Click Run, select 4_cpp_onboard_led

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

Page 37: Lab Handson: Power your Creations with Intel Edison!

JavaScript/Node.js/XDK

Page 38: Lab Handson: Power your Creations with Intel Edison!

Install the file copied from the SD card, XDK directory

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

Page 39: Lab Handson: Power your Creations with Intel Edison!

Login/create your account

Page 40: Lab Handson: Power your Creations with Intel Edison!

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

Template”

Page 41: Lab Handson: Power your Creations with Intel Edison!

Should look like this

Page 42: Lab Handson: Power your Creations with Intel Edison!

Select Galileo/Edison board

Page 43: Lab Handson: Power your Creations with Intel Edison!

Toggle the console

Page 44: Lab Handson: Power your Creations with Intel Edison!

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.

Page 45: Lab Handson: Power your Creations with Intel Edison!

Click Install/Build to fetch node modules specified in

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

Page 46: Lab Handson: Power your Creations with Intel Edison!

Click Upload to upload the current project to the Galileo

board

Page 47: Lab Handson: Power your Creations with Intel Edison!

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

be blinking.

Page 48: Lab Handson: Power your Creations with Intel Edison!

Devkit library (MRAA) and sensor repository (UPM)

Page 49: Lab Handson: Power your Creations with Intel Edison!

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);

Page 50: Lab Handson: Power your Creations with Intel Edison!

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);

}

Page 51: Lab Handson: Power your Creations with Intel Edison!

Just remember to use the correspondent library

Project name (right click)

-> Settings -> C/C++

Build -> Settings -> Tool

Settings -> Cross G++

Linker -> Miscelaneous

Page 52: Lab Handson: Power your Creations with Intel Edison!

UPM API documentation – which library to use?

Page 53: Lab Handson: Power your Creations with Intel Edison!

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

Page 54: Lab Handson: Power your Creations with Intel Edison!

Creating new app

Page 55: Lab Handson: Power your Creations with Intel Edison!

If using Eclipse

Page 56: Lab Handson: Power your Creations with Intel Edison!

Create your first app – copy&paste an existing sample

Page 57: Lab Handson: Power your Creations with Intel Edison!

Creating your first app – if you use UPM repository

Project name (right click)

-> Settings -> C/C++

Build -> Settings -> Tool

Settings -> Cross G++

Linker -> Miscelaneous

Page 58: Lab Handson: Power your Creations with Intel Edison!

If using XDK

Page 59: Lab Handson: Power your Creations with Intel Edison!

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”);

Page 60: Lab Handson: Power your Creations with Intel Edison!

If using Python

Page 61: Lab Handson: Power your Creations with Intel Edison!

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

Page 62: Lab Handson: Power your Creations with Intel Edison!

If using Arduino

Page 63: Lab Handson: Power your Creations with Intel Edison!

Go to IDZ IoT page, find your sensor

Page 64: Lab Handson: Power your Creations with Intel Edison!

Under References, follow Grove Wiki

Page 65: Lab Handson: Power your Creations with Intel Edison!

//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');

Page 66: Lab Handson: Power your Creations with Intel Edison!

Now, who has problems???