To quote its web site ‘MicroPython is a lean and fast implementation of the Python 3 programming language that is optimised to run on a microcontroller’. It has a very open MIT license.
Damien George, who started the MicroPython project, recently had a KickStarter to port MicroPython to ESP8266
The kickstarter campaign was successful enough to fund ESP8266-code early release to the Micropython github repo.
The campaign is also funding some quite interesting libraries including a port of MQTT, a light-weight messaging system, popular for IoT.
One of the interesting aspects of MicroPython is the system has an interactive REPL (read-evaluate-print loop) which runs directly on the MCU. So you can interrogate the MCU using only a serial terminal, which may be handy for debugging and development.
So, folks might want to investigate MicroPython as a viable alternative to C/C++ development on STM32F.
<…>
So, folks might want to investigate MicroPython as a viable alternative to C/C++ development on STM32F.
Ok. I will try to move it. But I will need to fire up a grown up computer and administrating on a tablet is a nightmare ![]()
Edit.
As you can see.. I figured out how to move it.
<…>
However, I guess it depends on whether you are used to programming in Python.
I use it from time to time, but find it a strange language to get to grips with.
Its not just that the formatting of the page affects the syntax – as I actually prefer all of my code to be well formatted as it makes it much easier to read of everything is nicely indented etc.
But I’ve never found it that easy to switch between C, C++, Java,C# and various other languages, into Python.
For some code, I prototype it on the PC, in either C or perhaps JavaScript etc (depending on what I’m trying to achieve), as its quicker to get algorithms working on the PC (in C) and then copy the code over to the embedded platform, as on the PC you don’t have the upload / flashing step and you can debug into the code easily, which you can’t do so easily on an embedded platform without running GDB etc
About my Python experience, it is main scripting language since almost 15 years on almost any platforms.
What could be something I would want to see/dream on the STM32F4 is kind of merge between both worlds : Duino sketches that can run some python scripts …
On F4xx, there is no reason why it could not be achieved !
BTW, Wayne would then have another reason to build his STM32F4 piggyback for UNO, all those UNOs would becomes Python capable !
But “time is the missing ingredient” …
@gbulmer, you should team up with @fireduino (Wayne) !
So now I use the RPi Zero ($5, I have 2) or the RPi 2. Linux, full python 2 or 3 and all libraries. Same python code using I/O libraries of all sorts runs on RPi/Linux and on Windows. Or x86 Linux. A very few needs are such that the RPi won’t do.
It is (was) fun to do bare metal MCU programming in C/C++. But I have a new path now for most projects. And free PyQt works on Linux/Windows.
I’ve done two really big projects in Python – like 2-3K lines of code in many modules. At first I hated it.. too weird. But now I love it.
<…>
It is (was) fun to do bare metal MCU programming in C/C++. But I have a new path now for most projects. And free PyQt works on Linux/Windows.
<…>.
First the Xbee 802.15.4 with the Python library for it… though I’ve written the equivalent professionally in C, I wanted to try Python. 56Kbps link to Xbee which links to other XBees in a star toplogy. End nodes w/Xbee have no added microprocessor… I use over the air config of XBee S1 very versatile A/D, D/A,PWM, GPIOs, pin change, sampling then sending batches of samples at my sample rate and batch size, etc. The Xbee receiving is a thread with callbacks from the library. That library uses callbacks from the serial port driver in Linux. No polling loops anywhere.
Example: Sprinkler controller with failsafe and Python + PyQt GUI and Apache web server on the RPi. SSL option. Rapid app.
Next I tried a shaft encoder (grey code). $3. Connected it to GPIO pins of the RPi Zero. Ran the Python GPIO library. It has callbacks for pin change notifications (threaded). The encoder I’m using has 24 steps in one rotation. Very quick Python program to track and time tag each rotation, which direction, up/down count on angular position, etc. Printouts show it keeps up fine with steps I could create by twisting the knob on the encoder… like 50mSec per step as I spun the dial.
Example: I’ve got the encoder connected to the axle of the sectional garage door. Goal is to use an audio-fader type of potentiometer to choose door position. RPi has an opto-isolator to the garage door control button. We leave the garage door ajar a foot or two so when the garage is too warm. It’s an attached garage w/2 cars in it, and washer/dryer. I suppose the automation can close the door if we forget, late night when no one is likely to be in harm’s way. Kind of fun too, I hope, to make door position an “analog” thing instead of mashing on/off/on with the door opener’s button.
This is with both the XBee code and the encoder code as two independent Python apps. And all the Linux stuff. These RPi have WiFi dongles plugged into the USB port, and an SMB share from my shared folder on the LAN for GB of storage. SD card on RPi is not used by my programs. So I use VNC to run the python programs. And the Python IDE (freeware) runs on my desktop and puts the file on shared folder on the LAN for the RPis to get to via WiFi.
There is DMA for all this but I don’t need it.
At some input sampling rate or some such I’d need DMA or off-load to a traditional MCU. Unlikely I’ll need sub-mSec events in this project.
So this is an exercise with some utility.
Maturing and capable and ported to many platforms.
I am actually playing with this on the ESP8266 and the ESP32: here.
My second First Impression indicates that on uC with a little bit more SRAM, this is a very productive environment. The ecosystem now includes webservers, display drivers, and full control of I/O. Performance? For Byte-Code compiled, not bad.
Developing directly on the bare-metal hardware is interesting and a wild departure from the normal edit source –> compile –> link –> upload –> test cycle.
If you Python, things are getting very interesting.
Ray
https://store.micropython.org/store/#/store
sometime back i started a thread looking out for tiny stm32f4* boards, and it turns out micro python pyboard 1.1 is one of the very compact functional boards that has a stm32f4 and is one of the top tiny f4 boards
viewtopic.php?f=39&t=1977
However the boards in the micropython store are around 4 times more expensive than comparable generic boards
Perhaps if @racemaniac’s F405 BluePill board had micropython pre-installed it would be more economic to produce as people would pay $50 rather than $10
[RogerClark – Tue Nov 14, 2017 7:26 pm] –
Mircro python is certainly getting interesting.However the boards in the micropython store are around 4 times more expensive than comparable generic boards
Perhaps if @racemaniac’s F405 BluePill board had micropython pre-installed it would be more economic to produce as people would pay $50 rather than $10
… just a thought. For playing, it really does not matter what the underlying hardware is: PC, RPi, ESP32 …
Here in Atlanta, the RPi Zero W is $5 qty 1 every day and stock has been ample since September. For non-OS boards, the ESP32 is a low-priced unit and almost everyone has an ESP8266 module lying in a drawer
Ray
https://github.com/micropython/micropyt … C-GND-F407
[stevestrong – Wed Nov 15, 2017 2:37 pm] –
Isn’t the generic 407 mini board (only costs ~10USD) a real alternative to micropyton pyboard 1.1?
https://github.com/micropython/micropyt … C-GND-F407
IMHO, yes as long as you remember that s/h from AliExpress is going to bring the board to something over $14 U.S.D. Taobao price is $8 U.S.D. and I do not read Chinese and Google translate is not helping to determine s/h on quantity 1. But were I purchasing this board, I would consider purchasing 10x since the board appears to be rather nice in the under $10 category. Another option is a small group buy for members in a small geographic area.
Here is a bit of a write-up on microPython running on the STM32F407
On these bare metal boards, microPython is considered the OS (like the old DOS on 8088 days.) Booting your python script from SD is an option as well as OTA software program updates.
On the RPi Zero W, microPython is just another thread in the Linux OS and therefore the programmer must be a little (more) knowledgeable about dealing with tasking delays then when running on bare metal. This is how not to do it…
Ray
I don’t think I expressed my sentiments very well.
I was just commenting in the boards on that site, which seem rather overpriced IMHO.
I always find it surprising that people are willing to pay such a premium to have firmware pre-installed, but I’m not your average consumer by a huge margin ![]()
Anyway…
I have lots of boards which could potentially run MicroPython, including several F4 boards, and ESPxx and nRF52.
So I will definitely have to put installing MicroPython on my To Do list
But todays fun thing is to buy a kids kite, to see if I can make and airborne LoRa node ![]()
(Its often windy here)
srp
Even more fun is to make your own kites. When I was much younger I used to build big kites out of heavy duty polythene (thick bin bags or plastic animal feed bags). The lift these things generated was sometimes a little scary (especially since I lived under the flight path to the local airport). When it got a little bit breezy (which is most of the time round here), they could pull you off your feet if you weren’t careful. They would have easily lifted a fairly substantial camera rig.
Andy
I appended to my LoRa modules thread, about the kite
viewtopic.php?f=50&t=2832&p=37241#p37241
Looks like I will have to make one, because I wasted $8 AUD on some useless piece of diamond shaped fabric and 100ft of string from KMart, which will be lucky to lift its own weight ![]()
So I need to add kite building to my CV ![]()



