Diese Präsentation wurde erfolgreich gemeldet.
Die SlideShare-Präsentation wird heruntergeladen. ×

Micropython for the iot

Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Anzeige
Nächste SlideShare
Micro-python
Micro-python
Wird geladen in …3
×

Hier ansehen

1 von 52 Anzeige

Weitere Verwandte Inhalte

Diashows für Sie (20)

Ähnlich wie Micropython for the iot (20)

Anzeige

Aktuellste (20)

Micropython for the iot

  1. 1. MicroPython for the IoT 16th Fribourg Linux Seminar - 2 may 2019 Jacques Supcik • @supcik jacques.supcik@hefr.ch
  2. 2. Computers vs Embedded Systems
  3. 3. Typical 19” Rack Server User Application Software Operating System Hardware
  4. 4. “Big” embedded systems User Application Software Operating System Hardware
  5. 5. Traditional “small” embedded systems User Application Software Hardware
  6. 6. Small embedded system with “mini” OS User Application Software Operating System Hardware ( ) C / C++
  7. 7. Small embedded system with MicroPython User Application Software MicroPython Hardware Python
  8. 8. Why Python ?
  9. 9. C was good in 1972 Computers changed a lot in 47 years
  10. 10. https://obsolescence.wixsite.com/obsolescence/pidp-11
  11. 11. Guido van Rossum Benevolent Dictator For Life (BDFL) “Computer Programming for Everybody” ● An easy and intuitive language just as powerful as major competitors ● Open source, so anyone can contribute to its development ● Code that is as understandable as plain English ● Suitability for everyday tasks, allowing for short development times
  12. 12. Improved Programmer’s Productivity Extensive Support Libraries Easy to learn High Level Community Object-oriented Extensible (in C/C++) Portable
  13. 13. Python core library
  14. 14. PyPi
  15. 15. Python is almost 30 years old
  16. 16. From Python 2 to Python 3 Python 2.7 Python 3.7 >>> [round(i+0.5) for i in range(6)] [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] >>> [round(i+0.5) for i in range(6)] [0, 2, 2, 4, 4, 6] >>> print "Hello" Hello >>> print "Hello" SyntaxError: Missing parentheses in call to 'print'. Did you mean print("Hello")? >>> 5/2 2 >>> 5/2 2.5 >>> map(lambda x: 2**x, range(6)) <map object at 0x1026d34a8> >>> map(lambda x: 2**x, range(6)) [1, 2, 4, 8, 16, 32]
  17. 17. Python 2 EOL in 2020 and Google “Grumpy” https://github.com/google/grumpy Python 2.7 to Go source transpiler and runtime
  18. 18. Python is one of the most loved language in 2018 https://insights.stackoverflow.com/survey/2018
  19. 19. and Python is the most wanted language https://insights.stackoverflow.com/survey/2018
  20. 20. https://data-flair.training/blogs/python-career-opportunities/
  21. 21. MicroPython
  22. 22. MicroPython “it is compact enough to fit and run within just 256k of code space and 16k of RAM”
  23. 23. MicroPython Code Size < 80KB http://micropython.org/resources/code-dashboard/
  24. 24. MicroPython Created in 2013 by Damien George, Australian programmer and physicist
  25. 25. Kickstarter 2013 : PyBoard + MicroPython
  26. 26. BBC micro:bit : 2016 nRF51822, 16 MHz ARM Cortex-M0
  27. 27. “We enable and inspire all children to participate in the digital world, with particular focus on girls and those from disadvantaged groups” Micro:bit Educational Foundation
  28. 28. BBC Acorn (Cambridge / UK) 1981 : BBC Micro. 6502 CPU 1987 : Archimedes. ARM CPU
  29. 29. Runs on Cortex M3 and Tensilica Xtensa CPUs
  30. 30. ESP8266 ● Wifi 802.11 b/g/n ● 4MB Flash ● 32 KiB instruction RAM ● 32 KiB instruction cache RAM ● 80 KiB user-data RAM US$ 5
  31. 31. ESP32 ● Wifi 802.11 b/g/n ● Bluetooth v4.2 BR/EDR(*) and BLE(*) ● Dual Core ● 4MB Flash ● 520 KiB SRAM *) BR = Basic Rate, EDR = Enhanced Data Rate, BLE = Bluetooth Low Energy US$ 8
  32. 32. PyBoard ● STM32F405RG ● 168 MHz Cortex M4 with hardware floating point ● 1MiB flash ROM and 192KiB RAM ● 3-axis accelerometer US$ 44
  33. 33. US$ 58 - 90
  34. 34. PyBoard (clone) ● STM32F405RG ● 168 MHz Cortex M4 with hardware floating point ● 1MiB flash ROM and 192KiB RAM ● 3-axis accelerometer US$ 17
  35. 35. Digi XBee3® Cellular LTE CAT 1 US$ 100 https://www.digi.com/products/embedded-systems/cellular-modems/xbee3-cellular-lte-cat-1 “Integrated MicroPython programmability for edge compute”
  36. 36. Edge computing https://blog.octo.com/en/edge-computing-learn-to-delegate/
  37. 37. https://www.digi.com/blog/digi-xbee-cellular-versus-rudimentary-cellular-breakout-boards/
  38. 38. Pycom LoPy US$ 30 MicroPython enabled development board (LoRa, WiFi, Bluetooth) https://www.seeedstudio.com/micropython-c-962/Pycom-LoPy-MicroPython-enabled-d evelopment-board-LoRa-WiFi-Bluetoot-p-2785.html
  39. 39. MicroPython on bare metal Raspberry Pi Zero https://github.com/boochow/micropython-raspberrypi
  40. 40. MicroPython on servers and desktop https://github.com/micropython/micropython/wiki/Getting-Started
  41. 41. Commercial support : Zerynth https://www.zerynth.com/
  42. 42. Live Coding
  43. 43. Simple LED Blinker https://gitlab.forge.hefr.ch/fribourg-linux-seminar/19.05/py-blink
  44. 44. Remote temperature sensor https://gitlab.forge.hefr.ch/fribourg-linux-seminar/19.05/py-temperature
  45. 45. Remote temperature sensor and LED
  46. 46. “Sonar” to measure distances https://gitlab.forge.hefr.ch/fribourg-linux-seminar/19.05/py-sonar
  47. 47. “Sonar” to measure distance
  48. 48. References http://bit.ly/upython19 ● https://micropython.org/ ● https://www.python.org/ ● GOTO 2016 • MicroPython & the Internet of Things by Damien George ● 35C3 - MicroPython – Python for Microcontrollers ● Pycon Ireland 2017: MicroPython : The Next Step to World Domination by Steve Holden ● https://io.adafruit.com ● MicroPython for Leon (ESA) ● Writing fast and efficient MicroPython ● The Early Days of MicroPython
  49. 49. Backup
  50. 50. Abstract According to the 2018 survey of Stack Overflow, Python is one of the most loved programming languages and the most wanted one. Python is used in many world-class software companies as well as in high schools, colleges and universities. MicroPython is an implementation of the Python 3 programming language optimized for embedded systems. During this presentation, I will present MicroPython and its derivatives, and I will show you some typical use cases for MicroPython. In the second part, I will demonstrate how to install the system on a cheap microcontroller and during a live coding session, I will implement a functional IoT device.

×