Welcome to the CircuitPython Show. I'm your host, Paul Cutler. This episode, I welcome
Justin Myers to the show. Justin is a software engineer living in the Pacific Northwest with
a passion for open source development and recently contributed the new Connection Manager
library to CircuitPython. Justin, welcome to the show.
Thanks very much. I'm glad to be here.
How did you first get started with computers and electronics?
So as a child of the early 80s, my family, my mom was really into it. We got a computer,
connected to the Bulletin Board systems really early on.
And so it's just something that was always there.
And just gravitated towards it.
It's always been something that's interested me
and fascinated me.
I remember the first program I wrote was from a--
we had a Commodore 64 and literally coding out
of a magazine.
Had no idea what I was doing, just writing verbatim
what was there.
And then just kind of continued and was like, oh,
can I make it do this?
Can I make it do that?
And then I've been doing that for the last 35
plus years at this point.
So that's how I got my started to programming that assembly code right out of a
newspaper like magazine.
And then I spent so much time on BBSs as well.
How did you first get into electronics?
Electronics was interesting.
Like I'd always kind of dabbled at weird things, pulled stuff apart, what not, kind of
looked under the hood, but didn't really do a lot.
And then a number of years ago now, I don't even remember at this point, there was a
a company doing a Kickstarter.
And the company at the time was called Spark.
It's now turned into a Particle, who
I know has partnered with Adafruit on a few things
and whatnot.
But they had a Kickstarter out for these Wi-Fi dev boards
that you could code and do over there updates.
And I was like, that seems like a good thing to donate to.
And so I donated to them.
They're a Kickstarter or whatnot.
And I got them.
From there, I was like, oh, well, I've got these small chips.
I don't know what really to do with them.
And so I did some searching.
And that's when I found Adafruit for the first time.
like, Oh, I need more stuff. I need sensors, I need all of these other things. And then
I just really started, you know, diving in and I kind of add different things and played
with things and just kind of continue down that path for a while and built some, you
know, small fun things to use
and whatnot. And yeah, really just enjoy it. So how did
you discover CircuitPython? Was it part of that process or something that came later?
So I kind of watched it. So a lot of my development originally started in C, I'm now a Python
developer for the most part, but kind of with that, so Arduino and everything made sense to me,
it was really easy to kind of jump in. And then I saw when CircuitPython came out, and I kind of
looked at it, I'm like, well, that's pretty limiting. And I just kind of walked away from it.
I'm like, maybe someday. I think it's kind of when version eight came out, I had looked at some stuff
and I was like, oh, there's, they've added quite a bit to this, you know, they've added some of
their Wi Fi stuff to it and things like that. And I was like, no, this might be worth giving it a
try. And so really kind of started digging in around there and then really started kind of
playing with it more. At this point, I still kind of swap between the two, depending on kind of what
I'm working on.
Speaking of Wi-Fi, over the last year, you've been working with the underlying
networking code in CircuitPython. What is Connection Manager and how does it make networking
easier for users?
I'll kind of step
back one level, so to kind of where
it kind of came from.
So I joined Discord because I had a question about something
and was looking and saw all this stuff, these users that
was constantly just like, where they are here,
like socket stuff, everything.
And I just noticed there was a hole there
and noticed when looking that there
was a handful of other people that would help.
And at that point, I had an airlift board
and I had--
I don't remember what it was at the time--
an ESP S2 or S3 or whatever and noticed
as I was playing with them, it was like, oh, wow,
like these two things are totally different.
Like there's no similarities between how you set them up.
And so kind of through that, decided,
kind of reached out to a few people.
And I was like, hey, I think there's
a better way to do this.
And both, like whether using requests or like through Adafruit
I/O, everything was separate.
And so once you use more than one of the services,
things really started getting complicated.
How was your suggestion received on a better way to do it?
I thought it was received pretty well.
So basically, there was a session manager that was in requests that did a lot of this
already.
And so I had done a PR to basically kind of just separate that piece out in requests.
And then from a couple people, they kind of mentioned like, "Oh, maybe we could break
this out into its own thing."
They were really, really forward kind of breaking it up and making it simple.
In the end, Adafruit and specifically CircuitPython, right, they've got their goals, right?
And so they've only got so many people and so many dollars to move things forward.
So when people come up with a different idea to help and they don't have to do much other
than maybe review some code, it seems like they're pretty pretty good know about being
able to add it in.
So you mentioned that there's a few different ways to get networking to work in Circuit
Python with add-on boards like the airlift or was net or native networking.
How does Connection Manager work behind the scenes?
So in a super kind of like high level, right, so you like everything in the end is a radio,
right?
Like if you're using one of the newer boards, it's literally Wi-Fi dot radio
If you are using the SP you're going to define, you know
The SP SPI like you define that or same thing with the Wiznet and so the connection manager like in the end
You just pass it a radio right and then it then goes
Oh, what kind of radio is this and then from that it then does so before you'd have all these imports to be as you
Needed the radio and the pool and the SSL stuff and so it goes
Oh, it's this type of radio and so it'll then do the imports for you
And so you don't have to think about that anymore, right?
It's a single import for connection manager, and then it'll figure out what you need.
There's different versions, depending on what version of the circuit Python you're on for
like the WIS net that'll actually allow us to sell or won't.
And so it just handles all that for you.
So you just pass it a radio and then it can do everything.
And then there's even a software defined radio if you're doing native networking.
So if you're in C Python that you can actually use connection manager the exact same way.
So you can actually write all of your networking code
and test directly just in Python on your laptop.
Like you don't even need Blink or anything like that
if you're just doing regular internet connection stuff
and you can use that to pre-write all of your code,
which I now do all the time
because my regular net's way faster
than trying to do it on a microcontroller.
- Oh, that's neat.
I had no idea that you could do something similar
in CPython with Connection Manager.
- Yeah, it was like, and especially as I was testing stuff,
like that was kind of a big part of it
was, OK, pulling out an airlift and kind of trying
to work through this stuff and make sure it works,
especially when you're trying to work
through multiple connections and things like that.
They're small chips.
They're not super fast.
And so especially trying to iterate and things like that
makes it a lot harder.
So changing that and everything, and especially
when I do bigger projects and things where I'm doing things
like, say, OAuth through Google or something like that,
having a connection that is strong and stable
and I'm not going to run out of sockets or anything like that.
was really helpful.
- What kind of challenges did you encounter along the way?
- Kind of the biggest one.
So I, as I said, like I started a lot of my
serious development in C
and even did some things in some memory constrained areas.
And so was originally very familiar with that,
but then as the years went by
and I no longer had to compile my own special Linux kernel
for my web hosting and everything,
and like CPU and memory and all of that stuff
was just enormous and free, right?
Like you had as much as you wanted.
Like I think with a lot of people,
my programming style got, I wouldn't say lazy,
but not as far focused.
And so kind of one of the biggest things was as
working through this was, oh yeah,
I'm now on a constrained device again.
And not only that, right?
Like not only memory and CPU and speed,
but these can only do so many connections, right?
You can only have a few before they just run out of memory.
Whereas I can open a socket, hundreds of sockets all day long on my laptop.
So kind of re-going through that switch and trying to think through it for all the devices and everything like that.
It was a good challenge and a good remembering of like, oh, be a little bit more focused.
And I've even now re-implemented some of that stuff in my daily life to be, you know, think through a little bit more performance level,
you know, taking the extra time to think through that.
Very cool.
As part of creating Connection Manager, you developed a testing framework.
Tell me more about the framework.
Yeah, so kind of one of the big things was, so after the initial part of Connection Manager
was created, still realized there were a bunch of different ways to do things.
For example, there was one way to get the IP address from the native radio and a different
way to get it from the, say, the airlift.
And so I wanted to go through and make sure all of these things worked, especially as we moved
stuff around. And so kind of built this testing framework that I could plug in any chip and then
run this set of tests and it would go through and go. It would even detect the radio that it
had connected to it and then go, "Oh, great. You're on a WISNET." And then it would run through a
series of just standard tests to make sure nothing broke. It would go through all the different
things you know HTTP, HTTPS, it would connect to NTP for time, it even you know run a micro server
to basically go check and it was basically like did any of this break? Like the goal was always to
actually have something and hopefully someday I might try to push this down the line again but
like as they come out with new versions. So like another big part of it came out because we were
right between eight and nine for CircuitPython and they were you know making some changes or
we break that? Like, because we'd see, I'd see someone testing, they're like, oh, this
isn't working anymore. And so it was kind of like trying to build something to go, oh,
does all of this stuff work? It kind of, you know, built out of that. And like, ideally,
it would be something that somewhere, like whenever they do a release, these things would
get run, right? Because we see with every release, like sometimes we'll see, you know,
whatever it is, 0.7. And then like, the next day, 0.8 comes out because you have some regression
that some user finds. So if there was some way to build some testing framework around
it, I'm definitely not in their build system or anything like that. But it was something
that I could do to kind of test to make sure things weren't breaking or whatnot. Also help
find all the ways that the different radios were different. So we could slowly work towards
getting them so they're all the same.
Do I want to know how many different boards you ran through those tests?
I know we're not on talking
only, but I'm going to adjust my camera just so you can
see it, that whole stack there is almost as tall as me.
It's so it's all my electronics gear.
I probably have about 50 different boards at this point that are all different.
Ran it through all of them, which obviously is painstakingly when a new
release comes out and you've got to go download 50 firmwares and update
them and everything like that.
And then of course, then my router started having problems because I had too many
connections to it because everything was connected and everything.
Sure.
It's always something.
Yeah.
It's always something.
So last question I ask each guest, you're going to start a new circuit
Python or microcontroller project.
Which
board do you reach for?
So this is always a hard question.
Like I love asking this in a very different thing when I'm interviewing
somebody, like if you were to build a new thing, what software would you use?
And my goal is always to find out like, is this person a.
I'm a hammer and everything's a nail type of person or are they not?
So it really depends on what you were doing.
So good solid Wi-Fi and everything like that good powerful chip if that's what you're looking for
The sp32 s3 is one of the ones that I use often
If I am doing something specifically
That is more bluetooth focused
the nrf52 series, uh, so that
Adafruit has the bluefruit sense. I really like that board. That's really a fun one
It has a couple sensors on it and things like that
And if I'm not doing any sort of Wi-Fi and I just need something that's nice and strong,
like I really enjoy the M4. It's been around for a while. It's a pretty powerful chip. It's got
floating points. I do a lot of stuff with like math and things like that. And so having that
floating point processor, I actually built a library or ported over a library for determining
declination that Noah has built out. And so having that, the floating point makes it a lot more
more accurate and things like that.
I've started diving a little bit more into the Pico series,
but in the end, still not my favorites.
I recently did get a 2350 and I'm going to play with that one.
I think the hardest part of that is since I do do a lot of
CircuitPython and it can't take advantage of the dual processor,
the dual cores, it's like,
"No, I get a lot of something that I can't quite use."
>>
Right.
>> I keep hoping that there's a way to run a second,
Arduino something on the other core that just sits there and listens, and then you can have this
powerful, "Go do this math!" and then do my easy coding in CircuitPython. But someday.
Someday. Justin, thanks so much for making time and coming on the show.
You're quite welcome. I enjoyed it.
Thank you for listening to The CircuitPython Show. That's a wrap on Season 5. I hope you
enjoyed the new topic-based episodes in addition to the interviews. Show notes and transcripts are
There are links to follow the show on Mastodon and Blue Sky in the show notes.
When the show comes back, I'll share it on the socials.
Until next time, stay positive.