You are previewing Intel® Galileo and Intel® Galileo Gen 2: API Features and Arduino Projects for Linux Programmers.
O'Reilly logo
Intel® Galileo and Intel® Galileo Gen 2: API Features and Arduino Projects for Linux Programmers

Book Description

Intel® Galileo and Intel® Galileo Gen 2: API Features and Arduino Projects for Linux Programmers provides detailed information about Intel® Galileo and Intel® Galileo Gen 2 boards for all software developers interested in Arduino and the Linux platform. The book covers the new Arduino APIs and is an introduction for developers on natively using Linux.

Author Manoel Carlos Ramon is a member of the Intel Galileo development team; in this book he draws on his practical experience in working on the Galileo project as he shares the team’s findings, problems, fixes, workarounds, and techniques with the open source community. His areas of expertise are wide-ranging, including Linux-embedded kernel and device drivers, C/C++, Java, OpenGL, Assembler, Android NDK/SDK/ADK, and 2G/3G/4G modem integration. He has more than 17 years of experience in research and development of mobile devices and embedded circuits. His personal blog about programming is BytesThink (www.bytesthink.com).

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. About ApressOpen
  5. Dedication
  6. Contents at a Glance
  7. Contents
  8. About the Author
  9. About the Technical Reviewers
  10. Acknowledgments
  11. Introduction
  12. Chaptr 1: Intel Galileo and Intel Galileo Gen 2
    1. The Beginnings
    2. About this Book
    3. Why Use Intel Galileo Boards?
      1. The Software Advantages
      2. The Hardware Advantages
    4. Hardware Overview
      1. The Processor: Intel Quark SoC X1000
      2. Introducing Intel Galileo
      3. Introducing Intel Galileo Gen 2
    5. Preparing Your Cables
      1. The Serial Cable for Intel Galileo
      2. The Serial Cable for Intel Galileo Gen 2
      3. Testing the Serial Cables
      4. Exploring the Linux Console
      5. Testing the Data Cables
    6. Summary
  13. Chapter 2: Native Development
    1. Introduction to the Yocto Build System
      1. Yocto and this Book
    2. Creating Your Own Intel Galileo Images
      1. Preparing Your Computer
      2. The SPI vs. SD Card Images
      3. Building Intel Galileo Images
      4. Building and Using the Cross-Compiler Toolchain
      5. Creating a Hello World!
      6. Debugging Native Applications
    3. Booting Intel Galileo with Your Own Images
      1. Booting from SD Card Images
      2. Booting from SPI Card Images
    4. What to Do If Intel Galileo Bricks
    5. Summary
  14. Chapter 3: Arduino IDE and Wiring Language
    1. A Little Bit of History
    2. The Intel Makers Community
    3. Installing the Arduino IDE for Intel Galileo
    4. Connecting Intel Galileo
    5. Installing the Drivers and the Arduino IDE
      1. Installing the Arduino IDE
      2. Installing the IDE on Linux
      3. Installing the Drivers
    6. Understanding the Arduino IDE
    7. Checking the Port and Board Selected
    8. What Is a Sketch?
      1. Compiling and Running the Sketch
      2. Persisted and Not Persisted Sketches
      3. Persisted Sketches and Long Time to Start
    9. Debugging with Serial Console and Serial Communication
      1. Serial.begin(int speed)
      2. Serial.print(data)
      3. Serial.println(data)
      4. Serial.available( )
      5. Serial.read( )
      6. Printing Debug Messages and Using the Serial Console
    10. The Arduino Language Reference and APIs
      1. Structure
      2. Digital I/O
      3. Analog I/O
      4. Time
    11. Running Some Examples
      1. Fade Example
      2. Button Example
      3. ReadAnalogVoltage Example
      4. The Debounce Example
    12. Updating the Firmware Using the IDE
      1. Updating the Firmware with Different Firmware
    13. Troubleshooting the Drivers
      1. Serial Communication Issues with IDE on Windows
      2. IDE Problems with Virtual Machines and 64-Bit Linux
    14. Communicating Sketches with Linux Native Programs
      1. is.Additionalfuture Project Example: Unread Email Alarm with Python and POSIX Functions
    15. Summary
  15. Chapter 4: New APIs and Hacks
    1. Servo API
      1. The Theory versus Practice
      2. The Mistake with Intel Galileo and Servos
      3. What Is New in Servo API?
    2. Serial, Serial1, and Serial2 Objects
      1. Testing the Serial, Serial1, and Serial2 Objects
    3. Improving the I/O Speed
      1. The New APIs for I/O
    4. The Tone API
      1. What’s New in the Tone API?
    5. The pulseIn API
      1. unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000)
      2. What’s New with pulseIn()
      3. A Sample Running pulseIn()
    6. Hacks
      1. Hacking the Servo Library
      2. Hacking the GPIO Expander for New PWM Frequencies
      3. Single Code for Intel Galileo and Intel Galileo Gen 2
    7. Project: DHT Sensor Library with Fast I/O APIs
      1. Materials List
      2. The DHT Sensor
      3. A Workaround Using Tri-State Buffers
      4. Creating a New Library for DHT11 Sensor
    8. Summary
  16. Chapter 5: Networking and Hacks
    1. WiFi Cards
      1. Setting Up the WiFi Mini-PCIe Card
      2. Checking if the WiFi Card Was Recognized
      3. Adding Support to a New WiFi Card
    2. The WiFi API
      1. Scanning the Wireless Networks
      2. Connecting to the WPA or WEB
    3. Hacking the WiFi Library
      1. Step 1: Setting Up the WiFi Connection
      2. Step 2: Restart the Wireless Connection
      3. Step 3: Hacking the WiFi Class
    4. Ethernet API
      1. What’s New with Ethernet API and Intel Galileo
      2. Ethernet Example: Network Time Protocol (NTP)
      3. Dynamic and Static IP Using Ethernet
      4. Simplifying the Sketches by Removing the Ethernet Objects
    5. Transferring Files Between Intel Galileo and Computers
      1. Using ftp
      2. Using scp or pscp
      3. Using an SD Card
      4. Using a USB Pen Drive
    6. Hacking the IDE to Improve the Sketch Transfer
      1. How the Hacked IDE Works
      2. Hacking the Transfers
    7. Summary
  17. Chapter 6: Tweeting with REST API 1.1
    1. Project Details
    2. Material List
    3. System and Hardware Clock
    4. Assembling the Coin Battery
      1. Workaround with 1.5V Batteries
    5. Creating a Twitter Application Account
      1. Step 1: Creating Your Twitter Account
      2. Step 2: Creating the Twitter Application
    6. Creating a Script to Post Messages on Twitter
      1. Step 1: Identifying the API
      2. Step 2: Generating the OAuth Signature with the OAuth Tool
      3. Step 3: Creating a Script to Post on Twitter with Intel Galileo
      4. Step 4: Creating a Sketch that Tweets
    7. Ideas for Improving the Project
      1. Flowers and Plants Communicating with You on a Social Network
    8. Summary
  18. Chapter 7: Using OpenCV
    1. OpenCV Primer
    2. Project Details
    3. Materials List
    4. USB Video Class
    5. Preparing the BSP Software Image and Toolchain
      1. Using eGlibc for Video4Linux Image
      2. Increasing the rootfs Size
      3. Disabling GPU Support on OpenCV
      4. Building the SD Image and Toolchain
    6. Development Library Packages
    7. Connecting the Webcam
    8. Introduction to Video4Linux
    9. Exploring the Webcam Capabilities with V4L2-CTL
      1. Changing and Reading Camera Properties
      2. Pixel Formats and Resolution
    10. Capturing Videos and Images with libv4l2
      1. A Program for Capturing Video
      2. A Program to Capture Images
    11. Working with OpenCV
      1. Building Programs with OpenCV
      2. Capturing an Image with OpenCV
      3. The Same Software Written in Python
      4. Processing Images
      5. Detecting Edges
      6. Face and Eyes Detection
      7. Emotions Classification
    12. Ideas for Improving the Project
      1. Integrating Your Emotions with a Robotic Head
      2. Expanding the Classifications
      3. Improving the Emotion Classification Using Large Databases
    13. Improving the Emotion Classification for Several Faces
    14. Summary
  19. Chapter 8: Creating a Soil Moisture Sensor
    1. Project Details
    2. Material List
    3. Assembling the Moisture Sensors
      1. Mechanical Assembly
      2. Electrical Assembly
    4. Assembling the Flower Face
      1. Testing the Flower Face with the Software
      2. Reviewing the Code
    5. Running the Project
      1. Calibration Procedure
    6. Ideas for Improving the Project
      1. Increasing the Number of Sensors
      2. Automatic Irrigation
      3. Using Appropriate Wires
      4. Using a Commercial Sensor
      5. Tweeting
    7. Summary
  20. Chapter 9: Home Automation and Dynamic Web
    1. Project Details
      1. The Software Architecture
    2. Materials List
    3. Integrating the Components Individually
      1. Testing the Keypad
      2. Testing the PIR Sensor
      3. The PIR Sensor Connection
      4. Testing the YwRobot Relay Module
      5. Testing the TMP36 Temperature Sensor
    4. Creating the Sketch
      1. Sending UDP Messages
      2. Receiving UDP Messages
      3. Joining All Code in a Single Sketch
    5. Creating Your Own Web Server with node.js
      1. Updating node.js
      2. About the npm
      3. Installing Cheerio
      4. Installing socket.io
      5. The Web Page
      6. Writing the Web Server Code
    6. Running the Home Automation System
    7. Ideas for Improving the Project
      1. Power of Ethernet (PoE)
      2. Using express and node.js
      3. Changing the Web Page and Web Server Without Experience with the Web
      4. Creating an Analogic Keypad and Having More I/Os Available
      5. Adding a Username and Password
      6. Using the DHT11 Sensor
    8. Summary
  21. Chapter 10: Power over Ethernet (PoE)
    1. Project Details
    2. Materials List
    3. Assembling the PoE Module
    4. Powering On with the PoE Injector
    5. How It Works
    6. Ideas for Improving the Project
    7. Summary
  22. Chapter 11: Assembling and Controlling a Robotic Arm
    1. An introduction to Robotic Arm Theory
      1. Using an Online Tool to Calculate Your Servos
    2. Considerations About This Project
    3. The Robotic Arm
      1. Assembling the Robotic Arm
      2. Step 1: Preparing the Servos
      3. Step 2: Assembling the Base
      4. Step 3: Assembling the Shoulder
      5. Step 4: Assembling the Elbow
      6. Step 5: Assembling the Wrist
      7. Step 6: Assembling the Mechanical Gripper
      8. Step 7: Assembling a Base
    4. Controlling the Robotic Arm
      1. Building a Servo Control Board
      2. The Hardware
      3. Assembling the Board
      4. The Software
      5. A Gripper Based on Coffee and a Balloon
      6. Preparing the Coffee Gripper
      7. A Sketch for the Coffee Gripper
    5. Ideas for Improving this Project
    6. Summary
  23. Chapter 12: Using an LTE Modem
    1. An Introduction to XMM7160 and XMM7260
    2. Project Details
    3. Materials List
    4. Considerations Related to Antennas
    5. Preparing the Hardware
      1. Step 1: Preparing the SIM Card
      2. Step 2: The NGFF/mPCIe Adaptor
      3. Step 3: Adapting the Modem Card
      4. Step 4: Connecting the Antennas
      5. Step 5: Connecting the Modem to Intel Galileo
    6. Preparing the Software
      1. Step 1: Checking the Modem
      2. Step 2: Loading the CDC-ACM Driver
      3. Step 3: Checking if the Modem Responds to AT Commands
      4. Step 4: Checking the SIM Card Connection
      5. Step 5: Configuring the APN and Attaching it to the Network
      6. Step 6: Creating an IP Interface with pppd
      7. Step 7: Testing the Internet Connection
    7. Testing the Internet Bandwidth
      1. Why Aren’t the Download/Upload Bandwidths Optimal?
    8. Ideas for Improving the Project
      1. Improving the Chat Script
      2. Loading the cdc-acm Driver Automatically
    9. Summary
  24. Appendix A: Intel Galileo I/O and Muxing
  25. Appendix B: Intel Galileo Gen 2 I/O and Muxing
  26. Appendix C: Video Capturing
  27. Appendix D: Picture Grabber
  28. Index