tutorial de programación intel galileo 1

Upload: j-gabriel-gomez

Post on 10-Jan-2016

45 views

Category:

Documents


0 download

DESCRIPTION

Detalla procedmiientos para la programción de dispositivo de control.

TRANSCRIPT

  • How to Configure your Intel

    Galileo Gen 2 Board

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 2

    Revision # Date ThingWorx Revision Changes Owner

    1.0 21-11-2014

    Veronica MIHAI

    2.0 17-12-14 Used you instead of we, added copyright and page cover, modified footer

    Veronica MIHAI

    3.0-current

    19-12-14 Modified Cover Page font, footer, review table and copyright paragraph position in the document at Andys suggestion

    Veronica MIHAI

    Contents How to Configure your Intel Galileo Gen 2 Board ................................................................................... 1

    What is Intel Galileo? .......................................................................................................................... 3

    Required Materials .............................................................................................................................. 3

    Install an Intel Customized IoT Linux Image to the SD Card ................................................................ 3

    Download the Arduino IDE for Galileo to your PC .............................................................................. 6

    Install USB Driver for Intel Galileo Board on your PC .......................................................................... 9

    Update the Firmware and Set up Galileo .......................................................................................... 13

    Boot from the SD Card ...................................................................................................................... 14

    Upload the Blink Program ................................................................................................................. 20

    Set up the HTU21D Temperature and Humidity Sensor .................................................................. 23

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 3

    What is Intel Galileo?

    An Intel Galileo is a microprocessor hardware-, software-, and pin-compatible with a

    wide range of Arduino Uno* R3 shields. It comes with a preinstalled Linux-like operating

    system and can also boot from a customized Linux version installed on a micro-SD card.

    With Intel Galileo you can use either the Arduino IDE and upload sketches 1 to the

    board or you can enable ssh and use the command line to run programs in a programming

    language of your choice, like for example Python or C.

    A notable difference between Intel Galileo Gen 2 and Gen 1 is the power supply that it

    needs. The Intel Galileo Gen 2 works with a 12 V power supply whereas the Intel Galileo

    Gen 1 needs only a 5 V power supply.

    You can find an overview of Intel Galileo Gen 2 board here.

    To build the Temperature and Humidity App in Thingworx using Intel Galileo you will need

    the following hardware:

    Required Materials

    Item Quantity Intel Galileo Gen 2 1

    Solderless breadboard 1 Ethernet Cable (Alternative to wifi setup) 1

    Wifi Dongle/Wireless Network Card

    (Alternative to an Ethernet cable) + Wifi

    network to connect to

    8 G microSD card with an SD Adapter 1 A 12 V DC power supply or equivalent

    battery pack 1

    Temperature and Humidity sensor HTU21D 1 Male to male jumper wires 4

    Soldering iron (Optional, if you dont have the pins of the HTU21D sensor already

    soldered)

    1

    USB A to micro B cable 1

    Install an Intel Customized IoT Linux Image to the SD Card

    Intel Galileo already has a preinstalled Linux like operating system, but its functionalities are

    quite limited due to its tiny size, only 8 MB stored on the build-in flash memory of the Intel Galileo

    board. To enable your IoT project you will need to use a more powerful Linux image. Some

    advantages for booting from a SD Card image are extended file storage and the possibility to install

    Wi-Fi Dongles drivers to enable Wi-Fi connectivity for example.

    1 A sketch is a program written in a C-like language specific to Arduino microprocessors. The program is stored

    in an .ino file.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 4

    Linux images for Intel Galileo are custom-built using Yocto, i.e. you can use Yocto to choose

    what Linux modules you would like to have installed on your Intel Galileo, like i2c-dev. Nevertheless

    the process of building a customized Linux image is quite tedious, so in this tutorial you will use an

    image that Intel has customized for IoT projects called the IoT-dev kit.

    To install the IoT-dev kit image on your micro-SD card follow the next steps:

    - Download the IoT-dev kit zip file from here. And extract them in a folder of your choice.

    - Install Win32DiskImager. Win32DiskImager is a windows program for saving and restoring

    images from a removable drives. You can download it from here

    - Insert your micro-SD card into your SD card adapter and then plug it into your PC SD card

    reader. You should be prompted by your PC that your SD card has been plugged in and you

    will be able to locate it in your Computer directory as shown below :

    Note the name of the drive on which the micro-SD card is on. In my case, it is H.

    - Open Win32DiskImager as an Administrator by right-clicking on the launching icon and

    choosing Run as an Administrator :

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 5

    In the image file field click on the browse files icon and locate the folder in which you

    extracted the iot-dev kit image. Choose all files type in the file type (the *.* option) dropdown to see

    the intel iot-devkit-latest-mmcblkp0.direct file. Select it and click open. You should now see it in the

    image file field of Wind32DiskImage window.

    Make sure the device name is the same as the one your micro SD-card is on and click write

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 6

    - Wait for the writing process to finish and to receive a message saying Writing was successful.

    After this you can safely eject the micro SD card.

    You will use the SD card in a later step to boot from it. You will next install the Arduino IDE

    for Galileo which will allows you to upload programs (called sketches) to your board using an USB A

    to micro B cable

    Download the Arduino IDE for Galileo to your PC

    The Intel Galileo Board needs a specialized version of the Arduino IDE.

    Download the Arduino IDE zip file corresponding to your PC operating system from this site.

    After the download is completed extract the files to your C drive and make sure there is no

    space in the path to the IDE files. You can also change the arduino-windows-1.0.4 folder name to

    Galileo_Arduino to avoid confusing it with other Arduino IDEs for Arduino.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 7

    To launch the IDE double-click the Arduino icon. This is how the Arduino Environment looks

    like.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 8

    You can also right click the application icon and choose to pin it to your Start Menu to locate

    it easier.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 9

    Note: To install the Arduino IDE on Mac OS or Linux check this tutorial.

    To be able to boot from your micro SD card you need to first install an USB driver for the

    board and then upload the firmware on the Intel Galileo. This will ensure that your micro SD card will

    be recognized.

    Install USB Driver for Intel Galileo board on your PC

    To be able to upload sketches on the board from the Arduino IDE, you have to connect your

    Intel Galileo board to your PC using a USB A to micro B cable.

    Windows install

    1. Make sure your micro SD card is not plugged into your Intel Galileo board

    2. First Connect the 12 V power supply that came with your Intel Galileo Gen 2 board.

    3. Wait a few seconds for your USB led to light up. See picture below.

    4. Then connect the micro USB end of your USB cable on your Galileos USB Client port and the

    USB end to an available USB socket on your PC.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 10

    On Windows, when connecting the Board to your PC, after a few seconds while

    Windows will try to install the driver, you will see a message telling you that Windows failed

    to install the driver for it. You will therefore need to install it manually.

    5. Open up the Device Manager. (Either Start > Run > devmgmt.msc, or go to the Control Panel, select System and click Device Manager.)

    6. Locate the Gadget Serial v2.4 device, under the Other devices tree. Right-click that and select Update Driver Software.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 11

    7. In the following window choose Browse my computer for driver software.

    On the next page select Browse and navigate to the hardware\arduino\x86\tools folder within your Arduino Galileo folder that you extracted from the Arduino IDE archive in a previous step. Then click Next.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 12

    8. Next click Install. Wait for the installation to complete and to be prompted with a Windows has successfully updated your driver software message.

    9. Go back to the Device Manager window and check the Ports tree. There should be an entry for Galileo (COM #). Note on which COM # your Galileo is on. You will use this port when uploading sketches and in the next step, updating firmware.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 13

    Note: If you are using a Linux or Mac OS system, check this tutorial for information on how to install

    the driver. Notice that it is meant for an Intel Galileo Gen 1 board, therefore it tells you to connect a

    5 V power supply. If you are using an Intel Galileo Gen 2 board as recommended in this tutorial, you

    will need a 12 V power supply. Make sure you dont confuse them because this could lead to serious

    damage of your board.

    Update the Firmware and set up Galileo

    To update the Firmware follow the next steps:

    1. Make sure your micro SD card is not plugged in on your Intel Galileo board

    2. First connect the 12 V power supply that came with your Intel Galileo Gen 2 board.

    3. Wait a few seconds for your USB led to light up.

    4. Then connect the micro USB end of your USB cable on your Galileos USB Client port and the

    USB end to an available USB socket on your PC.

    5. Open the Arduino IDE and Select Intel Galileo Gen 2 from Tools Board and the COM

    number on which your Intel Galileo is on from Tools Ports

    6. Then go to Help Galileo Firmware Update.

    7. You will be prompted by the following message.

    Click ok. You may be prompted by another message asking you if you want to rewrite the

    existing firmware. Click ok. You will be brought to this window.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 14

    Wait for the Update to finish.

    You can now proceed to boot from the SD Card.

    Boot from the SD Card

    To boot from the SD Card, follow the next steps:

    1. Plug in your micro SD Card.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 15

    2. Plug in the power supply.

    3. Wait for the USB led to light up. You should also be able to see the SD led next to the On

    led blinking to signal SD card is currently being read.

    4. Plug in also the USB cable as before and connect the board to your computer.

    5. You will need to install a new windows driver for the Linux Image on your micro-SD card.

    Once the board is plugged in go to windows device manager (On windows 7 you can

    locate it by going to Start and searching for Device Manager). You will find your Intel

    Galileo listed under Other devices with CDC Serial name. Right click it and select Update

    Driver Software.

    The following window will open. Choose Browse my computer for driver software.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 16

    Next, locate the device name corresponding to your Intel Galileo Board. Under Windows 7, you can

    identify it by going to My Computer. In my case it is named F:

    Double click it and go in the win-driver folder. Right-click the iotdk-serial-external archive

    and choose Extract All

    Coming back to the Update Software Window, select the folder in which you previously

    extracted the iotdk-serial-external archive within the win-driver folder from the files on your Intel

    Galileo board. I extracted it in the same folder. Next click ok.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 17

    Following, click next and wait for the driver to be successfully installed. After this step you

    will see your device under the Ports section with a certain COM number assigned to it.

    If the COM number is greater than 10 change it to a lower available number. To change the

    COM number, follow the next steps :

    1. Go to Device Manager

    2. Locate your Intel Galileo Device under Ports. Right-click it and select Properties.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 18

    3. Select the Port Settings tab and click the Advanced Button.

    In the COM Port Number dropdown, select one under 10 that is not currently in use.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 19

    Next click ok to close the Advanced Settings window. Click ok also in the properties window.

    You should next see the port for your Intel Galileo Board being changed in the Ports Tree.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 20

    Upload the Blink Program After booting from the micro SD card in the previously step, you now need to verify that

    everything is working correctly and that programs can be successfully uploaded to the Galileo board

    through the Arduino IDE. Follow the next steps to upload a sketch that will make the led labeled L on

    your board blink:

    1. Use the Intel Galileo Board setup described in the previous step for how to boot from an

    SD card.

    2. Open the Arduino IDE

    3. In the Tools Board menu select Intel Galileo Gen 2

    4. In the Tools Serial Port select the COM number on which your Intel Galileo Board

    appeared connected in your Device Manager Ports Section (In my case: COM3)

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 21

    5. Go to File Examples Basic Blink

    This will open a program that makes the little link next to the On led on your board blink.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 22

    And wait for the Transfer to be completed.

    Next you should see the LED on your board starting to blink.

    Programs running on the Intel Galileo cannot be stopped. The Blink program will run continously

    until you replace it with a different one. Note that the sketch is stored on the boards memory and

    will start running even after cutting the power supply and then connecting it again. One way of

    stopping all activity on the Intel Galileo is to upload an empty program like the one you see when

    pressing File New in the Arduino IDE.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 23

    You can run into a permission denied error when you try to upload a sketch on your board while

    another sketch is already being uploaded. This can happen if you dont wait for the upload process to

    finish before pressing the upload button again. I have found that a solution to this problem is to

    restart your PC and try to upload the file again.

    Set up the HTU21D Temperature and Humidity sensor

    First unplug the USB cable and then the power supply and proceed to connecting the

    HTU21D sensor. The HTU21D Temperature and Humidity sensor has 4 pins, Ground, 3.3 V Voltage,

    SDA (Serial Data Line), SCL (Serial Clock Line), that need to be connected to the Intel Galileo. I bought

    my sensor with already attached male pins, but you may need to solder them manually to the sensor

    circuit.

    Place the HTU21D sensor on the solderless breadboard with the description of the pins towards you

    like shown below.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 24

    Next connect one male to male jumper wire on each of the 4 columns corresponding to the sensors

    pins like shown below.

    Note : Solderless breadboard columns share the same voltage. You can read more about breadboards here.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 25

    Sparkfun breadboard Picture

    Connect the 3.3 V pin of the sensor to the 3.3 V pin on the Intel Galileo. The Ground Pin of the sensor

    to the Ground pin of the Intel Galileo and the SDA and SCL pins of the sensors to the corresponding

    pins on the Intel Galileo as shown below.

    Now our temperature and humidity sensor is set up. Next :

    1. Plug the micro SD card in your Intel Galileo micro SD card slot.

    2. Connect the Ethernet cable.

    3. Connect the power supply.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 26

    4. Wait for a few seconds so that the USB LED lights up and the board has booted from the SD

    card.

    5. Connect the USB cable between your board and your PC.

    Your board is now ready. You can proceed to uploading a sketch that will read values from the

    Temperature and Humidity sensor and send them to the Thingworx Server. Follow the instructions

    detailed in How to deploy the EMS on Intel Galileo tutorial to learn how to do this.

  • How to Configure your

    Intel Galileo Gen 2 Board PTC Inc. 27

    2015 PTC Inc. The information contained herein is provided for informational use and is subject to

    change without notice. The only warranties for PTC products and services are set forth in the express

    warranty statements accompanying such products and services and nothing herein should be

    construed as constituting an additional warranty. PTC shall not be liable for technical or editorial

    errors or omissions contained herein. Important Copyright, Trademark, Patent, and Licensing

    Information: See the About Box, or copyright notice, of your PTC software. 01012015