intro to intel galileo - iot apps - wordpress.com · intro to intel galileo - iot apps gerardo...

18
7/25/2015 1 Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara – July, 2015 www.makeroboticsprojects.com Welcome! Campus Party Guadalajara 2015 Campus Party Guadalajara – July, 2015 www.makeroboticsprojects.com Introduction In this course we will focus on how to get started with the Intel Galileo Gen 2 development board. Then we will explore some examples using different programming languages like: C/C++ Python JavaScript And finally we will program a basic IoT application connecting our board to a mobile phone or tablet using Intel XDK IoT Edition. Campus Party Guadalajara – July, 2015 www.makeroboticsprojects.com

Upload: duonglien

Post on 08-Mar-2019

243 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

1

Intro to Intel Galileo - IoT AppsGERARDO CARMONA

IRVING LLAMAS

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Welcome!Campus Party Guadalajara 2015

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

IntroductionIn this course we will focus on how to get started with the Intel Galileo Gen 2 development board.

Then we will explore some examples using different programming languages like:◦ C/C++

◦ Python

◦ JavaScript

And finally we will program a basic IoT application connecting our board to a mobile phone or tablet using Intel XDK IoT Edition.

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 2: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

2

Getting Started - HardwareList of hardware:◦ (1) Intel Galileo Gen 2

◦ (1) USB Micro-B Cable

◦ (1) Ethernet cable

◦ (1) SD Card

◦ (1) Led any color

◦ (1) 330 ohms resistor

◦ (1) Push button

◦ (1) 10 Kohms resistor

◦ (1) breadboard

◦ (1) A phone or tablet (Android or iOS)* Optional

◦ Some wires

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Getting Started - SoftwareArduino IDE◦ https://www.arduino.cc/en/Main/Software

Intel XDK IoT Edition◦ https://software.intel.com/en-us/html5/xdk-iot

◦ Also we need to install Bonjour Print Services: https://support.apple.com/kb/DL999?viewlocale=en_US&locale=es_US

Drives and Firmware◦ http://bit.ly/Galileo_Driver_Firmware

SD Card Image for IoT◦ http://bit.ly/Galileo_SD

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

¿What is Intel Galileo?A brief introduction to the board

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 3: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

3

What is Intel Galileo?The Intel® Galileo Gen 2 development board is a microcontroller board based on the Intel® Quark™SoC X1000 application processor, a 32-bit Intel® Pentium®brand system on a chip (SoC). It is the first board based on Intel® architecture designed to be hardware and software pin-compatible with shields designed for the Arduino Uno* R3.

This platform provides the ease of Intel architecture development through support for the Microsoft Windows*, Mac OS*, and Linux* host operating systems. It also brings the simplicity of the Arduino integrated development environment (IDE) software.

From Intel website, Galileo overview

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

What is Intel Galileo?

Intel Galileo Gen 2From Intel website

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Galileo Gen 2 Components

Ethernet port

6 pin FTDI header

USB device port USB host port Pin 13 LED, Power LED and SD card LED

Digital pins, some PWM, Serial, I2C and others

RAM memory

Quark SoC X1000

Power pins & analog pins

Reset button (sketch)

7 to 15 V input

Micro SD Card slot

Reboot Linux button

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 4: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

4

Intel Galileo Gen 1

5 V input

Micro SD slot

SD card LED, powerLED and Reset button

Ethernet

RS-232 USB client USB Host

Digital pins, some PWM, Serial, I2C and others

Power pins & analog pins

Quark SoC X1000

Reboot

RAM memory

Pin 13 LED

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Before we startPreparing the Intel Galileo board

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Install Driver1. To install the driver go to:

2. Then click Intel Galileo Firmware Updater Tool 1.0.4 link to start download.

http://bit.ly/Galileo_Driver_Firmware

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 5: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

5

Install Driver1. Connect your wall adapter to your Intel Galileo board.

2. Connect the USB cable to your computer and the board

3. Wait a few seconds until your PC recognizes the board

4. Update driver software going to “Device manager”

5. Locate Intel Galileo, right click and select “update driver software”

6. In the new window select second option “Search controller software on my computer”

7. Locate the files you just decompress under driver folder

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Update Firmware1. In the same folder, you have file named “firmware-updater-1.0.4.exe”

2. Fill the next information:

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Making a bootable micro SD CardGet the latest image for IoT Edition here:

Follow the instructions on the web page, you will need to download “Win32DiskImager” in order to burn the image into a SD card.

http://bit.ly/Galileo_SD

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 6: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

6

Update DriverNow with your Intel Galileo on and connected to your computer, navigate to “My Computer” and you will notice that you have a device named “Intel Galileo”, open it and you will find some folders, one of those folder is named drivers, you will need to update your driver software using this files.

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Arduino IDEFirst program – Blink an Led

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Blink ExampleOpen example:◦ File >> Examples >> 01.Basics >> Blink

Upload file.

You should see the Led located near by the “big” USB port, it is marked as “L”, blinking.

That means that everything is working fine.

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 7: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

7

Beyond ArduinoArduino + Linux

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Arduino + LinuxYou can combine the easy to use of Arduino and the power of an Operative System like Linux.

Open example:◦ 01-Arduino-Linux-get-ip.ino

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Secure Shell (SSH)Connecting to the Intel Galileo Linux side

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 8: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

8

Secure Shell (SSH)Secure Shell is a encrypted network protocol that initializes sessions on remote machines.

We can connect to our Intel Galileo Linux-side using SSH. Follow the next steps:

1) Connect your Intel Galileo to your local network

2) Get PuTTy o r any other SSH client, for PuTTY go to:

http://bit.ly/Galileo_SD

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Secure Shell (SSH)3) Open PuTTy and configure as shown

1. Select SSH2. Write Galileo’s IP

address3. Leave port as 224. Click Open

1

2 3

4

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Secure Shell (SSH)4) The following window opens

5) Type root in username and hit enter

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 9: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

9

Secure Shell (SSH)6) Now you are inside Linux Yocto Project

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Playing with LinuxTesting some basic commands in terminal

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Playing with LinuxNow we can create files, folders, navigate though the Linux file system.

First command to try is:

It will display the content of the folder, in this case will show you some files that I created in the past.

$ ls

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 10: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

10

Playing with LinuxNow lets create a new folder named gerardo, type:

Now type “ls” again to see the content of the folder again.

$ mkdir gerardo

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Vi EditorLets create a new file “hello.txt” and write on it some text. We are going to use a text editor called “vi”, so type:

You will see an empty file just like:

$ vi hello.txt

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Vi EditorTo start editing this file press “i” (insert mode).

Now you can type your text, after you finish, to save and exit file:

•Press escape key (exit editing mode)

•Type “:wq” (write and quit command)

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 11: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

11

Other Linux CommandsIf you want to display the content of a file in terminal write:

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Other commandsYou can find more Linux commands in the file “Linux-commands.pdf”

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Other Programing Languages C/C++, Python and node.js

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 12: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

12

Other Programing LanguagesLets make a simple program that prints “Hello world!” to the console using different languages.

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

CCreate a new file named “hello.c” using “vi”

Type the following code:

#include <stdio.h>

int main()

{

printf("Hello world!\n");

return 0;

}

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

CNow we need to compile file using “gcc” compiler, type:

Execute the output file typing:

Output:

$ gcc –o helloc hello.c

$ ./helloc

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 13: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

13

PythonCreate a new file named “hello.py” using “vi”

Type the following code:

Exit the file and in order to execute the file type in terminal:

Output:

print “Hello world!”

$ python hello.py

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Node.jsCreate a new file named “hello.js”.

Type the following code:

Exit the file and type in terminal:

Output:

console.log("Hello world!");

$ node hello.js

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Intel XDK IoT EditionAnother IDE for Intel Galileo

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 14: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

14

Intel XDK IoT EditionWith Intel XDK IoT Edition we can create IoT applications using the Intel Galileo and Intel Edison boards. Also we can develop mobile applications for any phone or tablet (Androir, iOS, etc.) because it is made using HTML5, CSS and JS.

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Create an AccountFollow steps

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Intel XDK IoT Edition

IoT apps for Galileo and Edison

HTM5 apps for mobile

devices

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 15: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

15

Intel XDK IoT EditionCreate a new file, click on Templates and select “Onboard LED Blink”

1

2

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Intel XDK IoT Edition

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Intel XDK IoT Edition

2

1

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 16: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

16

Intel XDK IoT Edition

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Intel XDK IoT Edition

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Intel XDK IoT EditionSteps for installing MRAA & UPM Library on Intel IoT Platform with IoT DevKitLinux* image. Using a ssh client:

1. echo "src maa-upm http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/intel-iotdk.conf

2. opkg update

3. opkg upgrade

Instructions from the code comments

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 17: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

17

About MRAA LibraryIt is written in C and ported to JS and Python, more information:◦ https://github.com/intel-iot-devkit/mraa/tree/master/examples/javascript

◦ http://iotdk.intel.com/docs/master/mraa/python/

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

First ProgramCode:

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

First ProgramUpload and Run code.

1) Install/Build

2) Upload

3) Run

2 31

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Page 18: Intro to Intel Galileo - IoT Apps - WordPress.com · Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Campus Party Guadalajara –July, 2015 Welcome! ... With Intel

7/25/2015

18

Set Interval of a FunctionSelect New from Blank Template and write the following code:

Run the code

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com

Wait for the second part!MAKEROBOTICSPROJECTS.COM OR MAKEROBOTS.TK

Campus Party Guadalajara – July, 2015www.makeroboticsprojects.com