Intro to Intel Galileo - IoT Apps GERARDO CARMONA IRVING LLAMAS Welcome! Campus Party Guadalajara 2015 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. 1
Getting Started - Hardware List 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 Getting Started - Software Arduino IDE https://www.arduino.cc/en/main/software 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 What is Intel Galileo? A brief introduction to the board 2
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 What is Intel Galileo? Intel Galileo Gen 2 From Intel website Galileo Gen 2 Components USB device port USB host port Pin 13 LED, Power LED and SD card LED Ethernet port 6 pin FTDI header 7 to 15 V input Micro SD Card slot Reboot Linux button Digital pins, some PWM, Serial, I2C and others RAM memory Quark SoC X1000 Power pins & analog pins Reset button (sketch) 3
Intel Galileo Gen 1 RS-232 USB client USB Host Ethernet Pin 13 LED 5 V input Micro SD slot SD card LED, power LED and Reset button Digital pins, some PWM, Serial, I2C and others Quark SoC X1000 RAM memory Power pins & analog pins Reboot Before we start Preparing the Intel Galileo board Install Driver 1. To install the driver go to: http://bit.ly/galileo_driver_firmware 2. Then click Intel Galileo Firmware Updater Tool 1.0.4 link to start download. 4
Install Driver 1. 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 Update Firmware 1. In the same folder, you have file named firmware-updater-1.0.4.exe 2. Fill the next information: Making a bootable micro SD Card Get the latest image for IoT Edition here: http://bit.ly/galileo_sd Follow the instructions on the web page, you will need to download Win32DiskImager in order to burn the image into a SD card. 5
Update Driver Now 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. Arduino IDE First program Blink an Led Blink Example Open 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. 6
Beyond Arduino Arduino + Linux Arduino + Linux You 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 Secure Shell (SSH) Connecting to the Intel Galileo Linux side 7
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 Secure Shell (SSH) 3) Open PuTTy and configure as shown 1. Select SSH 2. Write Galileo s IP address 3. Leave port as 22 4. Click Open 2 3 1 4 Secure Shell (SSH) 4) The following window opens 5) Type root in username and hit enter 8
Secure Shell (SSH) 6) Now you are inside Linux Yocto Project Playing with Linux Testing some basic commands in terminal Playing with Linux Now we can create files, folders, navigate though the Linux file system. First command to try is: $ ls It will display the content of the folder, in this case will show you some files that I created in the past. 9
Playing with Linux Now lets create a new folder named gerardo, type: $ mkdir gerardo Now type ls again to see the content of the folder again. Vi Editor Lets create a new file hello.txt and write on it some text. We are going to use a text editor called vi, so type: $ vi hello.txt You will see an empty file just like: Vi Editor To 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) 10
Other Linux Commands If you want to display the content of a file in terminal write: Other commands You can find more Linux commands in the file Linux-commands.pdf Other Programing Languages C/C++, Python and node.js 11
Other Programing Languages Lets make a simple program that prints Hello world! to the console using different languages. C Create a new file named hello.c using vi Type the following code: #include <stdio.h> int main() { printf("hello world!\n"); return 0; } C Now we need to compile file using gcc compiler, type: $ gcc o helloc hello.c Execute the output file typing: $./helloc Output: 12
Python Create a new file named hello.py using vi Type the following code: print Hello world! Exit the file and in order to execute the file type in terminal: $ python hello.py Output: Node.js Create a new file named hello.js. Type the following code: console.log("hello world!"); Exit the file and type in terminal: $ node hello.js Output: Another IDE for Intel Galileo 13
With 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. Create an Account Follow steps IoT apps for Galileo and Edison HTM5 apps for mobile devices 14
Create a new file, click on Templates and select Onboard LED Blink 1 2 1 2 15
Steps for installing MRAA & UPM Library on Intel IoT Platform with IoT DevKit Linux* 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 16
About MRAA Library It 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/ First Program Code: First Program Upload and Run code. 1) Install/Build 2) Upload 3) Run 2 1 3 17
Set Interval of a Function Select New from Blank Template and write the following code: Run the code Wait for the second part! MAKEROBOTICSPROJECTS.COM OR MAKEROBOTS.TK 18