Micropython Education - Project proposals, ideas and help requested.

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Micropython Education - Project proposals, ideas and help requested.

Post by ta1db » Fri Oct 11, 2019 8:55 am

Hi,

In this academic season I am preparing and conducting a lecture series that will last at least 6 weeks on Embedded Python as to cover mostly Micropython at Istanbul Technical University for the Control and Automation Engineering Dept. students. The lectures will end with a project implementation phase.

Participants have background and experience on embedded programming with assembly, C C++, they are making successful robot, autonomous vehicle, guided drone and similar projects, attending competitions but all of them new to Micropython and embedded Python as well.

In our first lecture of yesterday I got many questions about the benefits of using Micropython as compared to embedded programming direct in C C++. I gave some answers such as easy learning curve, easy access to libraries etc. but in our next lecture I would like to start demonstrating advantages of Micropython with strong examples.

Would you please share your thoughts, project proposals and ideas what these strong examples to show advantages of Micropython would be keeping in mind the participants are control engineering students studying control theory, stability and performance analysis, digital control system design, digital signal processing a.s.o..

I may also need help in driver implementation if we need to use some new, special shields-skins for my boards Nucleo F401RE and STM32F7DISC.

Thanks in advance.

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: Micropython Education - Project proposals, ideas and help requested.

Post by torwag » Fri Oct 11, 2019 9:47 am

Hi,

I gave a similar lecture last semester and one of the main advantages in my opinion is the different workflow which includes a much easier debugging routine if things go wrong.

I told the students that they can use python, ipython or micropython on the PC to craft many parts of the internal structure of the embedded program. Esp. if it comes to math functions. E.g. they could write a PID-control function first in python itself and thoroughly test it. Often without any further modification (esp. if it is uses really standard python core features), this snippet or simple function can be copied over into the program for the microcontroller. This safes one from tons of compile, flash, recompile loops. Sure you can have more advanced set-ups with In-loop-debuggers etc (see point 3). However, my targeting audience was more the causal ardunio user rather than the embedded systems expert.

Secondly, if you use the serial terminal you get not only an error feedback, but you can directly continue to test why it failed.
E.g. If you receive an error message that a command is unknown. You can simply use the REPL and test why it is unknown, is it a spelling error, did the import not work as expected, etc. Same is true for wrong parameters or wrong logic.
When it comes to hardware, one can use the REPL to test it in real, before writing everything in a big file. E.g. you want to make an LED blink, you can easily write the 5 lines of python code in the REPL and see if it works as desired (is it the right LED?, does it blink with the right duration?, does it stop after X iterations?, etc.). More advanced example, is for example the few lines of code to read-out the data from a sensor connect via SPI. You can simply go line by line and see how SPI interface and the sensor response. Esp. for a beginner, that can safe a lot of time, to make sure that this is really working correctly. As soon as you know it is working, you can add those lines to the main code.

Finally, the ease of use without the need to install much more than a terminal emulator and a text editor. Other solutions require the installation and configuration of complex settings to set-up an entire IDE. If it comes to debugging and programming you might even need special hardware. For micropython every Linux/MacOS computer is ready to go directly and under Windows it takes you a minimum amount of time to get putty or something similar up and running.

These are my three favorite hands-on advantages compared to other languages.

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Micropython Education - Project proposals, ideas and help requested.

Post by ta1db » Fri Oct 11, 2019 10:11 am

torwag wrote:
Fri Oct 11, 2019 9:47 am
These are my three favorite hands-on advantages compared to other languages.
Very helpful, thank you.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: Micropython Education - Project proposals, ideas and help requested.

Post by Roberthh » Fri Oct 11, 2019 10:42 am

You may also contact Bernhard Boser who have lessons on MicroPython with sensors. I only have a link to one of his archives. https://github.com/bboser

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Micropython Education - Project proposals, ideas and help requested.

Post by ta1db » Fri Oct 11, 2019 10:46 am

Roberthh wrote:
Fri Oct 11, 2019 10:42 am
You may also contact Bernhard Boser who have lessons on MicroPython with sensors. I only have a link to one of his archives. https://github.com/bboser
I will, Thank you..

chrismas9
Posts: 152
Joined: Wed Jun 25, 2014 10:07 am

Re: Micropython Education - Project proposals, ideas and help requested.

Post by chrismas9 » Sat Oct 12, 2019 4:34 am

One of the big advantages of MicroPython is ease of debugging in the field, especially by field technicians who are not professional programmers. Often a full machine is not available during software development and debugging is done at least partly with LEDs, switches, meters, etc. Then the control system is installed and tested thousands of kilometres away during a limited time maintenance shutdown. It is much easier for a field technician to make simple changes in MicroPython than get a programmer to make changes via video calls and remote access to C compiler and JTAG probe.

I have found that many technicians prefer PLCs because they can understand how to program them but the programmers want to use C/C++. MicroPython is a good alternative to both. It allows professional programmers and engineers to write complex programs and algorithms and technicians can debug the machine interface part of the applications.

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Micropython Education - Project proposals, ideas and help requested.

Post by ta1db » Sun Oct 13, 2019 6:55 am

chrismas9 wrote:
Sat Oct 12, 2019 4:34 am
ease of debugging in the field
Interesting, thank you !

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Micropython Education - Project proposals, ideas and help requested.

Post by jimmo » Sun Oct 13, 2019 11:39 pm

Until recently, I worked in education (mostly high-school level, but we were attached to a university so I spent a lot of time discussing this with academics who were doing this at the university level too). My experience matches torwag's description exactly. We see a lot of initial scepticism (especially from students who may have already done other things, e.g. Arduino), but then they quickly realise just how much more productive they can be.

FWIW, the two big things that we learnt over several years that made our lives easier:
- Make sure the "getting started" experience is perfect. i.e. flashing your first "hello world" program needs to work without stuffing around with drivers and serial consoles and stuff.
- Make it easy to plug things in and get sensors and outputs working.

For us, one great way to acheive both of those goals was to start with micro:bits (running the MicroPython firmware). Then when the students grow out of them, there's a whole ecosystem of great options, but by the time they've grown out of them they're already very familiar with MicroPython and debugging. Flashing Python code onto a micro:bit is easier than any other MicroPython board out there, and when you combine it with an IDE like Mu (https://codewith.mu) you just can't go wrong.

And the micro:bits have this amazing packet radio (it's the 2.4GHz GFSK phy layer of BLE, but with no BLE stack) that is truly wonderful.

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Micropython Education - Project proposals, ideas and help requested.

Post by ta1db » Mon Oct 14, 2019 10:38 am

@jimmo thank you for the information provided, I'll ckeck the micro:bit

Following the link
Roberthh wrote:
Fri Oct 11, 2019 10:42 am
https://github.com/bboser
provided by @Roberthh I found an improved version of rshell, https://github.com/bboser/shell49 and also a kernel called MicroPython-USB for Jupyter Notebook at here https://github.com/goatchurchprime/jupy ... hon_kernel I tested successfully, which I beleive will be very interesting for our students ...

Mr Boser's MicroPython ESP32 fork https://github.com/bboser/MicroPython_ESP32_psRAM_LoBo looks also interesting, for example I saw a machine.ENC module for encoder reading, if I am not wrong this module doesn't exist in main repo however I couldn't find any other information on this module yet. There are also other extensions here: https://github.com/bboser/IoT49/blob/ma ... modules.md .

I am now looking for applications involving control theory, DSP (may be with SDR) a.s.o.

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Micropython Education - Project proposals, ideas and help requested.

Post by jimmo » Mon Oct 14, 2019 11:35 am

ta1db wrote:
Mon Oct 14, 2019 10:38 am
Mr Boser's MicroPython ESP32 fork https://github.com/bboser/MicroPython_ESP32_psRAM_LoBo looks also interesting, for example I saw a machine.ENC module for encoder reading, if I am not wrong this module doesn't exist in main repo however I couldn't find any other information on this module yet. There are also other extensions here: https://github.com/bboser/IoT49/blob/ma ... modules.md .
This is a fork of the Loboris fork. There's lots of info on this forum about it. In summary -- lots of great ESP32-specific features implemented (but, of course, ESP32-only). The other major thing is that it's designed as an ESP IDF component, rather than the "normal" way that a MicroPython port (like the upstream ESP32 port, or STM32) where MicroPython is the centre. Lots of advantages to doing it this way, if you're only working on ESP32.

Post Reply