19 ms·
CircuitPython: Programming Hardware in Python
- Ecco 6y agoTo be fair, this is really mostly just a rebranded MicroPython...
- animal_spirits 6y agoIt has 7,000 more commits than MicroPython, to say it is a rebrand is unfair.
- gedy 6y agoI read the readme differences, but any obvious benefits to one or the other?
- genmud 6y agoCore modules are a bit better laid out, meaning you will have a more unified experience across different dev boards. Additionally, there are more boards that appear to be supported, but don't quote me on it. Things like os/time/filesystem stuff act how you would expect running cython. IIRC the big selling point is anything that you can run on CircuitPython you can run in cython, whereas with MicroPython some of the OS and time functions act differently, so might not work without code changes.
- shakna 6y agoPoint of clarification: By Cython do you mean Cython or CPython?
- schappim 6y agoI was just having a chat w/ a contributor yesterday and he told me a large aim of Circuit Python over MicroPython is to make the code you are writing in Circuit Python more transportable. I.e. You write code in circuit python, and that same code will run on a little micro, and also a full blown Raspberry Pi. This is apparently done at the expense of some prettiness.
- stinos 6y agoYou probably looked at the 'xxx ahead, yyy commits behind miscropython' bit here and subtracted them to get that number? Even though I agree CP is definitely more than just a rebrand (in fact it's fairly interesting what they did), relating number of commits to the rebranding statement is not entirely correct. Because you're measuring features and/or amount of work done in number of commits, and that is not a simple fixed relationship. Just browse the first couple of commit pages [1] to see what I mean (just 2 examples: a commit with message 'pre-commit' which deletes 4 newlines, a commit with message 'alphabetical' which moves 2 statements around). Could also take a look at the MicroPython commits [2] in turn to see what a, in my opinion, very sane git tree looks like) [1] https://github.com/adafruit/circuitpython/commits/main https://github.com/adafruit/circuitpython/commits/main [2] https://github.com/micropython/micropython/commits/master https://github.com/micropython/micropython/commits/master
- genmud 6y agoWhile yes, its forked from MicroPython, saying it is just rebranded is almost like saying Ubuntu is just rebranded Debian. The biggest difference is how they handle core modules... rather than having a per-port/board they have a common set of core modules. There are also a lot more of those modules and it seems to have a fairly robust set of hardware/boards that are supported. I'll be the first to admit that I don't do a whole lot in either since the boards I work on are a bit resource constrained. The other thing to note is that Adafruit is putting a ton of resources into CircuitPython, I see updates/improvements all the time from them in their git repo. The velocity in CircuitPython vs MicroPython appears to be significantly higher (and that by no means is a dig at MicroPython, I love their project and they have so much cool stuff going on).
- martyvis 6y agoI have played a bit with MicroPython and I had heard of CircuitPython but wasn't across the differences and reasoning behind the fork. Limor actually did the Sunday morning Keynote at the the Linux.Conf.Au conference held over last weekend where she went into into a lot of things that were around repeatability and accessibility especially for novice programmers. The video will have been recorded but yet to be published and I would expect it to be linked from the abstract page [1] soon and/or on the LCA YouTube [2] channel. [1] https://linux.conf.au/schedule/presentation/122/ https://linux.conf.au/schedule/presentation/122/ [2] https://www.youtube.com/c/linuxconfau/featured https://www.youtube.com/c/linuxconfau/featured
- deleted 6y ago[deleted]
- martyvis 6y agoAs promised, here is the keynote speech at linux.conf.au last weekend by Limor Fried from Adafuit on the reason and drivers behind CircuitPython https://youtu.be/jZnDCs80b_A https://youtu.be/jZnDCs80b_A
- deleted 6y ago[deleted]
- wt8008 6y agoI like to think that MicroPython is more like a base project without a standard hardware library/abstraction layer. CircuitPython took MicroPython and built a hardware abstraction layer on top. It makes hardware level access more standardized and you can take your project to a different microcontroller board. CircuitPython only supports a limited number of boards. If scripting for microcontrollers become more mainstream, it can enable new applications and use cases that do not require a forced firmware re-flashing to change the code.
- systemvoltage 6y agoThen it should have been a library, not a fork.
- systemvoltage 6y agoSupport MicroPython. Adafruit has commercial interests - they're building CircuitPython so that people buy their stuff. They're a multi-million dollar corporation, not your mom and pop hobby shop. Instead of doubling down on MicroPython, Adafruit decided to fork it so they can have the right HALs. They should have made a library, contributed to MicroPython and grown the ecosystem. Unrelated, I absolutely despise Adafruit customer service - they're demeaning and belittling. I wanted to return items because they were not as described in the pictures - their response was we don't guarantee that. OK. So, you buy stuff off of AliExpress and put a 3x markup and you can't guarantee your supply chain? I now buy all my electronics from DigiKey and Sparkfun.
- IgorPartola 6y agoOut of curiosity which products did you buy and what was different about them? Also, multi million could mean $2m/year which if you pay your employees well would translate to like 25 employees if you make no profits and only pay salaries. Lastly, having bought loads of stuff from AliExpress and recently from AdaFruit, the latter absolutely has higher quality items. They are not simply reselling what’s available directly from China but are legitimately designing their own boards which are better thought out than the generic parts you can get for cheaper.
- sarusso 6y agoYep. AFAIK CircuitPython focuses more on low memory microcontrollers and less on connectivity.
- dkjaudyeqooe 6y agoSure and they provide support for it, also so they can configure and customise it whichever way they see fit. For most non-programmers (which is the target) support is much more important than issues with forks or OSS politics.
- voicedYoda 6y agoGood! I'm happy to see more progress here.
- jonwest 6y agoI know there’s some half decent support for ESP boards with MicroPython, is that also the case for Circuit? Getting Adafruit gear in Canada is prohibitively expensive in comparison unfortunately, as much as I’d like to support the creator.
- shakna 6y agoSeveral ESP boards are supported [0]. [0] https://circuitpython.readthedocs.io/en/latest/shared-bindings/support_matrix.html https://circuitpython.readthedocs.io/en/latest/shared-bindin...
- aweb 6y agoI looked at it in depth, they unfortunately don't seem to support anything else than ESP32-S2. To be honest, MicroPython is pretty good and you can use it without missing CircuitPython
- jscholes 6y agoI've used CircuitPython for one production hardware project which is in the wild. Safe to say that the increased draw on the included battery and higher memory usage weren't a concern here, but they are both significant. Developer productivity is through the roof though. I'd say the biggest pain points for me (unless I'm missing something/they've added more stuff recently) were created by the lack of support for what feel like production standards in software development. For example, the logging library is a toy, and unit testing is non-existent unless you isolate all your CircuitPython-specific code and run tests on your dev machine using CPython.
- gh02t 6y agoOut of curiosity, what about this particular project made you opt for CircuitPython? Was it something targeting hobbyists and wanting to allow them to tinker with it? I'm not trying to put it down because I like CircuitPython, but I would not even consider it for a general production device.
- jscholes 6y ago> Out of curiosity, what about this particular project made you opt for CircuitPython? It was a nonprofit-style project without much wiggle room. We wanted to prove that an idea would or would not work in a small amount of time, which happily overlapped with the fact that the target environment for the device wouldn't require long periods of battery life. I'm happy to say that the project was a success so who knows, maybe one day we'll have someone port it to C and continue from there. Sorry I can't be more specific.
- gh02t 6y agoNo worries, that was plenty of detail, thank you. I fully understand working on things you can't discuss the specifics of.
- craftinator 6y agoSurprised you didn't use at least MicroPython. I think Python on embedded in general is not great in a production setting, but at least MicroPython has widespread usage; CircuitPython is aimed at being a toy language for beginners.
- gchamonlive 6y agoA circuit python is basically an ouroboros. This should be its name.
- senux 6y agoI can't tell if you're serious or just joking but they do have a variant of their logo that's an oroboros [0] [0] https://www.dropbox.com/sh/l6tp9ym5nf8h5v9/AABC0Zd7_v4BWmBaZ1iAMAvHa/logos?dl=0&preview=logos.png&subfolder_nav_tracking=1 https://www.dropbox.com/sh/l6tp9ym5nf8h5v9/AABC0Zd7_v4BWmBaZ...
- dialamac 6y agoThat’s a very misleading headline. I got the impression this was something akin to VHDL or Verilog or SystemC in python. “Programming Hardware” the way it’s used here is pretty much the same as vanilla python, though I suppose a lot in this industry constantly need reminding of that.
- reedwolf 6y agoThere's MyHDL. Turns Python into a hardware description and verification language: https://github.com/myhdl/myhdl https://github.com/myhdl/myhdl
- xvilka 6y agoSee also the list from my low-level hardware description language unification idea[1]. There are mostly active projects. [1] https://github.com/SymbiFlow/ideas/issues/19 https://github.com/SymbiFlow/ideas/issues/19
- senux 6y agoI don't think there's any merit to your argument here. If the headline had said "designing hardware circuits", that would be another story entirely. > “Programming Hardware” the way it’s used here is pretty much the same as vanilla python One can only hope so, since the project is a fork of MicroPython. Neither CPython or MicroPython are meant to be a long departure from Python itself.
- mNovak 6y agoAt a minimum it's unnecessarily vague--hardware is far too broad when it's really just microprocessors. For that matter, in the way they use it, "programming hardware" applies to all code that runs on a computer. Anyway, my first impression was same as parent's, write Python get hardware.
- hulitu 6y ago> I don't think there's any merit to your argument here. If the headline had said "designing hardware circuits", that would be another story entirely. One does not "program hardware" except maybe in a CPLD. You cannot write code for a resistor or a tranzistor. You program maybe the microcontroller which is present on the board.
- cozzyd 6y agoThis certainly feels like magic... until you run out memory. It's probably more useful on microcontrollers with more than 32 kB of RAM.
- musingsole 6y agoI built a really fun library to represent I2C modules as a collection of classes to interface with them at various levels that equated to a whole lot of class instances (an instance per register, and an instance per interesting group of registers, and so on) Really fun in dev...really fun with my small test device. Then I loaded the config for a complicated I2C module and quickly blew out my memory. I was sad that I had to revert to more mundane means of I2C, but whatever. A newer version of that same board has more memory. Perhaps it could support my mammoth I2C model.
- hellweaver666 6y agoAdafruit also have a python library called Blinka that enables you to use Circuit Python on devices such as the Raspberry Pi
- cozzyd 6y agoright but you can just use... regular python... there, with the entire ecosystem.
- xrd 6y agoWhat adafruit board would be best for a beginner (at circuit python but long time developer otherwise) dad and his 8 year old kid?
- riq_ 6y agofrom a programming point of view, all are the same. But if you want to introduce your kid to play with sensors and other stuff, I'd get Playground Blefruit[1] [1]: https://www.adafruit.com/product/4333 https://www.adafruit.com/product/4333
- ducktective 6y agoSeconded. Pick something with wireless connectivity and lots of on-board sensors/LEDs.
- M5x7wI3CmbEem10 6y agoany add-ons that you’d recommend? or other stuff for kids playing with Python? maybe an arduino board plus a raspberry pi?
- ducktective 6y agoDepends on the level of abstraction you and your kid are willing to get into. Arduino's are lower-level C/C++ which may be a little more complex than CP, but have much broader library support (better intro to EE/embedded). RPis are much higher level which could be programmed in any language (better intro to CS/Linux).
- M5x7wI3CmbEem10 6y agofor kids, so ideally not as low as C++
- raykamp 6y agoAdafruit’s line of “featherboards” are pretty neat and user friendly. For circuit python, you plug the board in over usb. It’s detected as a mass storage device like a usb drive. You drag and drop a python file over to it that you want to run. https://www.adafruit.com/product/4516 https://www.adafruit.com/product/4516
- Uhrheber 6y agoCircuitPython is a toy language made for running on Adafruit's halloween/cosplaying gadgets. It doesn't even support interrupts. Better use Micropython.
- bmitc 6y agoWhat I don’t understand is: what features of Python encourage its use in embedded systems in the first place? Why not F# or Elixir?
- pjmlp 6y agoPython is everywhere in education, F# and Elixir are niche languages. If you want to use F#, you might get lucky with Meadow boards, yet their focus is mostly getting C# to run on their runtime.
- schwartzworld 6y agoLots of developers already know python, and if you don't it's easy to get rolling.
- dkjaudyeqooe 6y agoEase of use and familiarity to people who aren't principally interested in programming. These are people who want to make things work using microcontrollers.
- fmakunbound 6y agoFor pyboard, it's STM32F4 with about 200Kb of RAM. AFAIK, F# and Elixir target VMs (CLR and BEAM) and it seems unlikely that those VMs plus your code will fit on such a chip.
- ogou 6y agoAdafruit’s goal is the success of Adafruit. They built an increasingly closed ecosystem on the shoulders of a constellation of open source projects. Success is no sin, but I’m tired of their branded bloatware being touted as groundbreaking. Their development choices are commercially expedient and designed to capture market share instead of contributing to the greater success of the open source maker movement that enables their existence.
- ntoll 6y agoI'm an open source contributor. I've worked/collaborated with Adafruit. They support the ecosystem. Perhaps they don't blow their own trumpet in this respect (and should, so you could see how the do give back). My experience is a counter example of your comment, "...instead of contributing to the greater success of the open source maker movement that enables their existence".
- amelius 6y agoYou can say the same thing about Apple, which, by the way, is also a kind of fruit. It looks like the fruity companies are reaping all the fruits from open source software.
- sokoloff 6y agoThis is a much more negative take than I have on Adafruit. Adafruit is, to me, a great provider of breakout boards and gives generously to the community while trying to stay in business. They might be slightly more profitable if they closed off everything they could. I’ve used their libraries on a lot of projects without using their hardware. Their stuff works, is open, and when I used one of their LSM6DS dev boards on a 32-bit micro, it had an underflow bug; because that board and library was open-source, I could fix it the same afternoon I got the package. The fix was simple and obvious, they accepted my pull request, and now no one else has to waste that hour. That’s the power of open source to me. I hold Adafruit and Limor in a positive light and think their “bloatware” is very effective in making electronics accessible to many more people than before, much the same as the $30 Arduino did for the $2 AVR. The ecosystem and accessibility matter. I agree that they’re seeking success of Adafruit, and agree that’s not a bad thing, but I don’t see how they’re going closed. What is “closed” about their ecosystem? The article we’re discussing is about MIT-licensed software on their GitHub.
- seeyacall 6y agohello, i am glad to contact you I am from Seeya video chat app to make friends and share your life with peiple worldwide. we invite you to download it to try to meet new people and get relationship advice via video chat! Click this link : http://www.seeya.video/ http://www.seeya.video/
- Dowwie 6y agoI wish these technologies were around when I was a kid.
- dkjaudyeqooe 6y agoJust pretend you're still a kid.
- sunds 6y agoI recently built a project on an ESP32 using Micropython. My project had a web application using web sockets and there were good libraries in Micropython. My take on Micropython is that it is a small community with just a handful of long term dedicated contributors. It is a little rough around the edges, especially when you get into the details of board support other than the pyboard. For example I had issues with interrupts interacting with Python threads in the web sockets library. The documentation was flat out wrong and I had to figure things out on my own. I ordered a couple accessory boards off Amazon, a high precision ADC and a real time clock. Both were fakes. They had swapped out chips with lower grade components. When I ordered from Adafruit I got the real things. The big downside of the Circuit Python fork is that Adafruit deprecated their Micropython libraries for their boards. That seems like it will have long term impact to Micropython.
- selykg 6y ago> I ordered a couple accessory boards off Amazon, a high precision ADC and a real time clock. Both were fakes. They had swapped out chips with lower grade components. When I ordered from Adafruit I got the real things. sort of off topic, but, I never buy anything from Amazon anymore unless it's a last resort. The convenience is no longer there if I end up having to send stuff back due to it being fake or damaged in shipping (particularly books that are put in large boxes with no packing material, which is sucky given Amazon used to be the primary way I'd buy books). I'm excited to give MicroPython a try with the new Raspberry Pi 2040 microcontroller. I have a couple project ideas lined up and really looking forward to getting into this space a little as a hobby.
- decko 6y agoI have a few of their boards and my experience with them could have been a lot better. Their documentation is rather poor. Parameters to function/constructors are often left out, leaving you to go through the source to figure out how stuff works. The standard modules can have different functions/variables between different boards. It makes sense since some boards have capabilities others don't. However there is no documentation on this. Finally, in my opinion, some of the adafruit_* libraries are not well designed. There are many "kitchen sink" libraries that try to do everything. I also noticed that while they do appear to use pylint to enforce good standards, almost all source files have at least one check disabled...
- brennen 6y ago> I also noticed that while they do appear to use pylint to enforce good standards, almost all source files have at least one check disabled... I haven't touched any of the CircuitPython hardware libraries in... Well, something close to two years by now, I think. A lot has probably changed. Still, when I was last involved, placating pylint was consistently a hassle. As I recall it squawks about things like identifiers that don't conform to snake_case. All well and good as a general stylistic suggestion, but not especially helpful when that's what the thing is called. There may be some bad ideas lurking in places where those checks are disabled, but in general I blame no one for disabling one or more of its checks in service of greater readability or better code layout.
- mrwoggle 6y agoCircuitPython and MicroPython are great for hobbyists or if you need to prototype something quickly. It becomes very limiting for bigger embedded applications. Is the chip and are all peripherals supported? Probably not.