embedded programming for everyone micropython&+micropython+(pycon+... · led matrix...
TRANSCRIPT
![Page 1: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/1.jpg)
MicroPython:Embedded programming for everyone
Jim Mussared
![Page 2: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/2.jpg)
MicroPython
Python for microcontrollers
1
![Page 3: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/3.jpg)
○ It’s Python 3... but micro!● Able to run on CPUs like the Cortex M0● 256kiB flash, 16kiB RAM, 16MHz
○ Compilation happens on-device○ “Pythonic” access to low-level hardware (e.g. GPIO)
What is MicroPython?
![Page 4: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/4.jpg)
pyboard
Image: © George Robotics - https://micropython.org/store/
![Page 5: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/5.jpg)
BBC micro:bit2
![Page 6: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/6.jpg)
Image: Stuart Brady / Wikipedia / Public Domain
![Page 7: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/7.jpg)
Image © Grok Learning 2016
![Page 8: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/8.jpg)
○ LED matrix○ Accelerometer○ Magnetometer (compass)○ Temperature○ Buttons○ Bluetooth○ LiPo Battery header○ GPIO (+ SPI, I2C, UART, ADC)
BBC micro:bit
Images: © BBC micro:bit https://www.microbit.co.uk/about

![Page 9: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/9.jpg)
○ AUD $20-$25 each○ Compare to:
● Arduino Esplora ( ~ $80 )● Arduino Zero ( ~ $80 )● Arduino Leonardo ( ~ $40 )● Raspberry Pi Zero ( ~ $10 - $35 )● Raspberry Pi ( ~ $60 )● pyboard (~ $40 )
* Prices are highly variable across countries and stores. Not including Arduino clones.
BBC micro:bit
![Page 10: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/10.jpg)
○ Microsoft TouchDevelop○ Microsoft Block Editor○ CodeKingdoms Javascript○ and... MicroPython!
BBC micro:bit
![Page 11: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/11.jpg)
○ Motorized buggy○ Motor drivers○ Starter kits○ Prototyping boards○ Edge connector
micro:bit accessories
Image: © BBC micro:bit https://www.microbit.co.uk/about
![Page 12: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/12.jpg)
○ http://microbit-micropython.readthedocs.io/○ https://www.microbit.co.uk/○ https://developer.mbed.org/platforms/Microbit/○ https://www.kitronik.co.uk/bbc-micro-bit-accessories.html
micro:bit - more info
![Page 13: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/13.jpg)
Demo
![Page 14: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/14.jpg)
ESP8266
IoT for $5
3
![Page 15: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/15.jpg)
Image © SparkFun / https://www.flickr.com/photos/sparkfun/16730689880 / CC
![Page 16: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/16.jpg)
○ Tiny. Cheap.○ Once configured, very easy to use
● Program over WiFi● Interactive REPL (serial + WiFi)
○ Library support for external components● e.g NeoPixels (LED strips)
○ WiFi! Both AP and Station.● IoT all the things!
ESP8266 features
![Page 17: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/17.jpg)
○ Hardware variations (ESP-01, ESP-12a, etc)● Hardware documentation is hard to find
○ Flash size● Beware of 4Mbit models. Need 8Mbit for MicroPython
○ Programming● Some boards have USB, otherwise there are programmers
○ Easy-to-use models (eg. ESP-01) have very few pins○ No binary distributions of MicroPython (yet)○ and...
ESP8266 gotchas
![Page 18: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/18.jpg)
3.3V
!!!!!!
ESP8266 gotchas
![Page 19: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/19.jpg)
○ Beware of “3.3V” FTDI boards○ Get a programmer or an all-in-one board○ Adafruit’s “Feather Huzzah” is a great example
● https://www.adafruit.com/products/2821
ESP8266 gotchas
Image © Adafruit Industries
![Page 20: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/20.jpg)
○ Angus Gratton: Free as in cheap gadgets: the ESP8266● linux.conf.au 2016● https://www.youtube.com/watch?v=Du1MtqsvSy4
○ Damien George: Scripting the Internet of Things● Pycon Australia 2016
○ Nick Moore: ESP8266 and MicroPython● PyCon Australia 2016
ESP8266
![Page 21: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/21.jpg)
Demo
![Page 22: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/22.jpg)
Building course content
Grokking out
4
![Page 23: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/23.jpg)
○ Grok teaches coding using structured, interactive courses.● Year-round courses● Competitions (courses with leaderboards)
○ Interactive notes and slides○ Comprehensive auto-marking○ Python 3, C++, Java, Bash, SQL, HTML/CSS, …○ All school levels, university and professional.
Grok Learning
![Page 24: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/24.jpg)
Demo
![Page 25: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/25.jpg)
○ Grok provides a sandbox to run your Python code○ Now does the same for micro:bit
● Runs the real micro:bit firmware● Interactive notes● Marker can interact with your code running on simulated device
Simulating the micro:bit
![Page 26: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/26.jpg)
Image © Grok Learning 2016
![Page 27: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/27.jpg)
Image © Grok Learning 2016
![Page 28: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/28.jpg)
Image © Grok Learning 2016
![Page 29: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/29.jpg)
Image © Grok Learning 2016
![Page 30: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/30.jpg)
Demo
![Page 31: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/31.jpg)
○ Starts October 31st 2016○ Newbies, Beginners, Intermediate and micro:bit
Grok Code Quest
![Page 32: Embedded programming for everyone MicroPython&+micropython+(PyCon+... · LED matrix Accelerometer Magnetometer (compass) Temperature Buttons Bluetooth LiPo Battery header GPIO (+](https://reader031.vdocuments.mx/reader031/viewer/2022020122/5e09cd73eeaf0f46a17c7c2e/html5/thumbnails/32.jpg)
ANY QUESTIONS?Web: http://groklearning.com/Twitter: @groklearningEmail: [email protected]