Top Banner
Interacting with Intel Edison FITC Toronto 2015 Esther Jun Kim (@drejkim) 14 April 2015
28
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Interacting with Intel Edison

Interacting with Intel EdisonFITC Toronto 2015Esther Jun Kim (@drejkim)

14 April 2015

Page 2: Interacting with Intel Edison

2

Videohttps://www.youtube.com/watch?v=_VFsdPAoI1g

Page 3: Interacting with Intel Edison

3

Agenda

Introduction to Edison

Getting Edison to see (with Node.js)

Getting Edison to hear (with Python)

Interfacing with the GPIO / blinking LEDs

Speech recognition / speech-activated LEDs

Additional resources

Page 4: Interacting with Intel Edison

Intel Edison

4

Full-fledged computer in a tiny package

Dual-core Atom CPU at 500 MHz

MCU at 100 MHz

Wi-Fi / Bluetooth LE

Yocto Linux

40 GPIOs

Software compatibility

C, C++, Python, Node.js support

Intel IoT Developer Kit

Page 5: Interacting with Intel Edison

Mini breakout boardSparkFun blocks

Arduinobreakout board

5

Page 6: Interacting with Intel Edison

SparkFun blocks

6

Stackable blocks that expand Edison’s functionality while retaining its small form factor

14 blocks so far

Base block – connects peripherals

GPIO block – provides a friendly interface to the GPIO pins

Base and GPIO blocks

Page 7: Interacting with Intel Edison

7

Videohttps://www.youtube.com/watch?v=nrwLyjYovw4

Page 8: Interacting with Intel Edison

8

High-level overview of video streaming on Edison

Edison (server)

• FFmpeg: encodes the webcam video to MPEG1

• Node.js: Listens for the encoded video stream via HTTP

• WebSockets: broadcasts the video stream to all connected browsers

Browser (client)

• jsmpeg: decodes the MPEG1 video

• HTML5 canvas: used to render and display the decoded video

Page 9: Interacting with Intel Edison

GitHubhttps://github.com/drejkim/edi-cam

9

Page 10: Interacting with Intel Edison

10OpenCV

Monitoring w/ motion detection

Eddie3D printer surveillance

Page 11: Interacting with Intel Edison

11In collaboration with Stephanie Moyerman

Videohttps://www.youtube.com/watch?v=QA6kCaXufg0

Page 12: Interacting with Intel Edison

Blinking LEDs

12

Page 13: Interacting with Intel Edison

Lighting a LED

13

Resistor (330Ω): limits current to the LED

Switch turns on and off the LED

LED is on when the switch is closed

LED is off when the switch is open

This circuit probably looks very familiar if you’ve used Arduino

Page 14: Interacting with Intel Edison

Using transistors as switches

14

SparkFun recommends using transistors to light LEDs

Transistor basics:

A small amount of current is needed to use a transistor as a switch

A transistor is controlled by the voltage at the base pin

Reference: SparkFun

Page 15: Interacting with Intel Edison

Wiring up the circuit

15

Page 16: Interacting with Intel Edison

Interfacing with the GPIOs using MRAA

16

MRAA is a low level skeleton library for IO communication on Edison (and Galileo and other platforms)

It is a C / C++ library that also provides Python and JavaScript bindings

Page 17: Interacting with Intel Edison

import mraa

# Other libraries we need

import collections

import time

# Map GPIO block pins to MRAA pin numbers

pins = collections.OrderedDict()

pins["GP44"] = 31

pins["GP45"] = 45

pins["GP46"] = 32

pins["GP47"] = 46

# Initialize LED controls

leds = collections.OrderedDict()

leds["G"] = mraa.Gpio(pins["GP44"])

leds["R"] = mraa.Gpio(pins["GP45"])

leds["W"] = mraa.Gpio(pins["GP46"])

leds["Y"] = mraa.Gpio(pins["GP47"])

17

Python

Page 18: Interacting with Intel Edison

# Set direction of LED controls to out

for color in leds:

leds[color].dir(mraa.DIR_OUT)

LED_ON = 1

LED_OFF = 0

while True:

# Turn all LEDs on for 1 second

for color in leds:

leds[color].write(LED_ON)

time.sleep(1)

# Turn all LEDS off for 1 second

for color in leds:

leds[color].write(LED_OFF)

time.sleep(1)

18

Python

Page 19: Interacting with Intel Edison

19

Videohttps://www.youtube.com/watch?v=YM24yuBLMrU

Page 20: Interacting with Intel Edison

Speech-activated LEDs

20

Page 21: Interacting with Intel Edison

Speech recognition tools

21

Pocketsphinx: a lightweight version of CMU Sphinx for natural language processing

Sphinx Knowledge Base Tool: builds a set of lexical and language modeling files for the Pocketsphinx decoder

Corpus

• Set of words / phrases that the decoder should recognize

• Ex: GREEN, RED, WHITE, YELLOW, ALL

Modeling files

• Dictionary: Provides a pronunciation for every word-like string in a corpus

• Language model: Probabilistic model that estimates the likelihood of words / phrases

Page 22: Interacting with Intel Edison

22

High-level overview of speech-activated LEDs

Record audio

• In 2-sec chunks

•Write .wav file

Decode speech with Pocketsphinx

•Use the dictionary and language model files

•Return array of recognized words

Trigger LEDs

•Take appropriate action based on the recognized words

•Ex: If “RED” in recognized words, toggle on RED LED

Page 23: Interacting with Intel Edison

GitHubhttps://github.com/drejkim/led-speech-edison

23

Page 24: Interacting with Intel Edison

24

Videohttps://www.youtube.com/watch?v=Cq_Jf6MInqE

Page 25: Interacting with Intel Edison

25

Page 26: Interacting with Intel Edison

Edison resources

26

maker.intel.com

Intel IoT Developer Zone

SparkFun Edison products

Edison projects on hackster.io

Edison projects on instructables.com

Page 27: Interacting with Intel Edison

27

Visit Intel @ THE HUB2:00-4:45pm

Page 28: Interacting with Intel Edison