ARDUINO WIFI CONNECTION

Hey guys i am making a project for college,i need to send sendor data from arduino to a database..since arduino wifi is to much money for me..i have seen some other solusions like esp8266 but the curcuit its too complicated for me since i am new to all this..i would like to ask you can node mcu provide wifi capabilities to arduino or even an esp32 and in what way could i achieve this ? Also i have another question if for example i have a curcuit with arduino connected to esp32..How the ide will know where to upload the code to arduino or to esp32 microcontroller ? Thanks in advance guys !

That is one thoroughly confused posting!

"Arduino WiFi" is indeed poor value for money. What you want is an ESP8266 and the NodeMCU is one option while the most economical - and fully functional - is the WeMOS D1 Mini.

You do not add an ESP8266 to an Arduino, you use the ESP8266 to perform the task. The NodeMCU and WeMOS D1 Mini simply plug into your USB port with the respective cable and the IDE programs them - you need to install the ESP8266 libraries using the Library Manager.

You connect your sensors and output devices just the same as an Arduino except that the ESP8266 operates with 3.3 V logic - there are some adaptations required but these are easily discussed here.

I am using these ESP-01 modules on a couple of different projects.

One project has a Teensy LC controller, which sends data to the ESP-01 over Serial, and the ESP-01 itself hosts a webpage for access to view the data. In this case, I have two sketches. One for the Teensy and one for the ESP-01.

Another one of my projects has an Arduino Mega2560 controller, and the ESP-01 is just used to allow the Arduino to access my network. In this project, the web code is on the Arduino itself, not the ESP-01. The ESP-01 in this case, doesn't have any sketch loaded.

Basically, the ESP-01 (which is an ESP8266 with limited pinouts) is a microcontroller itself, so it can run code just like an Arduino can ... but, there are also firmware versions and libraries available for it to just provide wireless network access to another controller (using a serial connection between the two). The board I linked to above comes with AT firmware already loaded, so nothing is needed to make it work with the library I'm using ...

That said .... I'm using the WiFiEsp.h library, since it doesn't require any custom firmware, and has syntax similar to the Ethernet.h library.

WiFiEsp Library on Github

Here is a good overview of the ESP8266: ESP8266 Beginner's Guide

When you have your computer connected to a controller, in the IDE software, you select which board you are connected to. This is how IDE knows which board to look for when uploading a sketch.

In my projects, I use both a small USB programmer when the ESP-01 is easily removed from the project ... but I also sometimes use the "Echo Booth" sketch on the Arduino (or Teensy) when the ESP-01 is not easily removable.

The Echo Booth sketch basically turns the Arduino into a pass-through serial connection to the ESP-01. So when the Echo Booth sketch is running, I go into IDE and select the ESP8266 board, and when I load a sketch up, the program finds the ESP-01 board and loads the sketch by passing it through the Arduino. After that's done, I simply go into IDE and select the Arduino board, and can then load my project sketch for the Arduino to it, overwriting the Echo Booth sketch.

Here's the sketch I use to do the Echo:

void setup() {
    Serial.begin(115200);                   // Start Arduino-to-Computer serial
    Serial1.begin(115200);                  // Start Arduino-to-ESP-01 serial
    pinMode(13, OUTPUT);                    // Define integrated LED pin as an output
    digitalWrite(13, HIGH);                 // Turn on the integrated LED for visual indication of successful bootup
}

void loop() {
    if ( Serial1.available() ) {            // If the Arduino is receiving data from the ESP-01's serial
        Serial.write( Serial1.read() );     // Then write the data out to the computer's serial
    }
    if ( Serial.available() ) {             // If the Arduino is receiving data from the computer's serial
        Serial1.write( Serial.read() );     // Then write the data out to the ESP-01's serial
    }
}

My go-to ESP device is the Wemos D1 mini. It's smaller than the Uno, has more RAM and it has Wifi. For the price of an Uno, you can buy five Wemos boards.

All you need to do to use the Arduino IDE is to install the ESP8266 library. Then you program it just like any other IDE compatible board.

Stoopalini:
I am using these ESP-01 modules on a couple of different projects.
Amazon.com

Wow!

That is seriously expensive, as is the programmer! :astonished:

You sure pay through the nose for prompt delivery on Amazon! :grinning:

Oh well ...

Paul__B:
Wow!

That is seriously expensive, as is the programmer! :astonished:

You sure pay through the nose for prompt delivery on Amazon! :grinning:

Oh well ...

When I bought them, they were $11 and change for 4 of them. so $3 each, after shipping. That isn't expensive in my eyes .. especially when I can get them in 1 or 2 days ... but I get that price is relative to the person paying. Spending an extra $2 for convenience is fine by me,

The programmer was about $5 ... and I did find them much cheaper, but wanted it to arrive at the same time. So for $16, I had 4 ESP-01 modules and 2 programmers, within a couple of days. Well worth it my eyes, for dev work.

Now of course, if I were purchasing to produce in mass ... this obviously wouldn't be a good choice.