Elektroda.com
Elektroda.com
X
Elektroda.com

Arduino UNO + WiFi ESP8266 module, opinion, commissioning, test

TechEkspert 7395 44
This content has been translated » The original version can be found here
  • Arduino UNO + WiFi ESP8266 module, opinion, commissioning, test
    Arduino UNO + ESP8266 module on one board contains UNO based on ATmega328 and WiFi module based on ESP8266. The cost of the module on auction portals is ~ $ 7 Link . The module can be powered from a micro USB socket or DC 7-12V connector. Communication with the modules takes place via the USB UART converter based on the CH340 chip. Arduino UNO works with 5V, while ESP8266 is 3.3V. The ESP8266 pins are available on an additional connector, similarly the ISP connector allows you to program ATmega328 without bootloader:
    Arduino UNO + WiFi ESP8266 module, opinion, commissioning, test

    Looking at the PCB, you can see some assembly inaccuracies, e.g. the uFL connector of an external WiFi antenna. As standard, we can use a WiFi antenna in the form of a path on a printed circuit board.
    Arduino UNO + WiFi ESP8266 module, opinion, commissioning, test

    Description of the ESP8266 pins is on the other side of the board:
    Arduino UNO + WiFi ESP8266 module, opinion, commissioning, test

    When connecting the ESP8266 and UNO pins, remember about different voltage levels, similarly when connecting the peripherals.
    After setting the switches ESP8266 and ATmega328 can communicate using UART, similarly setting the jumpers allows you to connect the UART USB converter with the selected module for programming.
    Arduino UNO + WiFi ESP8266 module, opinion, commissioning, test

    Connection of modules via UART - DIP 1 and 2 ON
    USB UART connection with ATmega328 - DIP 3 and 4 ON
    USB UART connection with ESP8266 - DIP 5 and 6 ON
    USB UART connection with ESP8266 in programming mode (GPIO0-GND) - DIP 5 and 6 and 7 ON

    Do you think such a combination of ATmega328 with ESP8266 on one board makes sense?

    Arduino UNO can extend the capabilities of ESP8266, e.g. in terms of the number of I / O, ADC, PWM,
    offload / buffering for ESP during measurements or communication with peripherals, increasing the energy efficiency of ESP8266 similar to here: Link

    It is inconvenient to switch miniature switches to change modes. It should be remembered about the difference in voltage levels between the pins of the ESP module and the Arduino.

    Below is information on how to integrate both parts of the module with Arduino, and send data to Thingspeak:
    ESP8266 WIFI boot, start from IoT, Blynk, Thingspeak
    Arduino Uno first run. DHT22, BMP180, FFT LED RGB.

    A practical example of using the module ,
    data transmission from 6 ADC Arduno Uno channels to Thingspeak via WiFi ESP8266:

    Code for Arduino UNO ,
    for the duration of programming, switch to the "ON" position USB + MCU (switches 3 and 4),
    for the time of cooperation between Arduino UNO and ESP8266, select the MCU + ESP (1,2) option.

    Code: c
    Log in, to see the code


    Code for ESP8266 ,
    for the programming time, set the switches 5,6,7 in the "ON" position,
    for the duration of operation, set the switches 1,2 in the "ON" position,
    if we want to observe messages on the serial terminal, in the "ON" position, set the switches 5,6 or 1,2,5,6.
    In the code, as described, we put the SSID of our WiFi network and password,
    and also thingspeak api key and our channel number.

    [syntax=c]//programing USB+ESP GND-GPIO0 on (5,6,7)
    //runing MCU+ESP (1,2)
    //debug ESP+USB on (5,6) or (1,2+5,6)
    //serial 9600bps
    //send data from ADC to thingpseak

    #include
    #include

    #define UART_SPEED 9600
    #define ADC_CH 5

    //Credential and parameters for WiFi
    const char* ssid = "SSID WiFi";
    const char* password = "WiFipassword";
    //Parameters for thingspeak
    const char * apiKey = "apiKeyForYourthingspeak";
    unsigned long myChannelNumber = 123456;

    // api.thingspeak.com
    const char* server = "api.thingspeak.com";

    WiFiClient client;

    void setup() {
    byte n = 0;
    byte mac[6];

    Serial.begin(UART_SPEED);

    //Connecting to WiFi
    Serial.print("Connecting to WiFi SSID: ");
    Serial.print(ssid);
    Serial.println("");
    WiFi.begin(ssid, password);

    WiFi.macAddress(mac);
    for (n; n < 6; n++) {
    Serial.print(mac[n], HEX);
    if (n < 5)
    Serial.print(":");
    else
    Serial.println("");
    }
    n = 0;
    while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.print(".");
    if (n > 60) {
    ESP.restart();
    Serial.println("restart ");
    }
    n++;
    }
    Serial.println("");
    Serial.println("WiFi connection OK");
    ThingSpeak.begin(client);
    delay(10000);

    }



    void loop() {
    String in_buff;
    int adc_val;
    float voltage;
    #define ADC_MAX 1023
    #define V_REF 5.0
    for (byte n = 0; n

    Cool! Ranking DIY
    Can you write similar article? Send message to me and you will get SD card 64GB.
    About Author
    TechEkspert
    Editor
    Offline 
    TechEkspert wrote 3221 posts with rating 2476, helped 11 times. Been with us since 2014 year.
  • #2
    krisRaba
    Level 30  
    It is interesting that they put ESP on their PCB, and not, as is often the case, in the form of an additional module, e.g. here https://www.elektroda.pl/rtvforum/topic3512709.html (here just ESP32, but with ESP8266 too so they do).
    I wonder if the division is such that there are "Western kickstarters" with modules, where there is sometimes little more than the module itself on your PCB ;) and direct use in meega-cheap tiles from the far east? ;) And is the cost alone or the additional work prevailing?
  • #3
    tmf
    Moderator of Microcontroller designs
    IMHO such a combination does not make much sense. First, the different voltage domains. Super inconvenient 5V in this case, they could already power the AVR from 3.3V which would have saved the trouble. Besides, I don't see any point in packing the 8-bit AVR into a chip with a powerful (compared to AVR) ARM processor found in ESP. If pins are missing, you can use ESP32 or add some expanders. Here, the use of a simple AVR does not seem advisable to me, because it does not bring much hardware (the poor peripheries of the AVR used). Besides, the lack of a debugger doesn't make life easier either. If it is useful to someone, it is great, the price does not knock you down.
  • #4
    TechEkspert
    Editor
    There is also a combination of ESP8266 and Arduino MEGA (ATmega2560) Link ~ $ 10, do you see applications for such a module?
    I will also have the opportunity to test it.
  • #5
    khoam
    Level 39  
    tmf wrote:
    Besides, I don't see any point in packing the 8-bit AVR into a chip with a powerful (compared to AVR) ARM processor found in ESP.


    Tensilica Xtensa lx106 MCU is not an ARM, I agree with the rest.
  • #6
    Szyszkownik Kilkujadek
    Level 36  
    Stupid question: Isn't it better to use "LoLin ESP8266 CH340 NodeMcu V3 Lua module"?
  • #7
    tronics
    Level 38  
    Quote:
    Besides, I don't see any point in packing the 8-bit AVR into a chip with a powerful (compared to AVR) ARM processor found in ESP.

    As a colleague noted above, tensilica is not an arm, and such a combination is, for example, to use deep sleep well. ESP itself can wake up from deep sleep, but we are limited by the maximum deep sleep time of about 71 minutes. It is better to put the supervision of it on something smaller and more economical if the device is to wake up less often and under certain conditions. The ESP itself (8266) also has relatively low ADC capabilities (no mux, 1V range), so an additional analogue circuit also complements the ESP. However, it does not change the fact that it could be done cheaper and better ... or not have to do at all (with ESP32).
  • #8
    tmf
    Moderator of Microcontroller designs
    tronics wrote:
    As a colleague noted above, tensilica is not an arm, and such a combination is, for example, to use deep sleep well. ESP itself can wake up from deep sleep, but we are limited by the maximum deep sleep time of about 71 minutes. It is better to put the supervision of it on something smaller and more economical if the device is to wake up less often and under certain conditions.


    It's hard to agree with that. The wifi protocol itself and working in this mode is so power-consuming that the saved microamps do not matter much. It would be better to use the ESP32, which has radio connectivity that actually minimizes power consumption.
    tronics wrote:
    am ESP (8266) also has relatively low ADC capabilities (no mux, 1V range), so an additional analog circuit also complements the ESP.

    The currently used ATMega only slightly expands the possibilities of ESP in terms of available peripheral systems, which I clearly wrote about. If there was a processor with an extensive analogue, numerous timers or interfaces, it would make sense. On the other hand, loading a simple AVR, which has practically nothing, and poor serial ports are used for communication with ESP and USB (via an additional IMHO scalak) does not make sense.
  • #9
    khoam
    Level 39  
    TechEkspert wrote:
    There is also a combination of ESP8266 and Arduino MEGA (ATmega2560) Link ~ $ 10, do you see applications for such a module?
    I will also have the opportunity to test it.


    Or maybe Arduino Due ? "Successor" to Uno, but already under process by ARM. It also has support from the standard Arduino framework. It is available on but slowly priced at $ 15-16 with shipping.
  • #10
    pier
    Level 23  
    If esp8266 and low power consumption in deep sleep is shallow TrigBoard .
    I just don't know where to buy it.
  • #11
    tronics
    Level 38  
    SAMD21 could be a good option, interfaces more than mega328, there is DMA, there is 3.3V, there is an event system, some timers, quite good ADC and DAC, there is also USB. You can write firmware that will allow you to switch SAM to usb-serial and push the soft to ESP without changing the jumpers.
  • #12
    TechEkspert
    Editor
    @krisRaba Unfortunately, you can see savings in the quality of assembly, but the low price has to come from something.

    @khoam Due to this it could be a good duo with esp8266, but for the test I will take what was available in the "pool". What application do you propose for Due + ESP?

    These 5V and 3.3V differences between ESP and Arduino Uno can be an advantage at times,
    both modules are connected via RS-232, 3.3V peripherals can be connected to ESP and 5V to Arduino,
    but this is just an example that will not always (and perhaps rarely) find practical application due to many limitations.
  • #13
    khoam
    Level 39  
    TechEkspert wrote:
    Due to this it could be a good duo with esp8266, but for the test I will take what was available in the "pool". What application do you propose for Due + ESP?


    Well, generally wherever the combination of AVR + ESP8266 is insufficient due to memory or processor resources.
    In particular, in my case, I see Due as an internet Youtube radio receiver, with a nice OLED display (no video reception), with all the features that are available on "My Youtube", including audio buffering of tracks. Remote control, alarm clock, weather station, by the way ;)
    Of course, I could do all this on a hickey, but I work with Linux on a daily basis, so I have it on a PC anyway :)
  • #14
    tronics
    Level 38  
    @khoam - the thing is that you can do it cheaper on ESP32 (mouser - version with 2MB flash 2.7 euro) than ATSAM3X8E 7 euro + ESP885 1MB 1.5 euro. The only real problem is that the ESP32 arduino framework still supports it more testably than reliably. SAMD21 is much cheaper and is also supported by arduino. After all, it sits at zero. But it's also not that, I think the E series was so cooler. This does not change the fact that it is still much more expensive than the ESP32 ;)
  • #15
    khoam
    Level 39  
    tronics wrote:
    @khoam - the thing is that you can do it cheaper on ESP32 (mouser - version with 2MB flash 2.7 euro) than ATSAM3X8E 7 euro + ESP885 1MB 1.5 euro. The only real problem is that the ESP32 arduino framework still supports it more testably than reliably. SAMD21 is much cheaper and is also supported by arduino. After all, it sits at zero. But it's also not that, I think the E series was so cooler. This does not change the fact that it is still much more expensive than the ESP32 ;)


    But ESP32 is not ARM either. Moreover, the support of the GNU or Clang development environment for ARM is much better. Also, IMHO doesn't bode well for ESP32, I think it will be the same as AVR32. Sure, SAMD21 can be considered, but then there is less Flash Memory, less SRAM.
  • #16
    tronics
    Level 38  
    Quote:
    But ESP32 is not ARM either

    It doesn't matter if you are using a framework. If you don't use it, doing it on 2 different chips is even more painful.
    Quote:
    Also, IMHO does not bode well for ESP32

    Okay, if not ESP then what? Well, we have WiFi, a few realtecs, texas and media. Of which there are no rivals in terms of performance, because usually if there is a WiFi SoC, the ARM core (or not) is an addition. And it's one, and it's relatively slow. BLE is a different matter, because here are STM32WB, and PSoC4,5,6 BLE, and nRF52 and lots of others. But wifi? Come on show this competition for hobbyists :) There is no. You can add a WiFi module to a strong ARM, but as I clearly indicated, these solutions are definitely more expensive.
  • #17
    krisRaba
    Level 30  
    khoam wrote:
    online Youtube radio receiver

    hmm ... is there an option to download music from YT without a picture? Did you plan to download the whole thing and only play audio?
    I ask because I often play YT as background music and I feel sorry for a bit of that transfer, even if they can pack it quite well.
  • #18
    khoam
    Level 39  
    krisRaba wrote:
    Did you plan to download the whole thing and only play audio?


    Exactly.
  • #19
    TechEkspert
    Editor
    Is there an example project of this type "YT music"?
  • #20
    khoam
    Level 39  
    tronics wrote:
    It doesn't matter if you are using a framework.

    This framework just uses the GNU compiler and linker.

    tronics wrote:
    You can add a WiFi module to a strong ARM, but as I clearly indicated, these solutions are definitely more expensive.

    I would like to settle for adding a WiFi adapter to the USB port for PLN 13 with delivery.

    Added after 6 [minutes]:

    TechEkspert wrote:
    Is there an example project of this type "YT music"?


    Source code analysis can bring you a lot of inspiration youtube-dl . It is written in python, but very legible and with numerous comments.
  • #21
    Slawek K.
    Level 34  
    ESP8266 + VS1053 and internet radio are nice, no need to combine. Regular ESP clocked at 160MHz is enough, I made an internet radio clock radio on it, I recommend it. It supports most Polish radio stations such as RMF, ZET and others.

    Greetings
  • #22
    tronics
    Level 38  
    Quote:
    This framework just uses the GNU compiler and linker

    Which hardly matters to the person who writes in it. Most of the options are set to hard, and to get to the specified ones you have to work hard. It's supposed to work and it works. Maintenance free.
    Quote:
    I would like to settle for adding a WiFi adapter to the USB port for PLN 13 with delivery
    And the driver will write itself ;)
    Finally, PLN 13 is more or less an ESP32 with 2MB flash on-die. A friend predicts that ESP will meet the fate of AVR32, while the realities are different, because when the AVR32 family appeared, it already had 32-bit competition, solid competition. I asked to identify direct competition to ESP32 in the WiFi world. Please again, apparently a colleague missed it.
  • #23
    khoam
    Level 39  
    tronics wrote:
    I asked to identify direct competition to ESP32 in the WiFi world. Please again, apparently a colleague missed it.

    I did not miss anything. There is nothing to float. IMHO's biggest competition to ESP32 is the ESP8266 itself, but of course everyone can have their own opinion on this matter.

    tronics wrote:
    Which hardly matters to the person who writes in it. Most of the options are set to hard, and to get to the specified ones you have to work hard. It's supposed to work and it works. Maintenance free.

    I use PIO on a daily basis, not Arduino IDE, so I look at it a bit from a different perspective.

    rs6000 wrote:
    ESP8266 + VS1053 and internet radio are nice, no need to combine.

    What does this have to do with the programming interface for Youtube?
  • #24
    tronics
    Level 38  
    Quote:
    There is nothing to float.
    Where did the idea that I rose from? I politely pointed out that my colleague had ignored my question. There are no emotes to be annoying, and you cannot infer otherwise from the context.
    Quote:
    I use PIO on a daily basis, not Arduino ID

    I also use PlatformIO and bluepill for that ;) So that's a completely different perspective.
    Quote:
    IMHO's biggest competition to ESP32 is the ESP8266 itself

    On the one hand, yes, but mainly because the disadvantages of the 8266 are not manifested in typical hobby projects.
  • #25
    pier
    Level 23  
    rs6000 wrote:
    ESP8266 + VS1053 and internet radio are nice, no need to combine. Regular ESP clocked at 160MHz is enough, I made an internet radio clock radio on it, I recommend it. It supports most Polish radio stations such as RMF, ZET and others.

    Greetings


    It does not handle what's most important, i.e. OPEN FM. He's playing but bad.
  • #26
    Slawek K.
    Level 34  
    pier wrote:
    He's playing but bad.

    Yes ? I have not noticed. Can you expand?

    Greetings
  • #27
    khoam
    Level 39  
    tronics wrote:
    Finally, PLN 13 is more or less an ESP32 with 2MB flash on-die.


    Where can you buy it for this price? I was looking and I did not find, and I will gladly buy it at this price.
  • #28
    PiotrLenarczyk
    Level 9  
    It makes no sense - ESP8266 is two orders of magnitude stronger than AVR's. Somewhere on the git there is a whole set of ESP registers. Discussions about what is better: ESP12 / AVR ATXmega / STM8 / MSP430 / CortexM4F are divagations resulting only from the authors' experience, and not objective comparisons (such as: MIOPs * kiBps * kiB / PLN profitability; mAh consumption / year in sleep; init delay; GPIO max freq .; noise levels; et cetera).
  • #29
    tronics
    Level 38  
    Quote:
    ESP8266 is two orders of magnitude more powerful than AVR's

    And here, unfortunately, I have to answer very strictly. First of all, your colleague does not understand the expressions he is using. Secondly, my colleague does not know the actual performance of the Xtens core (there are comparisons to AVR and STM), and third, my colleague does not understand the limitations of this SoC / MCU. And compared to these "weak" atmegs are:
    1. SPI Master is busy for communication with flash, the second hardware SPI is a slave so if we connect a sensor, expander or anything on SPI, we use the software implementation
    2. I2C has no hardware at all, there is a software implementation. Atmega has hardware TWI
    3. There is only a timer, no hardware PWM. The implementation of PWM is software based on the counter interrupts. The base PWM frequency is 100-1000Hz with ~ 14bit resolution. In other words, PWM will load the CPU with interrupts ...
    4. WiFi transmission takes CPU cycles, the application can disrupt it, and there are no tools or options to warn you that we have already exceeded the limit. It will start screaming and that's what we will have. Additionally, internal sources we will not reset it (e.g. watchdog, BOR)
    Please do not create ESP for the seventh wonder of the world, because it certainly is not.
  • #30
    PiotrLenarczyk
    Level 9  
    ESP is a different type of device - for example, the best PWM can be obtained on a dedicated system or a trivial ASIC. When it comes to Microchip, ATmega3208 and ATXmega16D4 performed well. I would choose some ADUCM361 Analog Devices (hobby EKG, EEG, KTG, ultrasound, holter and others), but I don't know myself - everyone does how they can.
    Post Scriptum: ATmega328 used only as an RTC sleep for ESP is simply too expensive, although it may be an attractive offer for hobbyists. At the same price, in my opinion, there is a noticeably better, optimal stm32L011F4 in the TSSOP20 housing. The prices of combined integrated circuits are quite a relative matter - e.g. currently 8bit MCUs are more expensive than 32bit ARM Cortex, and from many manufacturers you can buy directly in retail (about a few thousand pieces), with non-combined price lists, programmed circuits, easy tax settlement et cetera.