logo elektroda
logo elektroda
X
logo elektroda

ESP8266 vs ESP32: Programming Options and Capabilities Explained

marcingebus 7743 13
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 17790887
    marcingebus
    Level 11  
    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?
    Do you have a problem with Arduino? Ask question. Visit our forum Arduino.
  • ADVERTISEMENT
  • Helpful post
    #2 17790972
    Slawek K.
    Level 35  
    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  
    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  
    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  
    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  
    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  
    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?
  • ADVERTISEMENT
  • Helpful post
    #8 17791783
    khoam
    Level 42  
    JanuszKornas wrote:
    Adruino - compiles, but when I saw that some simple BLINK, which in Atmeda takes a couple of hundred bytes, here took a dozen kB, something is not right here for me. 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.


    Spy theories aside, the reasons for the larger size of the resulting (binary) code are:
    - ESP8266 (single-core) and ESP32 (dual-core) have 32-bit processors, while ATmega328P (such in Uno) is an 8-bit processor
    - when linking a program that uses the Arduino HAL, a number of libraries are included to handle WiFi and networking code in general - even if you don't use it. The fault here lies with the Arduino HAL rather than the ESP itself.

    When programming in C++ on an ESP8266 or ESP32, you don't need to use the Arduino IDE. Nor do you need to use the Arduino HAL. Familiarity with the Espresiff SDK is sufficient - you can then get the resulting code in a smaller size.

    In addition to C++ and Lua, you can also write programs for the ESP8266 and ESP32 in MicroPython. Arduino is not a programming language.

    Added after 1 [minute]: .

    JanuszKornas wrote:
    Is the execution speed of the programs comparatively faster than the clock increment?

    32-bit processor versus 8-bit processor. Probably no explanation is needed.
  • #9 17792644
    JanuszKornas
    Level 11  
    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?
  • Helpful post
    #10 17792654
    khoam
    Level 42  
    JanuszKornas wrote:
    And writing in LUA and MicroPython uses a compiler, does ESP have to have a translator under them?
    .

    Rather an interpreter that loads first into the ESP with the appropriate firmware version.
  • ADVERTISEMENT
  • Helpful post
    #11 17794131
    JanuszKornas
    Level 11  
    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  
    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
    #14 17797964
    JanuszKornas
    Level 11  
    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.
Summary generated by the language model.
ADVERTISEMENT