Sei sulla pagina 1di 4

Using the ESP8266 WiFi module we will connect Arduino to the internet.

With this
module, we can transfer the data from the sensors to the internet environment.
First of all, to mention a bit about the ESP8266 module, the module can be connected
to both wireless networks and wireless network access points. In addition, since the
module has its own processor, the input / output pins can be used. In other words, it is
possible to implement projects using only modules without using an Arduino-like
microcontroller card.

*We need arduino and wifi module


ATmega328P - 8-bit AVR Microcontroller
ESP8266-01

* When you receive the module, you need to update the firmware in the module
before you start using it. The reason for this is that with every new release, the
module becomes more stable and offers extra features. To update the module,
we first need to make the connections as follows.
* We download the update files we need to update the module.

ESP8266 Firmware Update

After downloading the files, we open the ESP8266Flasher program and the following
screen appears.

When the process is completed, the ESP8266 module will be updated.


After the Firmware Update, we will set up a server with ESP8266 and create a simple
web page containing the ambient temperature, the changing rpm values of the fan
according to this temperature and the rgb color codes proportional to the temperature.

After connecting my Arduino via USB to my computer, we turn on the serial monitor
and make sure that the baud rate settings are as follows.

After making the adjustments, when we write AT at the command line, the module
should return to us with OK response. If we see this answer, our module is working
and we are in touch with you. After that, we connect to the network with AT +
CWJAP = "SSID", "Password" command. After connecting to the network, when we
send the AT + CIFSR command, our module will show us the IP address. We make a
note of this address, because we will use it later.
Now that we have come to make the connections and write our code and install the
server.
*To send commands to ESP8266 using arduino, we need to make the
connections as follows.

(You have also noted that the TX and RX pins are reversed from the previous one.)
I would like to mention a few AT commands we used in the code if we did the
connections above.

*If it is connected to any network for the first time, it exits the network connected with AT +
CWQAP command to output.

We need to run ESP 8266 (WiFi module) in STA mode since we want to connect to any
network in the environment and install a server.

*To enter the module into STA mode, we need to send AT + CWMODE = 1 command. For
other modes, it would be enough to write the corresponding number.

* AT + CWJAP = "SSID", "Password" command is used to connect to the network.

* We learn the IP address assigned to us on the network to which we are connected by AT +


CIFSR command.

*Then we use AT + CIPMUX = 1 command. It is taking over TCP / UDP.

*After that, we will send this command AT+CIPSERVER=1,80 our server is runned by this
command. But this command consists of two variabla value .They only can be one or zero.
Digital high value runs the server and digital low value stops the server. Port number of the
server is 80 which we will run.

*We send these codes to server which we have installed via this command AT+CIPSEND.
* we shut down the server with AT + CIPCLOSE command.

Potrebbero piacerti anche