Python, MicroPython...
 
Notifications
Clear all

Which (if any) of these Python-related topics do you find interesting? Poll is created on Feb 16, 2021

  
  
  
  
  

Python, MicroPython, CircuitPython

Page 1 / 3

DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 2 years ago
Posts: 1004
Topic starter  

Python has always been a popular programming language and, with the introduction of powerful microcontrollers, MicroPytghon and CircuitPython are becoming very popular as well.

While speed and timing-sensitive applications will still require the use of a compiled language like C++, MicroPython and CircuitPython have a lot of advantages in terms of code simplicity and rapid application development.

I have had a few ideas for content I want to create around these "Python-type" languages and would like to get your opinion regarding a few potential subjects.  You can check all that apply to you and leave me some additional comments.

Or perhaps you have another "Python-related" idea that I haven't thought of?

Note that I haven't considered a "How to Program in Python" topic, as I feel this subject has been covered extensively by many other fine resources.

Thanks for your input!

😎

Bill

"Never trust a computer you can’t throw out a window." — Steve Wozniak


Quote
SuperCharlie
(@supercharlie)
Trusted Member
Joined: 8 months ago
Posts: 90
 

I would be interested in compatibility between all the pythons.. what to watch out for when moving code around like from a pi to arduinos or from desktop full python.. 


ReplyQuote
byron
(@byron)
Honorable Member
Joined: 2 years ago
Posts: 548
 
Posted by: @dronebot-workshop

Or perhaps you have another "Python-related" idea that I haven't thought of?

Well probably this is rather what you have thought of, but here I go. 😎 

I have found that using C / C++ or MicroPython for the sort of things we usually do with microcontrollers such as read sensors and trigger actions based on communication inputs and outputs etc, is really quite similar in the programming effort required.

A compiled language will of course be quicker than MicroPython as a general rule, but microprocessors have clock cycles to spare and a few milliseconds extra is often of no concern. It is possible to speed up 'normal' MicroPython code for those area of bottlenecks if required to the point where I doubt if there is any relevant speed difference. For anyone interested in this topic the following video from the creator of MicroPython is interesting.

What I have found is that MicroPython needs more memory, but the newer microprocessors are now loaded with 4 or 8 mbyts of memory, and this extra memory is really cheap and does not add much cost to the processor board.

But once one moves up from just programming microcontrollers than one finds that one is going into the areas of database access, GUI programming and this sort of stuff. Now for this, on the understanding that one is not already an accomplished programmer in the likes of C++ , then using python is by far the easiest route, of course this is just my opinion.

And that leads me to suggest what you may like to consider for your potential subjects. Eventually one will want to get more sophisticated in ones programming requirements. Leaning C++ to the point where one is an accomplished programmer is one route, but most of us on this site are older hobby programmers and electronic dabblers who just want to make out creations work, and for this Python is by far the best tool. In the past to tinker with the microprocessors one had to get up to speed with C. ( I know that programming in Arduino is C++. but in effect the code presented in DronebotWorkshops is just plain C albeit calling C++ libraries)

Over the past few years we have a growing list of microcontrollers that can be programmed with MicroPython and CircuitPython. The argument for keeping the life of those starting out with programming and just needing a hobby level programming environment to just stick to getting a good knowledge of Python is now very persuasive. However I would also like DroneBotWorksop thoughts on whether making MicroPython / Python the main coding platform is now an alluring route to follow.

I do agree there is no point is reproducing yet another 'learn python' video, but it may be worth maintaining a list of your recommended recourses for those wishing to get up to speed in Python, all the better to follow your upcoming video's and articles.

You could follow on a series of using MicroPython on a Rpi Pico or ESP32 to read sensors, send the data via MQTT to a Rpi 4 and store the values into a database.  Then the database could be read to display the values in a GUI such as Tkinter or PyQT5 (which comes with the Rpi4). 


ReplyQuote
TheOutlander
(@theoutlander)
Trusted Member
Joined: 8 months ago
Posts: 69
 

I bought a book to learn Python, when I catch up I'll weigh in. Somewhere around 2022 🙂

"Hardware eventually fails. Software eventually works." - Michael Hartung


ReplyQuote
codecage
(@codecage)
Member Admin
Joined: 2 years ago
Posts: 1079
 

Paul McWhorter is going to release a series of weekly lessons on learning Python beginning in early March.  Right now I think he has about 25 weeks of lessons in the queue.  Not really sure on what day his series will start, but will report back when they do.

SteveG


AlanS, Sean451, Sumanta and 2 people liked
ReplyQuote
Sumanta
(@sumanta)
Estimable Member
Joined: 9 months ago
Posts: 199
 

I have no interest in Python,MicroPython and CircuitPython yet. Those are related to other microcontrollers and microcomputers, I guess. So, I would surely be interested in these topics in the future, when I work with anything other than the Arduino.

P.S. I am very much comfortable with C++. So I don't want to switch my programming language now. I may do so later.


ReplyQuote
noweare
(@noweare)
Estimable Member
Joined: 1 year ago
Posts: 108
 

I have gone through a couple of books on python and it is very high level and you can get a lot accomplished in not much time. Coming from a C background  you realize there is a lot of code is in the background doing the things you normally would have to code in C. Learning another programming language is a huge undertaking and time consuming. I would be more inclined to learn python for non-embedded programming tasks like on a desktop or laptop or a pi.


ReplyQuote
jfabernathy
(@jfabernathy)
Estimable Member
Joined: 9 months ago
Posts: 144
 

Couple of comments:

1.  Ladyada, the CEO of Adafruit, recently did a Web keynote explaining why she forked Micropython to form Circuitpython. To me, it was all about supporting drivers for Adafruit's hundreds of peripheral boards.Keynote

2. Some of the really good python programmers get carried away.  They build Classes on top of Classes and you end up with very simple short programs that do everything for you, but you can't really understand them because you need to know the lower level classes that they are built on.  So you better have a lot of programs with common needs to invest in the learning lower classes.

If your code won't compile, have another glass of bourbon. Eventual the problem will be solved.


AlanS, DroneBot Workshop, SuperCharlie and 1 people liked
ReplyQuote
Sid
 Sid
(@sid)
Estimable Member
Joined: 11 months ago
Posts: 127
 

@dronebot-workshop

Many a times (ever since I found you), you have been a kind of mind reader at least for me. Here is why -

When I was thinking about how they could display all the electronic findings on the LCDs, you came up with a video on that.

And now, when I have been reading about Circuit Python - just because it can be used to do stuff with my NeoPixel Cubes with sound, you propose and ask for a vote.

Specifically, I found that there is something that needs to be done if I want to run my Arduino Nano/UNO with CircuitPython - just because of the differences in how these languages are interpreted and compiled, however as of now, I am not there yet. I am at a very beginner's stage of understanding Circuit Python.

Definitely I am up for related tutorials - as I understand your videos better than from many others.

So here is my flow -

1. C++ Programmers Guide to Learning MicroPython (I can omit this out as I know I can manage with both and keep them separate - not to get me confused at least in their syntax, terminology and how they work - a plus that I managed to learn when I started my career as a trainer).

2. Loading and Using MicroPython on popular microcontrollers - All I read in the past few days, suggests it will be tricky, a long routed thing to get it working on Arduino, hence I have to learn this - longer, tougher or easier you might know better, I trust you as my Guru.

3. MicroPython vs CircuitPython - not sure about MicroPython (did not know there was a term like this until I read it here on the forum), but yes, CircuitPython seems interesting to me.

 

Life is exploring and learning


ReplyQuote
jreebel
(@jreebel)
New Member
Joined: 8 months ago
Posts: 2
 

Back in the 90s I actually coded in C professionally for a few years.  I retired over 5 years ago after an IT career spanning a lot of languages and several operating systems. Mostly doing database programming but more general stuff as well.

I recently started learning Python since I acquired a Raspberry Pi last year.  It's kind of fun, but there are some things about it that bug me.  The idea of being dependent upon indentation just seems like asking for trouble.  Some of the fancier techniques seem rather unintuitive. I miss having the ability to create structures.  Admittedly it can be done with combinations of lists, dictionaries, etc. in Python, but that method is far from producing self-documenting code.  I'm tempted to go back to C, which has become C++ but seems to be dominated by Microsoft development tools rather than the old bare-bones C compilers of my youth.

Anyway, pardon the ramble.  I'm all for learning about these more limited versions of Python.  As you stated, there is a plethora of books, tutorials, videos etc. for learning Python, so no need to go there.


ReplyQuote
Aubey
(@aubey)
Active Member
Joined: 8 months ago
Posts: 6
 

I bought an Adafruit Trinket M0 a little while back as part of a larger order of sensors and Arduino type boards. I haven't had much chance to fiddle with it, but I did try it out last week and was impressed at how easy it as to use. I have a little experience with Python from my recently ended, due to retirement, career as a DBA and System Architect. It is an easy language to use and there is a lot of documentation, training and sample code available. My son, who is a working developer, uses it quite a lot.

Having said that, there is the the overhead of the interpreter and the fact that I already know C/C++. Also, I was originally drawn to micro-controllers, versus small form-factor computers, because I was interested in programming C/C++ at the hardware level and learning about electronics along the way. I enjoy learning about and playing with transistors and IC chips, understanding of which I actually find harder than programming them, mostly because I have a career of programming behind me. When I am programming my Arduino projects that use libraries, I always have the libraries open in Sublime so that i can better understand what the library function is doing. So, the ease of Python, which comes at the expense of overhead and clarity, is not as attractive to me as someone who might understand the electronics well, but might want to extend functionality with an MCU without learning C/C++. 

What does make Python attractive to me, is that it may make additional MCU boards, sensors and accessories available for use in my projects. For that reason I voted yes to more Python/MicroPython/CircuitPython related content.

Finally, sad to say that I was completely unaware of the Raspberry Pi Pico release because I have spent the past few weeks down an internet well reading about basic electronics and watching Youtube videos by the always interesting and excellent teacher Bob DuHamel. Between Bill, Bob and the stack of books I checked out of the library, I might actually learn something about electronics.


ReplyQuote
aimcentermass
(@aimcentermass)
New Member
Joined: 8 months ago
Posts: 2
 

Today you released an email regarding Picos, MicroPython, and CircuitPython.  I love those topics, but would add that I hope you continue to provide videos on different platforms, especially Linux.


ReplyQuote
JHSWANN
(@jhswann)
New Member
Joined: 8 months ago
Posts: 4
 

Hi Bill.

 

My primary interest in Arduino and similar microprocessors is that I want to interface their capabilities to my JMRI controlled model railroad system and the Digitrax infrastructure of equipment that I already have in place. There are some videos on UTUBE that will seemingly be helpful from and Arduino perspective but programs for JMRI scripts use the Python ( or JYTHON) language and this may be the link that allows me to easily bridge between the JMRI infrastructure and a PICO board that has interesting capabilities.

 

I'll follow the progress closely and re-brush up on my Python in anticipation!

Thanks,

 

 

Jim


ReplyQuote
noweare
(@noweare)
Estimable Member
Joined: 1 year ago
Posts: 108
 

@aubey I first learned about microcontrollers when I was going through engineering school in the 80's and I took an assembly language programming class using the color computer II which used a 6809 motorolla microcontroller. That class really taught me how computers work. Pushing bits around at that level places you in the hardware. From that time on I never really wanted to get too far away from the hardware so I use C as my programming language. C doesn't give me the feel I got when using assembler but it still is very close to the hardware. Python abstracts a lot. It really is a high level language. The more abstraction the further you get away from the details of how things work.

I look at it like if I already know C well I don't need to use python to program microcontrollers. I think if I was doing operator interfaces or graphics or just about any other type of programming python would be my goto not only because it is higher level but it is packaged well. You get a lot of libraries (or modules) built in to the language unlike C.

 


ReplyQuote
Aubey
(@aubey)
Active Member
Joined: 8 months ago
Posts: 6
 

@noweare One of the reasons I chose to make an IT career largely around databases was a class project that involved creating a database program from scratch using C. I loved it and the C language the, and assembler language, but there were more opportunities as a database developer. As I said in retirement I am looking to work with code at the hardware level, and learning the electronics part is not only necessary but a heck a lot of fun. The Python does look interesting and I will learn to use it with my projects that require it, but not without having to jettison some old hockey stats, golf scores and all the Microsoft Sharepoint Framework (it was always there under duress) stuff I have stored in the old noggin.


ReplyQuote
Page 1 / 3