by the__alchemist · 4y ago · 0 comments
Challenge: Come up with a set of project requirements for a practical electronics device, and evaluate if Python is the right tool for the job. I'm suspicious you'll run into headaches with interrupts, DMA, concurrent processes interfering with each other due to taking up too much CPU time, onboard peripherals beyond the most popular in the most popular configs won't work etc.
* Must be able to communicate with arbitrary 3D printers over USB, should be able to act as a USB host.
* Must be able to load user programs/extensions.
* Must be able to connect to wifi and host a rudimentary web interface.
* Must have a color display and user interface including graphs.
* Must have a BoM cost of less than 40 US dollars.
---
I'd argue micropython would be the best choice for that set of requirements, as opposed to something like a raspberry pi. Not sure you can get an RPI with a display in that price range, but you can definitely get microcontrollers that support USB host and have a screen in that price range, in bulk and able to be incorporated into an actual product.
For the user plugin loader, you might be better off using a lua interpreter? I think micropython would still be a good choice for it though. Any thoughts on how you'd want to put something like that together?
CircuitPython is special-built for this exact task -- to make microcontroller work more approachable and accessible for beginners and/or projects with a small scope.
Anecdote: I used it a few weeks ago for a project that was small and had a tight timeline. As a beginner to electrical engineering with microcontrollers it was nice to not have to struggle through language syntax as well. This solved my use case perfectly.
It's not really the Python that makes the difference, it's the fact that all the common peripherals and happy paths are pre-written for your board/mcu.
My impression about modern embedded devices is that it's much less about bit-banging together 14 barely-compatible components with high timing requirements than it is just getting a battery-powered, wifi-connected, USB-compatible handful of COTS sensors online and dumping to your dashboard. Circuit Python seems totally reasonable for that.
These software platforms are sort of like little operating systems - from a practical standpoint a lot of the value comes from the hardware support. How useful it is depends on whether there is support for the boards and devices you want to use.