io iot device ce ar arch chitect ecture e and pr
play

Io IoT Device ce Ar Arch chitect ecture e and Pr Programming - PowerPoint PPT Presentation

Io IoT Device ce Ar Arch chitect ecture e and Pr Programming 01219335 Data Acquisition and Integration Chaiporn J Chaipo n Jaik aikae aeo De Department of f Computer Engineering Kasetsart Unive versity Revised 2020-08-20 Ou


  1. Io IoT Device ce Ar Arch chitect ecture e and Pr Programming 01219335 Data Acquisition and Integration Chaiporn J Chaipo n Jaik aikae aeo De Department of f Computer Engineering Kasetsart Unive versity Revised 2020-08-20

  2. Ou Outline • Components of typical IoT devices • Hardware platforms • Programming methods 2

  3. Ma Main Co Components Microcontroller Memory (RAM/Flash) Communication Sensors/ CPU Module Actuators Power Supply 3

  4. Mi Microcontroller r Examples • Espressif’s ESP32 ◦ Dual Xtensa cores @240 MHz ◦ 520 KB SRAM ◦ Wi-Fi: IEEE 802.11 b/g/n https://www.electrodragon.com/product/ esp32-wifi-bluetooth-ic-model/ ◦ Bluetooth v4.2 • Microchip’s ATSAMD21G18 ◦ ARM Cortex M0+ @48 MHz ◦ 256 KB programmable flash ◦ 32 KB SRAM http://www.jarzebski.pl/arduino/arduino-i- klony/arduino-m0-zero-pro-atsamd21g18.html 4

  5. Co Communication Device • Medium options ◦Electromagnetic, RF ◦Electromagnetic, optical ◦Ultrasound radio wave Radio bit stream Transceiver 5

  6. Tr Transceiver Characteristics • Service to upper layers: packet, byte, bit • Data rate • Power control • Communication range • etc . 6

  7. Tr Transceiver States • Transceivers can be put into different operational states , typically: ◦ Transmit (Tx) Tx Idle Rx ◦ Receive (Rx) ◦ Idle – ready to receive, but not doing so Sleep ◦ Sleep – significant parts of the transceiver are switched off 7

  8. Se Sensor ors • Main categories ◦ Passive, omnidirectional ◦ Examples: light, thermometer, microphones, hygrometer, … ◦ Passive, narrow-beam ◦ Example: Camera ◦ Active sensors ◦ Example: Radar, ultrasonic sensor • Important parameter: Area of coverage ◦ Which region is adequately covered by a given sensor? 8

  9. Ener Energy S Supply upply • Goal: provide as much energy as possible at smallest cost/volume/weight/recharge time/longevity ◦ Depending on the application, recharging may or may not be an option • Options ◦ Primary batteries – not rechargeable ◦ Secondary batteries – rechargeable, only makes sense in combination with some form of energy harvesting 9

  10. Ener Energy S Supply upply - Re Requirements • Low self-discharge • Capacity under load • Efficient recharging at low current • Voltage stability (to avoid DC-DC conversion) 10

  11. Ba Battery y Examples • Energy per volume (Joule/cc): Primary b batteries Chemistry Zinc-air Lithium Alkaline Energy (J/cm 3 ) 3780 2880 1200 Secondary b batteries Chemistry Lithium NiMH NiCd Energy (J/cm 3 ) 1080 860 650 http://en.wikipedia.org/wiki/Energy_density https://en.wikipedia.org/wiki/Lithium-ion_battery http://clipart-library.com/ 11

  12. Ex Example: ample: B Batter ery Lif Life (1) e (1) • Consider a device with average power consumption of 20 mA • If the device is powered by a 3000 mAh battery, how long will the device last without charging? 12

  13. Mu Multiple P Power Con r Consump mption on Mod Modes • Do not run device at full operation all the time ◦ If nothing to do, switch to power safe mode • Typical modes ◦ Controller: active, idle, sleep ◦ Radio mode: Turn on/off transmitter/receiver, both ◦ Strongly depends on hardware • Questions: ◦ When to throttle down? ◦ How to wake up again? 13

  14. Ex Example: ample: B Batter ery Lif Life (2) e (2) • Consider a device whose components’ power consumption characteristics are as follow: Component Power consumption Time fraction in each mode Processor Active mode: 10 mA 10% Sleep mode: 0.01 mA 90% Radio module Transmitting mode: 100 mA 1% Receiving mode: 20 mA 5% Idle mode: 10 mA 94% Sensor Active mode: 30 mA 5% Idle mode: 0 mA 95% • What is the average power consumption of the device? 14

  15. Io IoT M Modul dule B e Boards ds • Designed for easy prototyping • Combining processor, power supply circuit, commonly- used peripherals into a single board http://www.jarzebski.pl/arduino/arduino-i-klony/arduino-m0-zero-pro- atsamd21g18.html https://www.adafruit.com/product/2772 https://www.electrodragon.com/product/esp32-wifi-bluetooth-ic-model/ https://github.com/LilyGO/TTGO-T8-ESP32 15

  16. Ar Arduino Modules • Various communication "shields" LoRa Shield WiFi Shield https://www.arduino.cc/en/Main/Boards http://www.dragino.com/products/nb-iot/item/130-nb-iot-shield.html https://store.arduino.cc/usa/arduino-wifi-shield NBIoT Shield http://www.dragino.com/products/lora/item/102-lora-shield.html 16

  17. BBC' BBC's s Mi Micro:bit https://microbit.org/guide/features/ 17

  18. Ra Raspberry y Pi • By Raspberry Pi Foundation • Controller ◦ 1.4 GHz 64/32-bit quad-core ARM Cortex-A53 • Communication Raspberry Pi 3 Model B+ ◦ Ethernet, WiFi, and Bluetooth Raspberry Pi Zero W https://www.raspberrypi.org/products/ 18

  19. ES ESP32-ba based M sed Modul dules es • NodeMCU-32S https://www.shenzhen2u.com/NodeMCU-32S ◦ LED and switches ◦ USB connector • TTGO T-Beam ◦ LoRa + OLED + GPS modules ◦ Battery charger and holder ◦ USB connector https://www.aliexpress.com/i/32967228739.html • WEMOS D32 Pro ◦ Micro SD slot ◦ Battery charger ◦ USB connector https://wiki.wemos.cc/products:d32:d32_pro 19

  20. KidBri Ki dBright Mo Modul dule ESP32 Module Temperature Sensor Light Sensor - 2 cores @240 MHz - 520 MB RAM USB-C Connector - 4 MB Flash Push Switches Triple-Axis Accelerometer & Magnetometer 16x8 LED Matrix Real-Time Clock Battery External peripheral connectors 20

  21. De Device P Programming

  22. Ty Typical Development Process • Firmware flashing with an external chip programmer Source ce code (C (C/Assembly) Microcontroller Cross Compiler/Assembler Fi Firmware code 010101 U U Uploader 011101 (b (binary) S S 110110 Software B B Chip Programmer 22

  23. Ty Typical Development Process • Firmware flashing with on-chip bootstrap loader Source ce code Microcontroller (C/Assembly) (C module Cross Compiler/Assembler flash memory Firmware co Fi code 010101 U U Uploader Bootstrap 011101 (b (binary) S firmware S 110110 Software Loader (BSL) B B code 23

  24. Ty Typical Development Process • Script uploading with MicroPython firmware Microcontroller 010101 Micr croPython 011101 module 110110 fi firmware (binary) (b uploaded only once flash memory Bootstrap U U Uploader Loader (BSL) S S Python Py Software B B source ce code .py (. (.py py) 24

  25. Ba Basi sic Peri ripheral Co Control wi with Mi MicroPython

  26. Ex Example: ample: LED LED C Contro rol • Let's write code to control the red LED (usually used for indicating WiFi connectivity) 26

  27. LED LED C Control l – Sc Schematic ic • Red LED is connected to IO2 KidBright's Schematic provided by INEX 27

  28. LED LED C Control l – Py Python Code from machine import Pin from time import sleep # make pin 2 an OUTPUT, refer to it as 'led_wifi' led_wifi = Pin(2, Pin.OUT) while True: # set pin 2’s voltage to 3.3V led_wifi.value(1) sleep(0.5) # set pin 2’s voltage to 0V led_wifi.value(0) sleep(0.5) 28

  29. Ex Example: ample: Sw Switch Status • Let's write code to read status of a push-button 29

  30. Sw Switch Status – Sc Schematic ic • Two push-buttons are connected to IO14 and IO16 pins • When a button is pushed, its status reading is 0 • When a button is released, its status reading is 1 KidBright's Schematic provided by INEX 30

  31. Sw Switch Status – Py Python Code from machine import Pin from time import sleep # make pin 16 an INPUT pin with pull-up activated # (i.e., give logic 1 when the pin is floating); # then refer to it as 's1' s1 = Pin(16, Pin.IN, Pin.PULL_UP) while True: # read and print out the button value print("S1 status =", s1.value()) # delay a little to slow down screen output sleep(0.1) 31

  32. Co Conclusi sion • An IoT device usually consists of a processor, power supply, communication module, and sensors • There are various IoT hardware modules in the market • ESP32-based modules are quite popular for beginners • MicroPython allows controlling ESP32-based module with Python scripts 32

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend