40
Ajith KP MediaTek Labs MediaTek LinkIt™ Smart 7688 Duo : Peripheral Programming using Arduino & Python

Peripheral Programming using Arduino and Python on MediaTek LinkIt Smart 7688 Duo

Embed Size (px)

Citation preview

Ajith KP MediaTek Labs

MediaTek LinkIt™ Smart 7688 Duo : Peripheral Programming using Arduino & Python

Topics

2

WHO IS MEDIATEK What is MediaTek Labs

LinkIt Smart 7688 HDK’s

LinkIt Smart 7688 Software tools

Peripheral Programming

Challenge

Questions

27 offices across 12 countries

A Global Company

USA

UK

Denmark Sweden

Dubai India

Singapore

Mainland China

Korea

Japan

Finland

Taiwan Hsinchu HQ

3

Source (ranking by revenue of 2014): Strategy Analytics, Gartner, IDC, IC Insight, iSuppli and MediaTek company data * Combined with MStar. Source (Rankings by volume): Strategy Analytics, Displaysearch, iSuppli , MediaTek company data

Feature phone

#1

Digital TV*

#1

Optical disc drive

#1

DVD/BD player

#1

Smartphone

#2

Tablets

#2

Connectivity network

#3

Leading Market Position with Cross-Platform Synergy

2016-03-03 Copyright © MediaTek Inc. All rights reserved. 4

MediaTek Powered Products

5

▪ New Amazon Kindle Tablets ▪ Sony Android TV Smartphone HTC M9+ / Sony Xperia E4

Topics

6

Who is Mediatek

WHAT IS MEDIATEK LABS LinkIt Smart 7688 HDK’s

LinkIt Smart 7688 Software tools

Peripheral Programming

Challenge

Questions

MediaTek Labs A Developer Centric Ecosystem

Global program – free to join

Supporting developers: Device creation

App development

Services

labs.mediatek.com

2016-03-03 Copyright © MediaTek Inc. All rights reserved. 8

Enabling Developer and Maker Success

Dev resources

Insights and inspiration

Access to hardware

SDKs for makers (Arduino), professional developers (C/Eclipse) and Linux (OpenWrt and Ubuntu)

Technical support

Peripherals (sensors, etc)

Cloud management of device data

Developer advice & matchmaking

Design, production & go-to-market help

Go from idea to prototype to product

MediaTek LinkIt™ portfolio Software and hardware development platforms for wearables & IoT

Copyright © MediaTek Inc. All rights reserved.

LinkIt Assist 2502 labs.mediatek.com/2502

Wearable form factors

For professional developers (C/Eclipse)

LinkIt ONE

labs.mediatek.com/linkitone

Unrivalled connectivity on a single board

For DIY & maker community (Arduino)

LinkIt Connect 7681 labs.mediatek.com/7681

The simple way to Wi-Fi enable your devices

For low-cost smart home or office deployment

LinkIt Smart 7688 labs.mediatek.com/7688

Open-source Wi-Fi platform for a more connected world

OpenWrt Linux, Python, Node.js, Arduino

2016-03-03 Copyright © MediaTek Inc. All rights reserved. 10

Rapidly growing LinkIt community

Topics

11

Who is Mediatek

What is MediaTek Labs

LINKIT SMART 7688 HDK’S LinkIt Smart 7688 Software tools

Peripheral Programming

Challenge

Questions

MediaTek LinkIt™ Smart 7688 The open-source Wi-Fi platform for a more

connected world

12

System-on-Chip MediaTek MT7688AN, a highly Integrated compact SoC for IoT devices with Wi-Fi connectivity

Software Dev Tools • OpenWrt • Python & Node.js • Arduino Plug-in

LinkIt Smart 7688 HDKs • LinkIt Smart 7688 HDK

with MT7688 MPU • LinkIt Smart 7688 Duo

with MT7688 MPU + MCU

• Firmware & bootloader

LinkIt Smart 7688 HDKs

13

LinkIt Smart 7688 Duo (Arduino Compatible)

LinkIt Smart 7688

Two versions of HDK Run OpenWrt Linux Multiple programming options

MEDIATEK LINKIT™ SMART 7688 DUO

14

15

USB Host

USB Power & MCU USB port

MPU Reset Button

Wi-Fi Reset Button

MCU Reset Button

MT7688AN + 128MB DDR2 (Under shielding cover)

Micro SD Slot

Atmega32U4

32 MB Flash

LinkIt Smart 7688 Duo

Hardware Spec

▪ MPU & MCU

• MT7688 - 580MHz MIPS 24KEc CPU • ATmega32U4

▪ Memory • Flash 32MB • RAM 128MB DDR2 • SD card

▪ Power • USB 5 V

▪ Digital I/O • 24 pins + (3 pins on the MT7688AN)

▪ Analog Input • 12 pins

Hardware Spec

External Interrupts • 8 pins (S0, S1, S2, S3, D8, D9,

D10, D11)

I2C • 1 set

SPI • 1 set (Master & Slave)

UART • UART Lite

1 Set MT7688AN 1 Set ATmega32U4

• UART host 1 Set MT7688AN

Wi-Fi • 802.11 b/g/n (2.4G)

PWM • 8 pins (D3, D5, D6, D9, D10,

D11, D12, D13 )

Topics

18

Who is Mediatek

What is MediaTek Labs

LinkIt Smart 7688 HDK’s

LINKIT SMART 7688 SOFTWARE TOOLS Peripheral Programming

Challenge

Questions

LinkIt Smart 7688 SDTs

19

Running OpenWrt Linux (Chaos Calmer) OS Loaded with a range of packages to enable

the development of IoT device software

Multiple programming options

Duo only

OpenWrt

▪ Linux distribution focus on embedded devices

• Started from 2004

• Typically wireless router

• Full-featured, easily modifiable OS for routers

▪ A framework to build network applications

• Free from the restriction and configuration provided by the vendor

20

OpenWrt Packages

Dropbear • A light-weight SSH server

cURL • Command line tool for transferring

data with URL syntax

stty UVC USB camera support

• Kernel drivers for USB camera support

Python pySerial

• Library providing serial port access functions in Python

OpenSSL

Node.js node-serialport

• Library providing serial port access functions in JavaScript

Bridge library • Arduino Yun Bridge library

libmraa • C/C++ library with bindings to

JavaScript and Python for I/O interface in Linux

UPM • A set of sensor drivers written in

libmraa

AVAHI • Facilitates service discovery on a

local network using the mDNS/DNS-SD protocol suite

21

Supported Programming Languages

22

Language Tools & Libraries

Applications Host Platform

C/C++ • Cross Compilation Tool Chain

• System Programming

• OS X • Linux

Python • Python runtime on Linkit Smart 7688

• Prototyping • Network • IoT application

• OS X • Linux • Windows

Node.js • Node.js runtime on LinkIt Smart 7688

• Prototyping • Network • IoT application

• OS X • Linux • Windows

Topics

23

Who is Mediatek

What is MediaTek Labs

LinkIt Smart 7688 HDK’s

LinkIt Smart 7688 Software tools

PERIPHERAL PROGRAMMING Challenge

Questions

Peripheral Connections in LinkIt™ Smart 7688 Duo

24

Har

dw

are

MT7688 ATMega32U4

UART

USB Device/SD

Sensors

Wi-Fi

OpenWrt

Arduino

LinkIt Smart 7688 Duo : Hardware Architecture

Peripheral Programming Models

25

3 Programming Models

Primitive UART Connection

Firmata Protocol

Arduino Yun Bridge Library

Peripheral Programming Primitive UART Connection

26

Soft

war

e

Python Node.js

UART port

Sensor Drivers

UART Library

App Logic

OpenWrt

Arduino

Sensors

C

int c = Serial1.read();

if (c != -1) { switch(c) { case '0': digitalWrite(13, 0); break; case '1': digitalWrite(13, 1); break; } }

s=serial.Serial("/dev/ttyS0", 57600)

def loop(): s.write("1") time.sleep(1) s.write("0") time.sleep(1)

27

28

Soft

war

e Firmata

Python Node.js

Sensors

Firmata

App Logic

OpenWrt

Arduino

C

Peripheral Programming Firmata Protocol

29

MCU – MPU Communication

Sketch

provided by

Library

board = Arduino('/dev/ttyS0')

while True:

board.digital[13].write(1) sleep(0.5)

board.digital[13].write(0)

sleep(0.5)

30

31

PyFirmata

• pip install pyfirmata

• Example code : https://github.com/tino/pyFirmata

• Arduino side : Use StandardFirmata Sketch

PyMata

• pip install pymata

• Example code : https://github.com/MrYsLab/PyMata

• Arduino Side : Use FirmataPlus sketch

Programming with Firmata Protocol

32

Soft

war

e

Sensors

Bridge Library

Sensor Drivers

Bridge Library

App Logic

(MPU provides Wi-Fi & USB Host / SD)

OpenWrt

Arduino

Peripheral Programming Bridge Library

Everything is controlled through Arduino

Activate Bridge

Library

# uci set yunbridge.config.disabled=’0’

# uci commit

# reboot

33

Arduino Bridge Library : https://www.arduino.cc/en/Reference/YunBridgeLibrary

Bridge Library

Process • Process is used to launch

processes on the Linux processor, and other things like shell scripts.

Console • Console can be used to

communicate with the network monitor in the Arduino IDE, through a shell. Functionally, it is very similar to Serial.

FileIO • An interface to the Linux file

system. Can be used to read/write files on the SD card.

HttpClient • Creates a HTTP client on Linux.

Acts as a wrapper for common CURL commands, by extending Process.

Mailbox • An asynchronous, session-less

interface for communicating between Linux and Arduino.

And more...

34

MediaTek Cloud Sandbox

RESTful API’s

Visualize Data

FOTA

Data channels • Float

• GPS location

• Video

• Pictures

• Controllers

35

Hardware

36

LinkIt Smart 7688 Duo

Breakout board

Grove Sensors and Servo

LinkIt Smart 7688 Duo Testimonials

37

“I have recently decided to learn embedded Linux, and have bought over 14 different development kits. Though they all run Linux, they all have their pros and cons. So far out of all of them I have liked the MediaTek LinkIt Smart 7688 the best,” Mike Moy, Sr. Design Engineer, Versamodule.com

What’s Next ?

38

▪ March 8th, 2016 - Bluetooth Low Energy communication with MediaTek LinkIt ONE

▪ March 17th, 2016 - From concept to consumer – make your IoT idea a commercial reality

More Info : http://home.labs.mediatek.com/march-

webinars-make-the-most-out-of-your-iot-project/

Questions?

39

Download Resources:

labs.mediatek.com/7688

MediaTek Cloud Sandbox:

labs.mediatek.com/mcs

Check the Forum:

labs.mediatek.com/forums

Copyright © MediaTek Inc. All rights reserved. 40