road to republic of iot - esp32 programming and lora

49

Upload: andri-yadi

Post on 22-Jan-2018

645 views

Category:

Technology


2 download

TRANSCRIPT

RIoTHackathon

Technologies: Programming for ESP32

RoadToRIoT - Bogor, Jul 15, 2017

fb.com/andri.yadi | a at dycode dot com

http://andriyadi.me | http://dycodex.com

Andri Yadi

makestro.comCEO

ambassador

Things Connectivity People & Processes

Data Data

Internet of Things

Things Connectivity

Let’s focus on these

NatureSmart Farming Smart City EducationSecurity

Smart Living Maritime

RIoT Hackathon Categories

Transportation Healthcare

Industrial IoT DifableEngagement Fintech &E-Commerce Sport

RIoTHackathon

Hardware Kits

ESP8266Arduino ESP32

EspruinoParticle.ioPhoton, Electron

Arduino 101 Indonesia-madeBluino

MXChip IoT DevKit 

Raspberry Pi

and manymore…

Development Boards

ESP32Arduino 101

RIoT Development Board

RIoT Dev Board - ESP32

TOP SECRET :)

*Not really a secret now

RIoT Dev Board - ESP32

RIoT Dev Board - ESP32

RIoT Sensors & Actuators

UltrasonicRelay

LEDs

Motor shield

Gas

Motion

NFCBuzzer

pH

Heart rate

Finger print

OLED Display

Speaker

Motor

VibrationAlora v2

Alora Kit

Alora Kit

RIoTHardware

Connectivity

Wireless modulation technology

Physical (PHY) layer for long range communications

Operates in the license-free ISM bands all around the world

• 433, 868, 915 Mhz

• Regulated (power, duty-cycle, bandwidth) E.g: EU: 0.1% or 1% per sub-band duty-cycle limitation (per hour)

Sensitivity: -142 dBm

Link budget (EU): 156 dB

We’ll use LoRa

ISM Regulation ISM worldwide regulation 7

Output Power vs Duty Cycle

Countries Frequency band review Max. output power

EU 868 MHz 14 dBm

USA 915 MHz 20 dBm

Korea 900 MHz14 dBm

Japan 920 MHzMalaysia 862 to 875 MHz

20 dBm

Philippines 868 MHzVietnam 920 to 925 MHz

India 865 to 867 MHzSingapore 922 MHzThailand 920 to 925 MHz

Indonesia 922 MHzANZ 915 to 928 MHz

Taiwan 920 to 925 MHz

China 470 to 510 MHz 17 dBm

919 to 923MHz

Communications protocol & architecture utilizing the LoRa physical layer

Data rates are from 300bps to 5.5kbps Has 2 high-speed channels at 11kbps and 50kbps (using FSK modulation)

Secure bi-directional communication

What is LoRaWAN

LoRaLoRaWAN Gateway Network

ServerYour

ApplicationServers

Internet (IP/UDP)Node

LoRa/LoRaWAN Architecture

MQTT

9B 09 05 24 4B 1D 18 09 32 1E 65 A3 00 00 79 01 FF FF 55 B8 D2 BB AB 47 4A 00 C7 02 E5 FE D6 FF F6 FF F5 FF 2B E2 50 00

9B 09 05 24 4B 1D 18 09 32 1E 65 A3 00 00 79 01 FF FF 55 B8 D2 BB AB 47 4A 00 C7 02 E5 FE D6 FF F6 FF F5 FF 2B E2 50 00

{ “lux”, 31.21, “temp”: 23.21, “lat”: -6.121, …}

Node

On-site Backend

LoRa/LoRaWAN Module

RIoTHackathon

ESP32

ESP8266 vs ESP32

CPU: Tensilica Xtensa 32-bit LX6, up to 240 MHz, 600 DMIPS, DUAL cores 3.3V operating voltage Internal memory: 520Kb RAM, 448Kb ROM, 8KB RTC slow & fast RAM External Flash: 512KB to (4 × 16) MiB WiFi (802.11): b/g/n/e/i Bluetooth v4.2 BR/EDR & BLE Peripherals: GPIOs, PWM, ADC, DAC, I2S, UART, SPI, I2C, CAN, RMII, Cap Touch

ESP32 Specs

ESP32 Modules

and more…

ESP32 Boards

Widora Air

Espressif DevKit

Nano32 Pesky ESP32

ESP32 Things ESP32 N1 FiPyESP320

and many more…

Hornbill ARS01119BHuzzah AnalogLamb ESP32

Node32S FireBeetle D-duino-32

ESP32 Boards

and many more…

Programming Languages

Development Platforms

ESP-IDF

Development Tools/IDE

DEMO

Mongoose OS - mJS

load('api_neopixel.js');

let pin = 27, numPixels = 1, colorOrder = NeoPixel.GRB; let strip = NeoPixel.create(pin, numPixels, colorOrder);

function turnNeo(val) { if (val) { strip.setPixel(0 /* pixel */, 92, 34, 56); } else { strip.clear(); } strip.show(); }

turnNeo(true);

Turn on that Neopixel!

Mongoose OS - mJS

GPIO.set_mode(0, GPIO.MODE_INPUT); GPIO.set_int_handler(0, GPIO.INT_EDGE_ANY, function(pin) { print('Pin', pin, 'got interrupt'); let value = GPIO.read(0); print('Value:', value); turnNeo(value); }, null);

GPIO.enable_int(0);

Handling GPIO interrupt

Mongoose OS - mJS

GPIO.set_mode(0, GPIO.MODE_INPUT); GPIO.set_int_handler(0, GPIO.INT_EDGE_ANY, function(pin) { print('Pin', pin, 'got interrupt'); let value = GPIO.read(0); print('Value:', value); turnNeo(value);

let topic = '/devices/' + Cfg.get('device.id') + '/events'; let message = '{"button": ' + value + "}" ; let ok = MQTT.pub(topic, message, 1); print('Published:', ok ? 'yes' : 'no', 'topic:', topic, 'message:', message); }, null);

GPIO.enable_int(0);

Handling GPIO interrupt & publish to MQTT

Internet of

ThingsHow to start?

Make your own!BY SolvING your own problem

Start with…

Be a maker!

*Disclaimer: I have no data of all players in Indonesia yet. Sorry if you’re not listed.and I’m talking about (electronics) maker-related players in general, not only IoT.

Indonesia

Indonesia

Join Communities

Makers.ID

A movement to “democratize” knowledge, hardware kit, and software to help makers to start making in hardware.

Disclosure: it’s initiated and supported by DycodeX

ENABLING MAKER MOVEMENT

Learning

Shop

Community

Software

Projects, tutorials, videos, news, professional trainings

Hardware marketplace: kits, devboards, maker tools

IoT Cloud infrastructure, software libraries, sample code

Offline meetups, seminars, training/hands-on, challenges

Use development board + modules!

ESPectro + LoRa + Alora Kit

makestroid

makestroid

makestroid

..and for sure, JOIN…

[email protected] | http://dycodex.com

IoT & maker movement enabler

DycodeX IS HIRING!

Interns are welcome