Notifications
Clear all

micropython success

13 Posts
3 Users
1 Likes
2,124 Views
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
Topic starter  

@goodolebob

I decided to give the flashing my ESP8266 board with micropython a go just now as my wife took over the TV to watch some soppy film not to my taste, so what better to do.   I'm happy to report it all went without a hitch.  I followed the instructions on the micropython web page for the esp8266, and I think you will find the instruction much the same for your ESP32.

So as simple as installing the esptool as directed, using it to erase the boards flash memory and re-flashing it as directed from the downloaded bin file.

As I was doing the install from a mac the only head scratching was to work out what the serial port was, but this was solved by initially connecting the board to the Arduino IDE as before and looking at the port in the IDE to get the name.   Ok a second minor head scratch to remember how to use the mac's terminal (screen) to connect to the serial port, and I was in the REPL doing a hello world.

No brick laying for me tomorrow. 😀 

This topic was modified 4 years ago 2 times by byron

   
Quote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
Topic starter  

@goodolebob

me again, but I just had another thought, I found this series on micropython, the first of which goes over the install which you might find useful.

 


   
ReplyQuote
(@goodolebob)
Member
Joined: 4 years ago
Posts: 7
 

@byron

Many thanks for the tip on installing MicroPython onto the ESP32.  I'll get into that right away.   : )

Yesterday I bought a new breadboard and power supply which snaps at the end of it to which supplies either 5v, 3.3v, or both to the rails.  Installed my ESP32-S board, plugged power supply into wall-word, and it all worked as expected.

Soooo, I removed the power supply and substituted my bench supply feeding only by 3.3v, then only by 5v; and neither would boot.  Back to snap-on supply and it worked.  Naturally I'll fallback to what works; but has anyone experienced and found a cure for this?  A YouTube video suggests there is a "danger zone" in voltage rise at startup which will throw the processor into a whirl.  He suggest that holding down the EN button during power-up works.  Mine doesn't in this configuration.  He also suggests a "voltage supervisor" KA75450 comparator which has been discontinued.

As noted, this is not a show-stopper for me, but I wonder if it's just the byproduct of my price-sensitive purchase of a development board from a distant land?

Again, many thanks.

 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
Topic starter  

@goodolebob

All my esp8266 and esp32 chips are on boards that can be powered through their usb port or a lipo battery connection and I've not tried to power them through their pins.  

The Adafruit esp8266 certainly does not like to be connected that way as the docs state:

  • Connect an external 3.3V power supply to the 3V and GND pins. Not recommended, this may cause unexpected behavior and the EN pin will no longer. Also this doesn't provide power on BAT or USB and some Feathers/Wings use those pins for high current usages. You may end up damaging your Feather.
  • Connect an external 5V power supply to the USB and GND pins. Not recommended, this may cause unexpected behavior when plugging in the USB port because you will be back-powering the USB port, which could confuse or damage your computer.

I'm not sure what the docs of my other boards state, but it seems to be something to be wary of and you would need to consult the doc's for your boards.

This post was modified 4 years ago by byron

   
ReplyQuote
(@goodolebob)
Member
Joined: 4 years ago
Posts: 7
 

@byron

Having tried both points mentioned that are "not recommended", I'm satisfied that powering through the USB-type connector is the only way to success for my board.

 

> "... it seems to be something to be wary of and you would need to consult the doc's for your boards."

      I doubt if Sherlock Holmes could find the manufacturer of my board.    : )

      I'm about to become a devotee of Adafruit.  Whenever I need a library, she seems to have written it.

 

Again ... many thanks for the info.


   
ReplyQuote
triform
(@triform)
Member
Joined: 5 years ago
Posts: 324
 

If you want an IDE to do the file management, REPL etc, there are a couple now that seem ok.  I have used ampy and even the old ESPtool, but have been using the Thonny IDE. It has it's worst, but works for the most part. If you get a Pyboard, it will mount as a USB fs and you can just copy to and from it.  I am coming from the Linux angle, so keep that in mind, but I think Thonny works on Windows as it's written in Python.

Scott

 


   
byron reacted
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
Topic starter  

@triform

I’ve not thought to try thonny, which comes with the Rpi, but I see I can download it to my mac. I’ll give it a try.

To put another couple into the mix I have mainly been using Visual Studio Code with micropython and there is also a pre release version of the mu editor that seems to work ok and seems to automatically finds micropython boards when they are attached. With mu you can click a file button to see both the files on the board and those on the compter. Its been in pre-release mode for quite a long time though.


   
ReplyQuote
triform
(@triform)
Member
Joined: 5 years ago
Posts: 324
 

@byron

I have tried the vscode extension, but it was kind of wonky for me at least.  I may need to try it again.  I have used the mu IDE a few years past.  Sounds like it's matured a bit more as it seemed like a kids toy then. 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
Topic starter  

@triform

Just to warn, the mu editor is still a bit on the simple side.   The vscode gives the normal intellisense for micropython which I find worked a treat. Its my preferred editor for python.  Its actually quite a while since I have used micropython as it was only when I got a TinyPico board that I started to use it and I've not done anything with it for a good while now.  With vscode I found using the REPL and copying files was done in a small bottom bit of the window which could be better.  As I'm now converting some esp8266 boards to micropython now is the time for me to revisit all the editor options to see which one I will run with. If you come across anything more of interest do let me know. 


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
Topic starter  

@triform

I've had a quick wiz around the editors for micropython (not exhustive) and also tried some other vscode extensions that were for micropython I had not used before.  But it was the latest Thonny that I found I preferred so many thanks for you tip on this.   I found I did have an old copy of Thonny on my mac and the latest Thonny has come on a long way. 👍  


   
ReplyQuote
triform
(@triform)
Member
Joined: 5 years ago
Posts: 324
 

@byron

Very glad it worked for you.  I am enjoying it so far.  An issue here and there, but I am sure it will get better over time.


   
ReplyQuote
(@goodolebob)
Member
Joined: 4 years ago
Posts: 7
 

@byron

I was finally successful at stumbling through flashing MicroPython onto the ESP32 board, then realized that there is a hurdle of learning MicroPython ahead before doing anything other than flashing the LED.  So I reverted to the Arduino IDE for the ESP32 and more familiar ground.

I have a 0.92" OLED with the SSD1306 chip which should be simple to use to print "Hello World".  I'm fairly sure that it's wired correctly after following a YouTube, but I'm stuck using the Adafruit SSD1306, GFX, and Wire libraries.  Just waiting on a neuron to fire. Suggestions welcomed.

"Some days it's hard to look good."


   
ReplyQuote
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
Topic starter  
Posted by: @goodolebob

then realized that there is a hurdle of learning MicroPython ahead

😀 I think its wise to consider taking a day or so to learn the basics of python, if you want to go that way.  All programming can be a frustration if one attempts to dive in too fast without at least getting the fundamental aspects of the chosen language under the belt first.   My python comes from learning to use the Raspberry PI a few years back.  Even more years back (talking about the 1970's) I used to program in C and I have, up till now, programmed my microcontroller boards in Arduino C.  But having learnt to program in python I find I like it much more and programs I write for the Rpi and my mac computer are all in python.  So its an easy step for me to use micropython on microcontrollers where its possible.  

I expect you may already have this link which shows and SSD1306 and oled hooked up and program examples in Arduino C, circuit python (adafruits'  fork of micropython) and python on an rpi.

https://learn.adafruit.com/monochrome-oled-breakouts/overview

I was a bit disappointed with the micropython I put on my ESP8266 board as it does not have a library for a software UART connection, the equivalent of the Arduino SoftwareSerial library (no a problem with the ESP32 though), so I may also be reverting this board back to Arduino programming.   But I do like the micropython on my TinyPico ESP32 board.

I'm sure you will get your oled flashing a message soon, it may even say 'learn python' 😎 

This post was modified 4 years ago by byron

   
ReplyQuote