working with Micropython - which ecosystem to choose - ESP 8266 or ESP 32?

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
apollodriver
Posts: 30
Joined: Tue Jan 29, 2019 8:54 am

working with Micropython - which ecosystem to choose - ESP 8266 or ESP 32?

Post by apollodriver » Sat Aug 10, 2019 7:56 am

dear community




I work with Kids. I'm always looking for economical platforms to build intriguing projects.

there are systematical decisions: in earlier times i use Arduino and Raspberry Pi for the projects because the eco-sytems of Arduino and Raspi support rich options to combine.

While Arduino clones are cheap, it uses the C/C++ language. that kids are not familiar with. and - yes it doesn't have a built-in WiFi-support. But that is pretty important for me.

WiFi-Support is a must for all the IoT projects i am interested in. On the other hand, while Raspberry Pi has WIFI and kids can program it using Python, it is still an pretty expensive platform to just control few GPIO ports to


1. turn devices on and off.
2. run a little RC-Car
3. have a look in the birds house that is in the garden


I need something in between that has both WIFI and Python capabilities. It appears that I found my answer in MicroPython flashed
onto a cheap ESP8266-based board - and yes - now we also can use ESP32 too.


What is Micropython?
According to its website, MicroPython is a lean and efficient implementation of the Python 3 programming languages.
And Python is one of the most widespread and well known language - also my kids have access to a lean python introduction.
In other words: Python is much easiser to learn than C /C++ - Python does not have all those pitfalls.

Micropython
that includes a small subset of the Python standard library and the good thing; Micropython is optimized to run on
microcontrollers and in constrained environment (such as ESP8266).
It's essentially Python IDE on a chip. One major benefit is that you can create code and change it on the fly using
a web-browser client called Webrepl. (Try to do that in Arduino.) You can also see sensor data in real-time on
Webrepl instead of rely on data logging or an LED screen in Arduino.


What is ESP8266?
In short, think of it as an Arduino with built-in network capability. You can use the Arduino IDE to program ESP8266 boards in C/C++ or
you can flash it with NodeMCU or MicroPython. In this project, I'll be flashing MicroPython onto an ESP8266 board.
I decided to get a WEMOS D1 which is based on ESP8266-12EX for this simple project where I'll be navigating a 2WD car using a web browser.
There are other boards that are designed for MicroPython but I wanted something cheap that I could throw away
if it didn't meet my criteria. As expected, it met all my requirements and most likely I'll be incorporating WeMos and Micropython into
future projects.

among them are ...
a. creating rc-cars
b. other IoT projects


which ESP would you decide ?

- NodeMcu Lua WIFI Internet Development Board based on ESP-12E CP2102
- Adafruit Assembled Feather HUZZAH w ESP8266 WiFi With Stacking Headers
- ESP8266 ESP-13 Web Sever WIFI Wireless Shield for Arduino UNO R3


which one would you take?

or would you choose the ESP 32 !?


love to hear from you

User avatar
pythoncoder
Posts: 3650
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: working with Micropython - which ecosystem to choose - ESP 8266 or ESP 32?

Post by pythoncoder » Sat Aug 10, 2019 8:54 am

In choosing between ESP8266 and ESP32 the main factor is code size. If you anticipate writing programs longer than, say, 200 lines of code (LOC) you may find that you need to cross-compile the code. Larger programs may require you to freeze the bytecode on ESP8266. This involves re-compiling the source and installing the resultant build. You can then run programs in the high hundreds of LOC. It's hard to be precise about these figures as they depend on what the code actually does.

ESP32 has much more headroom. If you use boards with SPIRAM you can run seriously large programs. There is also the Pyboard D series but that is probably outside your price range.
Peter Hinch

OutoftheBOTS_
Posts: 661
Joined: Mon Nov 20, 2017 10:18 am

Re: working with Micropython - which ecosystem to choose - ESP 8266 or ESP 32?

Post by OutoftheBOTS_ » Sat Aug 10, 2019 9:12 pm

I personally like the ESP32 because it is so much more capable than the ESP8266 which I used before switching to ESP32.

The ESP8266 is about the cheapest platform you will ever find and very good value for money. The ESP8266 also has a version of BASIC that will run on it and I used that for my kids when they were first learning before they switched to Python see https://www.esp8266basic.com/. The ESP8266 basic hosts a webserver that is the full IDE were you can write your program and execute/debug it all within the web server. So any kids can just load up the web page being hosted by the ESP8266 in any web browser then code away in basic

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

Re: working with Micropython - which ecosystem to choose - ESP 8266 or ESP 32?

Post by jimmo » Mon Aug 12, 2019 8:11 am

Another vote for ESP32, unless you really want the cheapest possible option, the extra capacity of the ESP32 gives you a lot more headroom (and avoids hard-to-debug and frustrating issues with running out of RAM / Flash).

But another option that might be worth considering: the micro:bit. It sounds like you're looking for wifi, but the radio on the micro:bit is also extremely useful and very easy to use. Things like remote controlled robots or remote sensors are very easy to do.

You can also connect your micro:bit to a PC (or raspberry pi) as a gateway from the micro:bit radio to other things.

Can't recommend the micro:bit enough - I've taught hundreds of kids over the last couple of years how to use them and it works really well.

The micro:bits are also much easier to deploy code onto (e.g. using https://codewith.mu/ ).

Post Reply