Change project from ethernet shield to built-in ESP8266

I have a ready-made and well-designed project that includes:
1- two ds18b20 temperature sensors;
Ethernet shield V2;
Arduino Uno;
ModBus TCP/IP.

Тhe box of electronic items got very big and very tall, so I bought one ATmega328P WiFi - ESP8266.
Тhe program, which was written for Ethernet Shield, cannot work via WiFi.
Please help me to add the code to make the program work again with the WiFi module.

I want to change only a small part of the program that is connected to the Ethernet shield so that ModBus commands can work again.

Thank you!


thanks for the reply.

It turns out I can't flash ESP8266 - because its memory allocation is 512 + 512 - 8Mb. The library you gave me works only with flash version V1.7. Аs it can only be installed on a 1024 + 1024 flash.

Please advise me what to do.

Thank you!

before writing in the forum, I updated the ESP8266 version 1.4 and tried the collaboration between Arduino uno + ESP8266. Everything worked normally.

After telling me about the library, (I really want to thank you very much for that) I decided to update to V1.7.
I downloaded the Flash Download Tool, and everything I needed.

When I tried to change the flash, when I checked the result, I always came up with V1.4

I decided to delete the flash using the ERASE button on the Flash Download Tool. Then it already gives me that the ESP8266 has no firmware.

I tried to re-upload V1.4 with the tools I used to do this, but after many attempts, nothing changed.Currently, it always shows me that the device has no firmware.

Please help me find out if I have damaged the device? What exactly am I confusing about being unable to upload the old V1.4 firmware? Why doesn’t it work? All the pins are fine, the flash for AT commands I did it a few times, why is it not working the way I managed to flash it?
I am very surprised and do not know what else to try.

Thank you!

you can't damage esp8266 with software. try the AT_Lobo instructions.

If you have been successful in the past, then check your wiring for bad connections.

I finally succeeded! Can you tell me if the 2 files are uploading:

OR only 1 - esp8266_AT_1_2.bin;

Only one file is specified in the library. - esp8266_AT_1_2.bin;

The ESP8266_AT_LoBo library states that both files should be uploaded:

I'm asking you because I'm at the finish. Unable to connect to the wi-fi network and don't know where to look for the problem.

I do not know where I am going, because with V1.4 I was able to work with Blynk, and with the V1.7 version and the same program I could not switch on Blink.

I took a sample with Blynk to find out where my problem was. Do I send commands from UNO to ESP8266.

the numbers are not a version, thay encode the flash size and partitioning.
so _1_2 and _2_2 are two different builds

Hi Juraj,

I think it worked! Thank you very much for the help you have given me!

Hello again,

It turned out that the device only connects to the network and has Ping, but I cannot transmit ModBus commands as through LAN.

Can you tell me if i need to send with modbus commands and something special between adruino uno and esp8266 module.

Do I need in the main code of the Loop that worked with the LAN and transmitted through the modBus data for the 2 temperatures? Do I have to write some code with SerialPrint to send data from arduino uno to esp8266 or does the library do this?

Thank you!

did you port the code to WiFiEspAT library?
does the sketch connect to WiFi? do you get the IP address from DHCP?


Always connects to the WiFi network.

There is always PING with both static and dynamic IP!

Examples like - ping - it’s OK.

i don’t know if i set the gate correctly!

IPAddress ip(192, 168, 0, 45);
IPAddress gw(192, 168, 0, 1);
IPAddress nm(255, 255, 255, 0);
WiFiServer server = WiFiServer (502);
WiFi.config(ip, gw, nm);

I think everything is connected, name, password of wifi - - - port also connects —
What it gives me when trying to read modbus commands is a time out!
I don’t know if all the software I’ve developed for Ethernet shield - LAN can work with wifi esp8266.
i want help to tell me if i need to use another modbus library.
I have a feeling that the program needs to be revised in some way. I do not know if it worked perfectly before, it should remain in this form.

Thank you again!

your sketch is a modbus tcp server (slave)?

Yes, my device is slave modbus to use!
I use the device to transmit multiple temperatures via Ethernet ModBus IP.

you can enable logging to see the communication with AT firmware

I tried according to my skills, but I could not handle it.

Can you tell me what to change to start this communication?


maybe if you would show your code and output I could help you more

some comments to code you sent me in PM.

don't call WiFi.disconnect(). it clears the settings from flash. you have WiFi.setPersistent() so WiFi.begin() writes them. you wear out the flash. use setPersistent(false)

I don't see where is Mb associated with client

thanks again for the quick reply. At the moment, it is really important for me to complete this task.

I have filled condition 1 - I removed WiFi.disconnect() and I changed setPersistent(false).
Again did not work the program!

Regarding Condition 2: I have not changed anything from the program that works with Ethernet LAN. The program and its settings work in this way with LAN without adding or changing anything with Mb.
Can you give me an example of how to add a client to Mb?
I don't understand what I have to do!

Thanks for the replies!