logo elektroda
logo elektroda
X
logo elektroda

ESP8266 vs ESP32: Programming Options and Capabilities Explained

marcingebus 9489 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17790887
    marcingebus
    Level 11  
    Posts: 406
    Help: 3
    Rate: 31
    Board Language: polish
    I've grasped Arduino a bit and understand that you write in C/C++, compile, upload and it works.

    I don't grasp all the programming possibilities of the ESP8266, but maybe someone can explain it to me maybe in more than one sentence. Maybe some more extensive description would be useful, as a pinned post. There are many posts/videos that say "To program the ESP e LUNA, then you need to...".

    I know that:
    1. we can communicate with the ESP over RX/TX by sending it AT commands (like modems used to do) - but I guess it works as such a modem over WiFi?

    2. we can with the help of ArduinoIDE write a program in C/C++, compile and upload. But here I've heard that a few lines of Blink type code, takes up half the memory of this ESP, which has many times more of it than the Arduino UNO/similar. That, or uploading some code, and there's some C interpreter running, so one big screw up, or other wonders.

    3. we can program something in LUA - but we compile to machine code or like point 2?

    4) You can in some MicroPython - I haven't read anything yet.

    5. EasyESP ?

    Maybe there are some articles with this kind of information collected. I have 3 copies of different ones. Something I would like to learn, but maybe not sequentially as it flies, but perhaps some paths are less attractive than others?
  • ADVERTISEMENT
  • Helpful post
    #2 17790972
    Slawek K.
    Level 35  
    Posts: 3015
    Help: 259
    Rate: 1297
    Board Language: polish
    Not LUNA but LUA. There are plenty of tutorials on the web on how to program esp (on this forum too), just take a minimum of trouble and type in a search engine.

    Greetings
  • #3 17790977
    piterek-23
    Level 33  
    Posts: 3321
    Help: 162
    Rate: 426
    Board Language: polish
    It all depends on what you would like to do with this ESP?
    The questions you ask would take a book to answer.
  • ADVERTISEMENT
  • Helpful post
    #4 17791027
    Karaczan
    Level 42  
    Posts: 6683
    Help: 865
    Rate: 1101
    Board Language: polish
    ESP is such a fast chip, usually with enough flash capacity, that there are several very powerful firmwares for it (let's say, like OSes).
    Depending on the application and what you find easier to program in, you can upload firmware that supports LUA scripts or scripts written in Python (you don't compile, the interpreter takes care of it).

    You can also treat ESP as a normal microcontroller, write in C, in Arduino IDE (ArduinoIDE is a Wiring language, but generally based on C ;) , or even in assembler if you like....

    And if you don't feel like thinking too much and creating unknown things, but just want to quickly run a few sensors, with viewing via the web and possibly integration with Domoticz or other OpenHUB, then you upload, for example, ESPEasy firmware. Then you have a working and configurable "something" and you do not need to program anything. What remains is scripting "from the side" of Domoticz/OH...
  • #5 17791238
    marcingebus
    Level 11  
    Posts: 406
    Help: 3
    Rate: 31
    Board Language: polish
    rs6000 wrote:
    Not LUNA but LUA.
    .
    Thank you I have corrected.

    rs6000 wrote:
    just take a minimum of trouble and type in the search engine.

    They are in style: voltages, set up with a 3.3/5 converter, new firmware downloaded from ..... don't forget after uploading to take +5 off the GPIO input.... and after an hour of reading the tutorial you find out: "Aha, I mean I can write in Python and it will be interpreted when I upload the new firmware". etc.... I couldn't find an article that had a word of introduction as to what we would be doing. Nor did I find an article comparing these Frameworks, as specified by a colleague in #4 post of this thread.

    Karaczan wrote:
    there are several very extensive firmwares for it (let's say like OS's).
    .
    This is more or less the answer I was looking for and the enumeration of these solutions (well, what to call them?). So, to sum up, I have probably listed the most popular ones, if there is something missing, please add it. I think many people will find such a list useful, because unlike Arduino, where we have basically one solution (writing in C/C++) and possibly several environments (Arduino IDE/ECLIPSE, BASCOM), with ESP8266/ESP32 there are many more possibilities.
  • Helpful post
    #6 17791363
    Slawek K.
    Level 35  
    Posts: 3015
    Help: 259
    Rate: 1297
    Board Language: polish
    Karaczan wrote:
    ESP is a fast enough chip, generally with enough flash capacity, that there are several very powerful firmwares (let's say like OS) for it.
    Depending on the application and what you find easier to program, you can upload firmware that supports LUA scripts or scripts written in Python (you don't compile, the interpreter takes care of it).

    You can also treat ESP as a normal microcontroller, write in C, in Arduino IDE (ArduinoIDE is a Wiring language, but generally based on C ;) , or even in assembler if you like....

    And if you don't feel like thinking too much and creating unknown things, but just want to quickly run a few sensors, with viewing via the web and possibly integration with Domoticz or other OpenHUB, then you upload, for example, ESPEasy firmware. Then you have a working and configurable "something" and you do not need to program anything. What remains is scripting "from the side" of Domoticz/OH...
    .
    You have messed up a bit mate, e.g. EspEasy is a program written in Arduino.

    In general you could say that there are two basic ways to write programs for the esp8266, the LUA scripting language and Arduino. In order to use the latter, you need to download the core for these chips into the Arduino IDE, i.e. add board definitions from the board manager. You then write using the syntax known from Arduino. The Esp8266 is also implemented in ready-to-use boards with additional usb<->uart converter and then programming is via usb cable, otherwise you need an external converter connected to rx and tx pins on esp8266 and shorting one gpio to gnd.

    Here is a good description http://www.jarzebski.pl/arduino/arduino-i-klony/nodemcu-v2-esp8266-lua.html

    Regards
  • #7 17791455
    JanuszKornas
    Level 11  
    Posts: 120
    Help: 6
    Rate: 25
    Board Language: polish
    rs6000 wrote:
    Generally speaking there are two basic ways to write programs under esp8266, the LUA scripting language and Arduino.
    .
    I have two questions:
    1. LUA scripting language. Does the uC have a translator, does this compile and as a result we have machine code dumped into the uC.
    2. Adruino - it compiles, but when I saw that some simple BLINK, which in Atmeda takes a few hundred bytes, here took a dozen kB, something is not right here. Is there really machine code being ripped out there? Maybe the majfriends have thrown some virtual machine in there which, in addition to doing what we want to throw in, is ready to spy on our WiFi? Because that markup in me lights up a red light.

    And how does the actual execution speed of similar programs on an Arduino/Atmega with an 8/16MHz clock compare to an ESP/LUN or ESP/Arduino with a clock many times faster. Is the execution speed of the programs comparably faster as the clock increments?
  • Helpful post
    #8 17791783
    Anonymous
    Level 1  
  • ADVERTISEMENT
  • #9 17792644
    JanuszKornas
    Level 11  
    Posts: 120
    Help: 6
    Rate: 25
    Board Language: polish
    khoam wrote:
    In addition to the C++ and Lua languages, you can also write programs for the ESP8266 and ESP32 in MicroPython.
    .
    And when writing in LUA and MicroPython do you use a compiler, or does ESP have to have a translator under them?
  • ADVERTISEMENT
  • Helpful post
    #10 17792654
    Anonymous
    Level 1  
  • Helpful post
    #11 17794131
    JanuszKornas
    Level 11  
    Posts: 120
    Help: 6
    Rate: 25
    Board Language: polish
    In summary, we have these options:
    1. compilers:
    - Arduino IDE/HAL - lots of "good day" libraries added - convenient
    - Espresiff SDK
    2. interpreters, which require the appropriate firmware to be preloaded under the interpreter in question:
    - MicroPython
    - LUA (NodeMCU)
    3. ready-made compiled programs by third parties (there are certainly more, but I give examples:
    - EasyESP
    - Firmware uploaded by default by the manufacturer with support for AT commands

    Points 2 and 3, are basically the same thing, i.e. we upload a "sort of operating system" and either have a working device or throw in scripts for it to execute (point 2).

    I have meanwhile come across the website:
    http://noweenergie.org/index.php?0/Article/42
  • Helpful post
    #12 17795900
    pawel1148
    Level 24  
    Posts: 594
    Help: 55
    Rate: 227
    Board Language: polish
    The Polish language support for ESP is there, but terribly broken up and it's hard to get anything out of it. Because here the author ended up with AT commands, there he made a program to flash a diode in python. There again some mega program connected to the cloud using some software.
    I, of course, do not expect anyone to give me a course or anything like that. I'm simply saying that in this case google is not always the best source of information, because you have to search and search quite long and in English to get to something more concrete.

    What I can advise is 2 sources that are concentrated in one place.
    Mr Neil Kolban's books from leanpub for example (one is about ESP8266 the other about ESP32)
    The courses on the Dfrobot blog there are really a bunch of them and you can find something for you.
    As for Lua, I think the main Lua page is the most comprehensive.
  • Helpful post
    #13 17797270
    Anonymous
    Level 1  
  • Helpful post
    #14 17797964
    JanuszKornas
    Level 11  
    Posts: 120
    Help: 6
    Rate: 25
    Board Language: polish
    khoam wrote:
    For ESP32 I recommend the site http://esp32.net/ Not a bad compendium of knowledge.
    .
    Very cool link - I recommend all thread watchers take a look there, really nice overview.

Topic summary

✨ The discussion centers on the programming options and capabilities of the ESP8266 and ESP32 microcontrollers. Users can program these devices using various methods, including the Arduino IDE with C/C++, LUA scripting, and MicroPython. The ESP8266 and ESP32 support multiple firmware options, such as ESPEasy, which allows for quick sensor integration without extensive programming. The size of compiled code can be larger than expected due to the 32-bit architecture of the ESP chips and the inclusion of libraries for WiFi and networking. The conversation also highlights the need for appropriate firmware to utilize interpreters like LUA and MicroPython, and the availability of resources for learning and development.
Generated by the language model.

FAQ

TL;DR: ESP32 is dual‑core 32‑bit and ATmega328P is 8‑bit, and "Arduino is not a programming language." This FAQ clarifies ESP8266/ESP32 paths (Arduino core, ESP‑IDF, Lua, MicroPython, AT, ESPEasy) and when to use them. [Elektroda, khoam, post #17791783]

Why it matters: It helps makers and embedded devs pick the right toolchain, reduce binary bloat, and avoid flashing pitfalls.

Quick Facts

  • ESP8266: 80/160 MHz 32‑bit Wi‑Fi SoC, 2.4 GHz 802.11 b/g/n, 3.3 V logic. [“ESP8266EX Datasheet”]
  • ESP32: Dual‑core up to 240 MHz, Wi‑Fi + BLE, 3.3 V, rich peripherals. [“ESP32 Series Datasheet”]
  • Programming options: C/C++ (Arduino core or Espressif SDK/IDF), Lua (NodeMCU), MicroPython, ESP‑AT, ESPEasy firmware. [Elektroda, JanuszKornas, post #17794131]
  • Flashing basics: USB‑UART or onboard converter; install Board Manager core; pull GPIO0 low to enter bootloader on many ESP8266s. [Elektroda, Slawek K., post #17791363]
  • AT mode: Commands prefixed with "AT+" over UART; typical baud 115200 bps for modem‑style Wi‑Fi control. [“ESP-AT User Guide”]

What are the main ways to program ESP8266 and ESP32?

You can compile C/C++ or run scripts under an interpreter. Compiled paths include the Arduino core or Espressif’s SDK/IDF. Interpreted paths require flashing NodeMCU (Lua) or MicroPython firmware, then uploading scripts. You can also flash ESP‑AT to drive networking via AT commands. For zero‑code sensor hubs and dashboards, use ESPEasy firmware. [Elektroda, JanuszKornas, post #17794131]

Is Arduino a language or a framework on ESP?

Arduino on ESP is a hardware‑abstraction layer (HAL) and core on top of C++. It is not a standalone language. As one expert put it, "Arduino is not a programming language." You can also skip the Arduino HAL and use the Espressif SDK directly. [Elektroda, khoam, post #17791783]

Why is my Blink sketch so large on ESP compared to AVR?

The Arduino HAL links substantial support code, including Wi‑Fi and networking pieces. This happens even when your sketch does very little. The 32‑bit architecture and richer SDKs also increase baseline footprint. If size matters, build with the Espressif SDK/IDF without Arduino HAL. That yields leaner binaries. [Elektroda, khoam, post #17791783]

Do Lua and MicroPython compile to machine code or run under an interpreter?

They run under interpreters that you flash as firmware first. After flashing NodeMCU or MicroPython, you upload scripts to execute on‑device. Scripts are processed by that interpreter at runtime. "Rather an interpreter that loads first into the ESP with the appropriate firmware version." [Elektroda, khoam, post #17792654]

Which should I choose: ESP8266 or ESP32 for my project?

Choose ESP32 when you need more performance, BLE, or dual‑core scheduling. ESP32 runs up to 240 MHz and offers more peripherals. Pick ESP8266 for cost‑sensitive Wi‑Fi sensors and simple IoT tasks. Both integrate 2.4 GHz Wi‑Fi and 3.3 V logic. [“esp32.net”]

How do I flash an ESP board using the Arduino IDE?

Install the ESP8266 or ESP32 core via Boards Manager. Select your board and port; connect via USB or a USB‑UART adapter. For bare ESP8266, pull GPIO0 to GND to enter bootloader, then upload. 1. Install core in Boards Manager. 2. Select board/port and connect USB/UART. 3. Hold GPIO0 low if needed, reset, then Upload. [Elektroda, Slawek K., post #17791363]

What is ESPEasy, and when should I use it?

ESPEasy is ready‑made firmware for ESP8266 that exposes a web UI and sensor plugins. You configure modules, sensors, and controllers from the browser. It integrates with Domoticz or OpenHAB without writing code. Use it for rapid home‑automation prototypes. [Elektroda, Karaczan, post #17791027]

Can I still use AT commands on ESP chips? How?

Yes. Flash the ESP‑AT firmware, then connect over UART and send commands prefixed with AT+. Typical UART is 115200 bps. You can scan Wi‑Fi, connect, and open sockets modem‑style. This is handy when another MCU hosts the application. [“ESP-AT User Guide”]

Do I need the Arduino IDE, or can I use ESP‑IDF/PlatformIO instead?

You do not need the Arduino IDE or HAL. You can program ESP8266/ESP32 in C/C++ using the Espressif SDK directly. This approach often produces smaller binaries. It also gives you lower‑level control of tasks and memory. PlatformIO can drive either stack. [Elektroda, khoam, post #17791783]

How fast is an ESP versus an 8‑bit Arduino UNO?

ESP8266 and ESP32 use 32‑bit Xtensa cores, while UNO’s ATmega328P is 8‑bit. ESP32 is dual‑core; ESP8266 is single‑core. For compute or networking, ESPs execute far more work per clock. The architectural jump matters more than raw MHz. [Elektroda, khoam, post #17791783]

Where can I find reliable, consolidated learning resources?

Check Neil Kolban’s books for ESP8266/ESP32, DFRobot’s course articles, and the main Lua/NodeMCU pages. These sources group tutorials, APIs, and examples in one place. They reduce the time spent piecing together fragmented guides. [Elektroda, pawel1148, post #17795900]

Why does my ESP randomly reset when I use long delays or block the loop?

The watchdog timer resets the chip if tasks starve the system too long. Long blocking delays or tight loops without yielding can trigger WDT resets. Break work into smaller chunks or yield periodically. Feed or configure the watchdog appropriately in time‑critical code. [“Watchdog Timer — ESP-IDF Programming Guide”]
Generated by the language model.
ADVERTISEMENT