This document provides an overview of working with sensors and GPIO pins on the Intel Galileo board running Embedded Linux. It discusses how to access sensor data through the virtual sysfs filesystem and export/control GPIO pins. It introduces the MRAA and UPM libraries that provide an abstraction layer for GPIO access and interfaces to common sensors. Finally, it proposes two starter projects: 1) an on-board LED blink program and 2) using analog light reading to control a buzzer or LED based on room brightness.
This document provides an overview of working with sensors and GPIO pins on the Intel Galileo board running Embedded Linux. It discusses how to access sensor data through the virtual sysfs filesystem and export/control GPIO pins. It introduces the MRAA and UPM libraries that provide an abstraction layer for GPIO access and interfaces to common sensors. Finally, it proposes two starter projects: 1) an on-board LED blink program and 2) using analog light reading to control a buzzer or LED based on room brightness.
This document provides an overview of working with sensors and GPIO pins on the Intel Galileo board running Embedded Linux. It discusses how to access sensor data through the virtual sysfs filesystem and export/control GPIO pins. It introduces the MRAA and UPM libraries that provide an abstraction layer for GPIO access and interfaces to common sensors. Finally, it proposes two starter projects: 1) an on-board LED blink program and 2) using analog light reading to control a buzzer or LED based on room brightness.
Assistant Professor – Pontificia Universidad Javeriana Technical Director CEA-IoT
Embedded Systems Course
2017-II Working with Sensor Data • Linux provides a virtual filesystem called sysfs that allows for easy access to underlying hardware from userspace • This makes working with sensor data as simple as reading and writing to files – Arduino functionality on Galileo is implemented via abstracted sysfs interactions • Quick example: reading the core temperature of the processor (run the following command on the Galileo console): cat /sys/class/thermal/thermal_zone0/temp Divide by 1000 to get the SoC temperature in ⁰C • (Quark processors can run hot, but it’s normal) Working with Sensor Data – GPIO access • Export the port echo -n "3" > /sys/class/gpio/export – A new folder (gpio3) will appear in /sys/class/gpio – This particular GPIO pin is wired to the green onboard LED • Set port direction echo -n "out" > /sys/class/gpio/gpio3/direction • Read/write value echo -n "1" > /sys/class/gpio/gpio3/value echo -n "0" > /sys/class/gpio/gpio3/value MRAA and UPM • The Yocto system installed on the Galileo board provides a set of libraries especially designed for the Intel Eclispe IoT Edition. • These libraries are MRAA and UPM. • MRAA (or libmraa) is a low-level library that offers a translation from the General Purpose Input/Output (GPIO) interfaces to the pins available on the Galileo board. • So instead of reading the raw level information from the GPIO module available on the Linux kernel, a developer can easily select a pin number and work directly with it. • MRAA takes care of the underlying details. • UPM (or libupm) is a repository of sensor representations, written in C++ and utilizing MRAA. MRAA – Low Level Skeleton Library for Communication on GNU/Linux platforms https://github.com/intel-iot-devkit/mraa - http://iotdk.intel.com/docs/master/mraa/
UPM (Useful Packages & Modules) Sensor/Actuator repository for MRAA
https://github.com/intel-iot-devkit/upm - http://iotdk.intel.com/docs/master/upm/ Getting Started Projects The following are the projects that we should develop on our own: 1. On-board LED blink (fixed frequency) – Without the use of the MRAA or UPM libraries, design and implement a program that can turn on and off the OnBoard LED with a fixed frequency (C++ language). • Hint: you should open, write and close a file (remember GPIO access). – Extend the functionality in order to read a pushbutton and control if the LED blinks with a fixed frequency (pushbutton released) or maintains its current state (pushbutton pressed). 2. Analog Read and Digital Write – Activate a digital output (buzzer) if the luminosity of the room is below a certain level. – Extend the functionality to continuously (PWM) control an LED to maintain a “constant” luminosity in the room. GPIO Pins Assignment