Close

Circuit Python Hack Chat Transcript Part 1

A event log for Circuit Python Hack Chat

We'll be chatting with Scott and Dan from Adafruit about coding in Circuit Python

shaynaShayna 02/02/2018 at 20:080 Comments

Stephen : Okay, it's GO TIME! A huge welcome to @tannewt and @Dan Halbert from Adafruit, here to talk to us about CircuitPython.

sommersoft : GO TIME!

Stephen : Would you two start us off by introducing yourselves?

Shayna : woohoo

Stephen : Who you are, what you do, and what you're excited to share with us today?

limor : Hii its me ladyada! i'm the lead engineer and owner of adafruit industries! i love to do electronics and write firmware

tannewt : I'm Scott, I'm the project lead for CircuitPython. I do core work in addition to organizing our awesome community.

Dan Halbert : I'm Dan. I've been on staff with Adafruit working on CircuitPython since August. We're having a wonderful time building CPy for you folks for your maker, educational, protototyping, and fun projects.

tannewt : I'm excited to talk about how awesome CircuitPython is for beginners

Kattni : Hello, I'm Kattni. I'm a Creative Engineer and one of the CircuitPython developers. I'm super excited to share how amazing CircuitPython is and how important the community is to it's development!

Jani Turunen : what is ETA for CircuitPython 3.0?

tannewt : @Jani Turunen hoping to do it by pycon in May. We have a long list of open issues for it still

Stephen : Fantastic. Welcome! Let's get started with the basics: What is CurcuitPython, and why was it created?

Stephen : An extra hello to @Kattni as well

x : w00t https://us.pycon.org/2018/

pt : (I'm phil, here for support, made hackaday 13 years ago, ladyada is my boss)

limor : ok! first Q!

limor : CircuitPython is a variant of MicroPython which is itself a variant of Python 3

tannewt : We'll be at pycon US!

x : how does CircuitPython compare to the micropython project itself, and what's the process for upstreaming contributions?

tannewt : @x Differences are documented here: https://github.com/adafruit/circuitpython#differences-from-micropython We don't actively upstream anything but all of our code is open source so upstream can merge it as they like.

Clifton : Is the video live? I don't see Lady Ada's messages here.

Professor Fartsparkle : https://www.youtube.com/watch?v=JH-b2Gk5gfU

limor : Python is the most popular programming language, and has some really cool things built in to it that makes it easy to teach electronics

limor : I have been using other microcontroller systems like PIC CCS, AVR and Arduino for a reallllly long time. but its challenging for beginners

pt : adafruit is a pycon 2018 sponsor https://us.pycon.org/2018/

limor : you have to set up an IDE, compiler, toolchain. What I <3 about Python is that all goes away, the code lives on the device. Its easy to edit and very fast to iterate

ɖҿϝիɟթվ : @pt awesome, are you going to have a booth this time?

limor : and best of all *no more* BUFSIZE

limor : we as humans are *bad* at BUFSIZE

limor : :)

limor : so thats what it is and why it was created

tannewt : @ɖҿϝիɟթվ No booth, they take too much time

x : also thanks to @tdicola and all for the OLED library (Adafruit_SSD1306/SSD1306.py) have had greeeaaaattttttt success using that with MicroPython and ESP32's

md : bottom line: differences between CktPy & MicroPy??

limor : the biggest changes we made to micropython is to attempt a unified API for hardware so new devices can implement the standard circuitpython API, makes it so we dont have to constantly update and rewrite drivers

limor ;)

tdicola : also added support for the SAMD21 which is a great chip for arduino-type projects

ɖҿϝիɟթվ : I think if you have a warehouse full of boards for sale, you want to make sure that you control the software for them.

tdicola : little bit more memory and capabilities but not much more cost :)

limor : Stephen, we're ready for the next question!

Stephen : Let's start getting into the community's burning questions. This one is from @bejecreimer : How close can you get to the hardware layer and still maintain python/cython syntax?

mspear.fungi : I understand that all aspects are being actively developed and appreciate the difficulties. Any issues with using CP for devices that have to run for weeks at time?

tannewt : @bejecreimer Pretty close! We can do anything thats not time critical in Python and use C for the stuff that is. There is a separate trade-off in the API that we have to make for it to apply to all of the hardware we support.

limor : e.g NeoPixels/WS2812B require special timing stuff, so we have a helper for that

Dan Halbert : We have implemented modules in C that interface to the microcontroller peripherals like USART, I2C, SPI, DAC, ADC, etc.

Stephen : That leads into @shamylmansoor 's question: How good is Circuit Python for real time applications compared to C / Assembly?

Dan Halbert : but they look just like regular Python. No extra syntax

Stephen : The answer sounds like not so good

tannewt : @Stephen Python itself is really bad but its ability to call out to C makes to possible. Python's advantage is the fast iteration time when developing code.

Ben Vinson : Wouldn't that be the same for all interpreter languages versus compiled languages?

limor : Yes, that's why interp languages are great - they're easier on humans to write, but more work for the CPU to do

baldengineer : I am pro-making CPUs do more work

ɖҿϝիɟթվ : though python is not interpreted

tdicola : remember it's a bit of a mind shift, you're writing code in a higher level for simplicity and ease of creation.. many things aren't time critical, like talking to a web service

tdicola : but when it does get time critical you can do that too in C

tdicola : and some stuff like parsing text is a lot easier in a higher level language :)

Stephen : Next question is from @James : What makes this a good starting point for getting involved with electronics, programming, and making things? why should someone choose this over other choices(arduino, makecode, javascript etc)?

Dan Halbert : MakeCode is the simplest, but larger programs get out of hand quickly. Python is really easy to learn. Also, criticially, we have a very fast turnaround because you can edit the code right on the USB drive that is presented by the board.

Dan Halbert : The higher abstractions of Python make it really easy to use more sophisticated data structures like lists, strigngs, and dictionaries.

limor : personally, i find writing code in circuitpython *enjoyable* - i was debugging a gyro driver and doing it C was really tedious - a lot of compiling and re-uploading. it took about 1/3 the time with circuitpy given the instant-run and easy debugging output

limor : like even someting as simple as print([hex(i) for i in databuffer])

limor : that is *annoying* to write in C

limor : or splitting strings, parsing, managing structures

limor : python dictionaries instaead of a new struct/class constnatly being tweaked

Stephen : What applications does CircuitPython excel at compared to a more common uC?

Kattni : I learned Python almost entirely using CircuitPython. Using a Python environment does give immediate responses, however, using CircuitPython with these boards returns amazing results - flashing lights, sounds, moving parts, etc. It was compelling. And as has been said, the results are immediate.

tdicola : it's nice in that you can learn python independently of hardware and electronics too, and that skill will transfer directly over to python on hardware.. so you can follow python programming books, tutorials, etc. to learn the language just on your computer.. then pick up a python board and you're already knowledgeable in the core language it uses

x : oh one of my new fav one liners, for clock with proper "0" padding... ("%02d:%02d:%02d" % rtc.datetime())

tdicola : makes it easier so you aren't having to learn all three at once, electronics, programming and hardware

tdicola : which is a lot to do :)

shamylmansoor : @tdicola Very good point!

shamylmansoor : Have been using arduino to teach kids electronics and programming

shamylmansoor : but I guess Python and Circuit Python seems like a good alternative

tannewt : @tinkeringtech dotstars are smaller

limor : even stuff like extracting raw data from a buffer, if some isn signed, char, uint16, its instant in circuitpython. https://github.com/adafruit/Adafruit_CircuitPython_BME680/blob/master/adafruit_bme680.py#L286 vs 

https://github.com/adafruit/Adafruit_BME280_Library/blob/master/Adafruit_BME280.cpp#L356

Dan Halbert : "What applications does CircuitPython excel at compared to a more common uC?": as we mentioned anything requiring more sophsiticated data structures or strings that you'd find tedious to do in C/C++.

Carol Willing : Hi. Hi. I love CircuitPython and Adafruit's open creative learning. Great community around CP

Kattni : I found that CircuitPython made it possible to learn all three at once. It made for an incredible experience. Especially with the Circuit Playground Express.

Stephen : Let's start getting a little more technical. To ease us in, the question @md has been asking:

bottom line: differences between CktPy & MicroPy?

limor : @stephen @md the biggest changes we made to micropython is to attempt a unified API for hardware so new devices can implement the standard circuitpython API, makes it so we dont have to constantly update and rewrite drivers

tannewt : we also auto-reload the python file after files are written to the mass storage device

Carol Willing : CircuitPython has a very Pythonic syntax emphasizing ease of use for learner.

Stephen : @Professor Fartsparkle 's question: Do you plan to do a larger Mega 2560'ish board for the SAMD51 in addition to your standard Feather and Metro footprints? Given the insane amounts of pins those ICs have.

Dan Halbert : our libraries try to be the same or strict subests of regular Python

limor says:3:29 PM
@stephen MAYBE!

Carol Willing : Python 3.6 f strings

Stephen : :O

limor : @stephen but we want to get SAMD51 solid first

limor : @stephen but we want to get SAMD51 solid first

happyday.mjohnson : thank you for the rfm69 lib...any thoughts on LoRa?

Carol Willing : Cool! Limor +1

limor : the SAMD51 does - so there's a plan :)

limor : but its ONLY a plan. i dont even have them schem captured. no ETA :)

Stephen : What about circuitpython boards with onboard wifi/ble - are there any available or plans to make them in the future? @stephensb wants to know!

tdicola : esp8266 does wifi and circuitpython right now :)

limor : @stephen yep! ESP8266 right now works - i used it for this project https://learn.adafruit.com/circuitpython-totp-otp-2fa-authy-authenticator-friend?view=all

ɖҿϝիɟթվ : and nrf52 is in beta

Todd : Thumbs up for esp8266!

limor : for BLE, we've got a beta 3.0 for nrf52

stephensb : excellent. thanks

limor : and we're working on the API for that - right now we have cilent/periph - central is still in progress

limor : nordic is also in the middle of a HAL update

tdicola : there's no driver for it yet but the nRF51 bluefruit friend can give you basic BLE peripheral support by talking to it over a serial or SPI protocol too

x : BLE/ESP32 CircuitPython?

Stephen : Next question by @Bryan : The Adafruit Feather M0 Wifi also runs the SAMD21 chip, so I'm wondering if there's any docs related to running/flashing the CircuitPython env onto a Feather?

Dan Halbert : @Bryan we don't have a driver but you can load CircuitPython on that board using the M0 basic version.

ɖҿϝիɟթվ : it won't give you wifi, though

x : @ɖҿϝիɟթվ which/what no wifi?

Carol Willing : It isn't really an either/or, both libraries are great. Both have made electronics education more accessible.

Dan Halbert : right, no wifi. You could talk to the wifi stuff but you'd run out of memory really fast.

limor : now's a good time to show off ALL OUR AWESOME DRIVERS! https://github.com/adafruit/Adafruit_CircuitPython_Bundle/tree/master/libraries/drivers

limor : more drivers here https://github.com/adafruit/Adafruit_CircuitPython_Bundle/tree/master/libraries/helpers

limor : *driver dance*

J : Amazing speed of driver development 'cause of the dedicated engineers and the community around CircuitPython.

mxwrench : Not sure if this was asked yet, but, Is Circuit Python available on ESP32 Feather??

ɖҿϝիɟթվ : @mxwrench it's not

ɖҿϝիɟթվ : @mxwrench even MIcroPython for the esp32 is still in beta

mxwrench : Damn, I just bought one, and I don't do Arduino IDE.

ɖҿϝիɟթվ : @mxwrench it will come sooner or later, I think, but not in the next 6 months

Stephen : @Ben Vinson asks: What is the performance boost over the SAMD51 (M4) vs the SAMD21 (M0)? Also, when the M4 is released, will it be the 1MB flavor and how much will be available for CP?

Dan Halbert : @Ben Vinson about a factor of 6. We're using the 512k one irght now due to availability, could upgrade later

Dan Halbert : M4 has hardware single-precision float, so it's much faster, maybe 10x at least.

limor : (and DSP too, M4 is pretty nice)

Dan Halbert : and much more RAM: 192k forthe 512MB version, vs 32kB for M0

Stephen : @tinkeringtech asks: have you seen problems with the UF2 bootloader approach as yet with certain PCs not enumerating the M0 properly? Is this the approach you will take for future boards?

Dan Halbert : We don't see enumeration problems. The Arduino IDE doesn't switch between the different COM ports nicely on Windows, but it's fine on other platforms. You have to switch manually.

John Postlewaite : Introduced cpx to middle school class today. Response was: How much does it cost? Where can I get one?

Kattni : @John Postlewaite That's great!

Dan Halbert : we really like the UF2 because it's very easy to update the firmware

Carol Willing : Dan +1

limor : it really solves the drag-n-drop bootloader problems ive seen with other bootloaders

Stephen : Really incredible info so far!

limor : it simply isn't tractable to allow raw binary or hex dragging

Scott Rider : sometimes it is easier to just use 'crow' ;)

limor : croooooooow

Stephen : Next question is from @x : does CircuitPython have any roadmap for WebREPL support?

Dan Halbert : @x it works on ESP8266

Stephen : Next from @Felix : Will numpy or scipy be ported someday for CircuitPython?

tannewt : @Stephen Not any time soon. They are very large libraries

limor : i gotta run in 5 minutes - but will hang out as long as i can

Stephen : Next is @David Glaude : Do you plan to have a "more" command on the CircuitPython REPL to be able to visualise code from the console?

sommersoft : lol

limor : heh

James : i would like to hear 'more' about this

Stephen : lol @James

Carol Willing : But the CP can move data off to be used by numpy and SciPy

pt : live video portion will end in 4 mins (3:45pm)

Kattni : https://adafru.it/discord

Stephen : @BrentR asks: Is support for asynchronous io in the pipeline for 3.0 or later?

Carol Willing : Dan rocks

Dan Halbert : @BrentR not for 3.0, but maybe later. It's in MicroPython but turned off in our builds.

BrentR : Thanks @Dan Halbert, that Q was for a professor who is using CirPy for his wedding's table-toppers!

Stephen : so cool!

Stephen : Another question from @x : have you thought about implementing a ++ & -- operation to CircuitPython I really miss being about to do something like "if i++ < 10:"

James : thanks!

Clayton G. Hobbs : oh I hope not

Dan Halbert : @x If it's not in regular Python, we won't add extra syntax.

Derek Parks : Jupiter would be really cool!

Clayton G. Hobbs : not unless you convince Guido

limor : lol ok see y'all later!

Kattni : @limor Thanks, have a good one!

Stephen : BYE @limor !

Sophi Kravitz : thanks @limor ! also, HI

ɖҿϝիɟթվ : @Derek Parks I think there is a jupiter core for the regular micropython and for the micro:bit

tdicola : i += 1 is the python way to increment by 1

mxwrench : Feather M0 and Circuit Playground, same Circuit python capabilities?

x :

BrentR :@x PERFECT form factor!

ɖҿϝիɟթվ : @mxwrench the "express" boards have much more stoarge space, so more libraries fit on them

x : ESP32 with custom compiled MicroPython firmware using Adafruits SSD1306 library, yay open source

Stephen : Another @David Glaude question gets more into the Adafruit side of things: Is ESP8266 a secondary citizen of CircuitPython because you adafruit has competition on that where there is almost no competition on the M0 side?

ɖҿϝիɟթվ : I'm their competition for M0!

Stephen : hah! Yes!

tannewt : @Stephen @David Glaude thats not the reason. Is largely because it doesn't have built-in usb capabilities

ɖҿϝիɟթվ : You can run CircuitPython on the Arduino Zero or on the cheap Chinese M0 boards — I've done that

tannewt : we do want to circle back to our wifi story for circuitpython but for now we're working on the M4 and nrf52 (with BLE)

stephensb : @ɖҿϝիɟթվ oh! µGame is yours! nice work

ɖҿϝիɟթվ : @stephensb thanks!

PART 2 OF TRANSCRIPT: https://hackaday.io/event/34310-circuit-python-hack-chat/log/86933-circuit-python-hack-chat-transcript-part-2

Discussions