Close

Hack Chat Transcript, Part 1

A event log for Python and the Internet of Things Hack Chat

The power of Python on microcontrollers

dan-maloneyDan Maloney 04/03/2019 at 20:040 Comments

Dan Maloney11:56 AM
Hi all - we'll get started in just a minute. Quite a turnout so far..

andy.duli joined  the room.11:57 AM

limor11:57 AM
yayyyy!@

limor11:57 AM
/me does a jig

JustTheDazz11:57 AM
Hi Everyone!

Cesos11:58 AM
Hello world!

juli11:58 AM
Hi everyonee

andy.duli11:59 AM
Hello everyone. Just lurking. I'm working on a router at the moment.

Boian Mitov11:59 AM
Hello everyone :-)

Dan Maloney12:00 PM
Alright, let's kick it off. Welcome to the Python and IoT Hack Chat. Today we have the Adafruit CircuitPython team online to discuss all your Python questions with microcontrollers and IoT stuff. Not sure who on the Adafruit side is going to take lead - I've seen Limor and Kattni so far. Anyone else want to say hi? Oops - there's PT too. Anyone else.

Dan Maloney12:00 PM
?

limor12:00 PM
yahhh! we're ready1

tannewt12:00 PM
Hi! I'm Scott and also work on the CircuitPython core.

jamesonbeebe12:01 PM
YEAH! LETS DO THIS!

limor12:01 PM
we got with us @tannewt and @Dan Halbert

deshipu12:01 PM
the video stream:

Kattni12:01 PM
Hello, everyone! I'm Kattni and I work with the CircuitPython libraries!

limor12:01 PM
also @Bryan Siepert perhaps

pt12:01 PM
here we go!

Dan Halbert12:01 PM
I'm Dan and I also work on CircuitPython core

delatorrecohen joined  the room.12:02 PM

Dan Maloney12:02 PM
So Scott, Dan, Limor, PT, Kattni, and Bryan

Kattni12:02 PM
Bryan won't be joining us

Dan Maloney12:02 PM
Welcome all and thanks for being here.

delatorrecohen12:02 PM
Hi everyone...

Rebecca E. Skinner12:02 PM
Rebecca Skinner, interested in IoT, environmental data, sensors, etc.

Dan Maloney12:03 PM
Hi Rebecca, welcome

limor12:03 PM
ok everybody

limor12:03 PM
so - on the topic of IoT and Environmental sensors

limor12:03 PM
we haz like 150 libraries for all sorts of sensors you can use with CircuitPython

limor12:04 PM
yah @kattni is the official Library Keeper

limor12:04 PM
so we have your sensors covered - whew!

limor12:04 PM
next up we recently added IoT support to circuitpython - using an ESP32 as a a wifi coprocessor

limor12:04 PM
SO

limor12:04 PM
you are about to ask

Kattni12:04 PM
CircuitPython libraries list! https://circuitpython.readthedocs.io/projects/bundle/en/latest/drivers.html

limor12:04 PM
WHY DIDNT YOU JUST USE THE ESP32!?!?!

Andrej Mosat12:04 PM
There seems to be the micropython forum, now branching off to other platforms (stm32, esp32, circuit python, microbit) So what is the overall strategy on the circuit / adafruit python both software and hardware ?

limor12:04 PM
LIMOR WHAT IS RONG WITH YOU? THER EIS ESP32 FOR MICROPYTHON!

limor12:04 PM
great quesiont!

limor12:04 PM
answer is - we wanted native usb for the awesome circuitpython experience (1)

limor12:05 PM
and (2) we find that we do best when we offload all the SSL TLS ceriticate stuff and have it run async

limor12:05 PM
ESP32 is so cheap and easy to use, its great as a coproc - lovin' it

jamesonbeebe12:05 PM
I'll tip my hat to that!

limor12:06 PM
for the hardware API we're trying very very very hard to stick to *one* api for all hardware so we only have to maintain one version of our drivers

Hendra Kusumah12:06 PM
hello all, a micropython enthusiast here from Indonesia. Thanks for the answer regarding circuitpython for esp32 @limor . I can sleep in peace now

Andrej Mosat12:06 PM
like HAL ?

deshipu12:06 PM
@Andrej Mosat like the "machine" module on the MicroPython

limor12:07 PM
e.g. the Si7021 lirbary will run on a Rapi, Google Coral, Nvidia Jetson, Circuit Playground, nRF52840...

pt12:07 PM
@Andrej Mosat for circuitpython, beginner friendly, drivers for tons of hardware, works with the most devices/hardware

Dan Halbert12:07 PM
@Andre like digitalio, busio, pulseio, board, ...

limor12:07 PM
its basically a HAL - we've just been writing drivers for like 15 yrs so we have a good idea of how to support all these devices across a wide variety of hardware without getting into unending ifdef's

Dan Maloney12:08 PM
The Jetson, you say? Exciting - Nvidia will be along for a Hack Chat in a few weeks to talk about the Jetson and AI at the Edge

limor12:08 PM
yep thats right! Jetson has support thanks to Nvidia's engineers

pt12:08 PM
BLINKA, which is circuitpython for linux works on jetson now, so you get hardware support for lots of things

Dan Maloney12:08 PM
Schweet

jamesonbeebe12:08 PM
@Dan Maloney That's so comforting to hear!

limor12:08 PM
so OLEDs, einks, sensors, etc...all work across the devices the same

limor12:08 PM
but keeping it simple

Dan Smith joined  the room.12:09 PM

jamesonbeebe12:09 PM
so everyone's in on this. and by everyone... I mean the guys at NVIDIA too?

limor12:09 PM
and takign advantage of python's weak typing for great success :)

Kattni12:09 PM
The Blinka library means that you can run CircuitPython libraries and example code with Python with no changes. So there's only one driver and one code base to maintain.

limor12:10 PM
https://github.com/adafruit/Adafruit_Blinka/pull/98 <- Nvidia jetson

limor12:10 PM
so with all this basis we wanted to make it super easy to make IoT devices

happyday.mjohnson joined  the room.12:10 PM

jamesonbeebe12:10 PM
@limor Noice

limor12:11 PM
so the pyportal is designed for "get online, get a json or xml feed, parse it, display it"

david.longley joined  the room.12:11 PM

limor12:11 PM
its really really easy, you just point it at the URL and give it the JSON traversal path and b00m - data

John Edgar Park joined  the room.12:11 PM

rmuller325 joined  the room.12:11 PM

klaasdc12:12 PM
Any chance we'll see mathematical things in circuitpython (e.g. like numpy)?

John Edgar Park12:12 PM
This next! https://api.chucknorris.io/

limor12:12 PM
python makes iot really easy compared to C

todbot12:13 PM
oh but strings are so easy in C! /s

Dan Halbert12:13 PM
@klaasdc numpy is really large, and even on the big boards, we only have 256kB of RAM. So all of numpy or even pieces will not fit.

happyday.mjohnson12:13 PM
has irq support been added to gpio pins yet in CP?

limor12:13 PM
python strings and parsing is sooooo nice. built in json and xml!

deshipu12:13 PM
once you have numpy, you can do machine learning ;-)

deshipu12:13 PM
very very very slow machine learning

WRR joined  the room.12:14 PM

todbot12:14 PM
Any plans on supporting python packages with native code loadable at runtime (hard, I know, but would be really useful)

limor12:14 PM
if you want to use numpy you should use a coral/pi/jetson :) -even if it fit on a microcontroller, it would be so sad and slow

happyday.mjohnson12:14 PM
not for CP, but python in general - the challenge i have w/ python is lack of mobile gui programming. i end up using flutter for this, python for rasp pi, cp for mcu...

limor12:15 PM
python doesn't really like interrupt support. there's threads but people shoot themselves with it.

happyday.mjohnson12:15 PM
re: irq support. it works in micropython?

Dan Halbert12:15 PM
@happyday not interrupts specifically - we want to support asynchronous programming, but we are lookign for a simple model that will not be timing dependent. Right now we allow people to poll, and we have native classes that use interrupts, but haven't exposed interrupts specifically

Dan Smith12:15 PM
LadyAda: Your educational offerings are excellent. Is there one page that has reasons for middle school students to learn Python? I'm seeing some good ones in this discussion. thanks!

WRR12:15 PM
You mentioned earlier that SSL/TLS was easier to offload and run asynchronously; does CircuitPython support general-purpose concurrency?

happyday.mjohnson12:15 PM
what is wrong with pin,irq() ala micropython?

Dan Halbert12:16 PM
See discussion https://github.com/adafruit/circuitpython/issues/1380

limor12:16 PM
you can't alloc memory in an irq in micropython, so you quickly bump into that because python loves to allocate memory all the time

delatorrecohen12:16 PM
how do you see Ai at the edge and Circuitpython working with the Adafruit IoT ecosystem?

tannewt12:16 PM
@todbot MicroPython just added support for native loading through mpy

Chris joined  the room.12:16 PM

Dan Halbert12:16 PM
micropython interrupt handlers are very restricted in what you can do

happyday.mjohnson12:16 PM
OH. I want to thank everyone on the CP team and at Adafruit. You are very supportive, happy, and kind.

todbot12:16 PM
@tannewt awesome! very excited by this

billmcalister joined  the room.12:17 PM

limor12:17 PM
concurrency/threads/irqs are not in circuitpython - see above - but thats why having an ESP32 is great, hardware concurrency is easier to manage than software :) send a request to get data, the ESP32 buffers the socket for ya

happyday.mjohnson12:17 PM
re: micropython irq restricted. But good enough for 90%ish stuff? I mean for lipo stuff. Go to sleep. Wake up when (motion, some other sensor reading) detected.

pt12:18 PM
@delatorrecohen probably with adafruit.io which is our data service that works with any device, so when data logging, etc. are needed we'd use that, probably with BLINKA (circuitpython on linux)

Chris12:18 PM
Thoughts about generic MQTT libraries?

WRR12:18 PM
Interesting, thanks for the GitHub issue and info

Kattni12:18 PM
@Dan Smith Check out the https://learn.adafruit.com/welcome-to-circuitpython to learn more about CircuitPython. This is where everyone starts. It may have what you're looking for!

Dan Halbert12:18 PM
@happyday take a look at the github issue I posted above for further details on our thinking

Dan Halbert12:18 PM

https://github.com/adafruit/circuitpython/issues/1380

GITHUB

Simpler mechanisms for asynchronous processing (thoughts) · Issue #1380 · adafruit/circuitpython

These are some strawman thoughts about how to provide handling of asynchronous events in a simple way in CircuitPython. This was also discussed at some length in our weekly audio chat on Nov 12, 2018, starting at 1:05:36: https://youtu.b...

Read this on GitHub

limor12:18 PM
@happy, there's no sleep modes supported - check out the TPL5xxx boards to have time-based sleep.

deshipu12:19 PM
@happyday.mjohnson it's simply not CircuitPython's goal to give you access to everything, and interrupts are hard to wrap your head around

happyday.mjohnson12:19 PM
@limor - you mean no sleep modes supported in CP? Obviously the m0, etc. have deep sleep... that can be interrupted.

limor12:19 PM
i think a 'kick yourself out of sleep' mode irq makes more sense than a 'call a function irq' - its not a high priority but we have some issues abotu sleep mode.

tannewt12:20 PM
@happyday.mjohnson we still don't support sleep modes

happyday.mjohnson12:20 PM
@deshipu doesn't that make it difficult to use with battery operated sensors?

limor12:20 PM
i think sleep mode is our oldest github issue - check it out and subscribe to it. we have to safely shut down USB and stuff.

limor12:21 PM
@chris, we expose a 'socket' interface to the ESP32 so any socket-mqtt library should work

happyday.mjohnson12:21 PM
@limor yah - but USB is out of the way when the sensor is not attached to PC/Mac. So the issue is not that (although it makes stuff a bit more clumsy).

Discussions