How do I upload weather results to a cloud using ESP8266 and Zero-board

Shortly, I have built a weather station using arduino zero and I need to get the results to the cloud/server (I don’t know the difference but I think you get the idea. I want to be able to access the weather results via internet). I have esp8266-01. I have read about it and seen tutorials but I don’t understand alot of it since I am a beginner. This is where it gets tricky for me, there are alot good tutorials on this topic (one of them used thingspeak which seems ideal) but they all use Uno. normally I could copy the tutorials to my zero but on the network department there seems to be major differences with the ports and rx&tx. I have tried to read about the differences and change my code and wirings according to them but to no avail so far. I don’t really have a singular code I have been working on, i have just tried different things. So I think I want to just start from blank paper. What can I do to achieve my goal, where could I start? Thanks so much in advance. I can post one code which I copied from a thingspeak tutorial and tried to change some things to match Zero.

Hi.
I don't know if this will help you since I'm a beginner with ESP8266-01 too :D.
Remember that ESP8266-01 is not just a WiFi antenna, but a microcontroller, so you can upload a program to it.

For add the ESP based boards to your IDE, go to File -> Preferences and, on "Additional Boards Manager URLs" insert the next link: http://arduino.esp8266.com/stable/package_esp8266com_index.json
Then press ok, go to Tools-> Board -> Boards Manager and search for "esp8266", then install it.
Now, you have all ESP8266 based boards on your Arduino IDE, for using the ESP8266, go to Tools -> Board menu and select the first ESP8266 board on the list (Generic ESP8266 Module).

For flash/upload a programme to the ESP8266, you have to make the following connections:

  • GND to GND
  • VCC to 3.3v
  • TX to RX (I use a USB to TTL converter, but you can use an Arduino, just have to short, in the Arduino, the other GND pin with the Reset pin of the same).
  • RX to TX
  • And, finally, you have to plug the GPIO0 to the GND, so you can flash your ESP.

Recommend this video tutorial for wiring things up (if using Arduino):

When you finally upload your code to the ESP, you have to remove the GPIO0 from GND (you can even remove it from ESP if not needed) and restart the module again, so it left the "Flash mode".

After these steps (I hope I don't forget anything), your ESP will be running the code you uploaded to it.

If you want to get data from any other device, you can use the hardware serial (TX, RX pins) or even the software serial (on GPIO0 and GPIO2 pins).
This tutorial is also great for setup a Serial communication and even flash your ESP too:

I don't know if this will help you, I'm new on the Arduino Forum and so in the ESP8266-01, but I honestly hope I do.

Pedro

if you need to communicate with the web and since the Uno doesn't have Wifi, why not use an esp instead of an Uno (not both)? the esp has more memory and speed (and a 2nd internal processor for wifi).

presumably, you'll need to connect to a server, a specific page, and transmit a response (possibly a POST) to that page containing your weather data.

since the WiFi interface is internal to the esp, there is no 2nd serial interface needed to deal with wifi

For uploading some data to a server/database it depends on what protocol you will use (for example MQTT, HTTP), or even a database like MySQL, Firebase, MongoDB, ...

For example, you can upload your data to a NodeJS Server (made with JavaScript) and saving it in a MongoDB database.

In my projects with nodeMCU (ESP8266 based board), I used the MQTT protocol and, on the other side, a raspberry (you can use a computer too) with an MQTT-Broker (host). For treat the same data I connected a Python script to the same broker to get the respective data.
You can try to follow this website: https://www.instructables.com/id/MQTT-Bare-Minimum-Sketch/

It might seem a little confusing, I'm not the best one to teach you, as I'm a beginner too, but I recommend you to watch some tutorials about communication with esp8266 and external servers (I recommend you to start with MQTT, as it is a lot easier than HTTP protocol).

Hope you do great.

What is "arduino zero"?

batista742k2:
Hi.
I don't know if this will help you since I'm a beginner with ESP8266-01 too :D.
Remember that ESP8266-01 is not just a WiFi antenna, but a microcontroller, so you can upload a program to it.

For add the ESP based boards to your IDE, go to File -> Preferences and, on "Additional Boards Manager URLs" insert the next link: http://arduino.esp8266.com/stable/package_esp8266com_index.json
Then press ok, go to Tools-> Board -> Boards Manager and search for "esp8266", then install it.
Now, you have all ESP8266 based boards on your Arduino IDE, for using the ESP8266, go to Tools -> Board menu and select the first ESP8266 board on the list (Generic ESP8266 Module).

For flash/upload a programme to the ESP8266, you have to make the following connections:

  • GND to GND
  • VCC to 3.3v
  • TX to RX (I use a USB to TTL converter, but you can use an Arduino, just have to short, in the Arduino, the other GND pin with the Reset pin of the same).
  • RX to TX
  • And, finally, you have to plug the GPIO0 to the GND, so you can flash your ESP.

Recommend this video tutorial for wiring things up (if using Arduino):
how to program esp8266 using arduino uno | DIY ESP8266 Programming JIG - YouTube

When you finally upload your code to the ESP, you have to remove the GPIO0 from GND (you can even remove it from ESP if not needed) and restart the module again, so it left the "Flash mode".

After these steps (I hope I don't forget anything), your ESP will be running the code you uploaded to it.

If you want to get data from any other device, you can use the hardware serial (TX, RX pins) or even the software serial (on GPIO0 and GPIO2 pins).
This tutorial is also great for setup a Serial communication and even flash your ESP too:
Serial Communication - Arduino UNO and ESP8266 (ESP-01) - YouTube

I don't know if this will help you, I'm new on the Arduino Forum and so in the ESP8266-01, but I honestly hope I do.

Pedro

are those wiring ok for arduino zero? and what exactly do you mean by removing gp100? when exactly can I put it back in?

gcjr:
if you need to communicate with the web and since the Uno doesn't have Wifi, why not use an esp instead of an Uno (not both)? the esp has more memory and speed (and a 2nd internal processor for wifi).

presumably, you'll need to connect to a server, a specific page, and transmit a response (possibly a POST) to that page containing your weather data.

since the WiFi interface is internal to the esp, there is no 2nd serial interface needed to deal with wifi

As in the title, I dont have an uno, i have a zero. it has some differences to uno in usb ports and RXTX. Probably the main factor why I am stuck. Also, as in the post, I have 01 type of ESP8862.

batista742k2:
For uploading some data to a server/database it depends on what protocol you will use (for example MQTT, HTTP), or even a database like MySQL, Firebase, MongoDB, ...

For example, you can upload your data to a NodeJS Server (made with JavaScript) and saving it in a MongoDB database.

In my projects with nodeMCU (ESP8266 based board), I used the MQTT protocol and, on the other side, a raspberry (you can use a computer too) with an MQTT-Broker (host). For treat the same data I connected a Python script to the same broker to get the respective data.
You can try to follow this website: https://www.instructables.com/id/MQTT-Bare-Minimum-Sketch/

It might seem a little confusing, I'm not the best one to teach you, as I'm a beginner too, but I recommend you to watch some tutorials about communication with esp8266 and external servers (I recommend you to start with MQTT, as it is a lot easier than HTTP protocol).

Hope you do great.

Thanks. I don't really care about how I am going to do it but that I will do it. So whatever's the easiest way and works with my components (ESP8266-01 and arduino ZERO) then that's all I need

zoomkat:
What is "arduino zero"?

zoomkat:
What is "arduino zero"?

fenbhguardsperson:
and what exactly do you mean by removing gp100? when exactly can I put it back in?

Hello again. Before you upload the program to the esp, you have to plug the gpio0 to the Ground, so are able to flash the module. Google for "esp8266-01 pinout" and on images you will see the pins reference.
When you connect the gpio0 with the GND, power on the module and you will be able to upload the program to the esp (on the IDE, select the "Generic esp8266" and then upload).

When the upload is done, you power off the module and disconnect the gpio0 from the ground. When removed, you can power it up again.

fenbhguardsperson:
As in the title, I dont have an uno, i have a zero. it has some differences to uno in usb ports and RXTX.

If you have a tx/Rx hardware serial, you are able to flash your esp, and your Arduino zero have it.

I'm not with my computer at the moment, so it's hard to help you now.

But basically, you will make the following connections and see if it works (esp -> arduino zero):

Tx - Rx (esp - Arduino)
Rx - Tx (esp - Arduino)
Gnd - Gnd (esp - Arduino)
Vcc - 3.3v ( esp - Arduino)
Gpio0 - Gnd (esp - Arduino)
CH_PD/En - Vcc (esp - esp)

After that, upload the program.

When uploaded, power off the module, remove the gpio0 from the Gnd (you can remove it from the esp, if not needed) and power it on again.

It's a little confusing I know, writing on a smartphone isn't easy :smiley: but when come back home I can send you a simple example of data transfer via mqtt protocol (I have some projects with http, but since mqtt is easier, it's better you start for that).

Read the link and sent you on the second post about mqtt protocol, so you will understand it better later.

batista742k2:
If you have a tx/Rx hardware serial, you are able to flash your esp, and your Arduino zero have it.

I'm not with my computer at the moment, so it's hard to help you now.

But basically, you will make the following connections and see if it works (esp -> arduino zero):

Tx - Rx (esp - Arduino)
Rx - Tx (esp - Arduino)
Gnd - Gnd (esp - Arduino)
Vcc - 3.3v ( esp - Arduino)
Gpio0 - Gnd (esp - Arduino)
CH_PD/En - Vcc (esp - esp)

After that, upload the program.

When uploaded, power off the module, remove the gpio0 from the Gnd (you can remove it from the esp, if not needed) and power it on again.

It's a little confusing I know, writing on a smartphone isn't easy :smiley: but when come back home I can send you a simple example of data transfer via mqtt protocol (I have some projects with http, but since mqtt is easier, it's better you start for that).

Read the link and sent you on the second post about mqtt protocol, so you will understand it better later.

did everything as you said. Used Blynk example:
Arduino: 1.8.12 (Windows Store 1.8.33.0) (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), dtr (aka nodemcu), 26 MHz, 40MHz, DOUT (compatible), 1MB (FS:64KB OTA:~470KB), 2, nonos-sdk 2.2.1+100 (190703), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from C:\Users\Kiril\Documents\Arduino\CAMOME\CAMOME.ino:39:0:

Multiple libraries were found for "ESP8266WiFi.h"
C:\Users\Kiril\Documents\Arduino\libraries\BlynkESP8266_Lib\BlynkSimpleShieldEsp8266.h:15:2: error: #error This code is not intended to run on the ESP8266 platform! Please check your Tools->Board setting.

#error This code is not intended to run on the ESP8266 platform! Please check your Tools->Board setting.

^

In file included from C:\Users\Kiril\Documents\Arduino\libraries\BlynkESP8266_Lib\BlynkSimpleShieldEsp8266.h:29:0,

from C:\Users\Kiril\Documents\Arduino\CAMOME\CAMOME.ino:39:

C:\Users\Kiril\Documents\Arduino\libraries\BlynkESP8266_Lib/BlynkApiArduino.h:14:28: fatal error: Blynk/BlynkApi.h: No such file or directory

#include <Blynk/BlynkApi.h>

^

compilation terminated.

Used: C:\Users\Kiril\OneDrive\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.6.3\libraries\ESP8266WiFi
Not used: C:\Users\Kiril\Documents\Arduino\libraries\BlynkESP8266_Lib
exit status 1
Error compiling for board Generic ESP8266 Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Looks like you have another library for esp8266 shield conflicting with the one you should use in that case, and I think the compilation is giving you an error because of it (BlynkESP8266_Lib).

In your Arduino libraries directory (C:\Users\Kiril\Documents\Arduino\libraries) search for a folder named "BlynkESP8266_Lib", delete it or move it out temporarily and then restart your IDE.

By the way, I took a look at the Arduino zero, and there is an important thing I forgot to mention. If you are using a board like the Arduino to flash your ESP, you have to remove the microcontroller itself (in the case of Arduino, it's the ATmega328p-PU), I teste in when I came back home, and that's the one way it worked for me. You have to remove the microcontroller because, if not, you will face a timed out issue due to more than 1 device using hardware serial (Tx/Rx). In the case of the Arduino Zero, I think it's the same, the only problem is that you cant remove the microcontroller on the Arduino's Zero that I've seen.

You can try to do it if you have an Arduino UNO, but even with it, I recommend you a better and easiest solution, that is to use a USB to TTL converter or an ESP8266 programmer so you can flash your ESP directly from your PC, plugging the USB in.

ESP8266 programmer: Esp01 programmer adapter uart gpio0 esp-01 ch340g usb to esp8266 serial wireless wifi development board Sale - Banggood.com-arrival notice-arrival notice
or
USB to TTL: 3.3v 5v usb to ttl converter ch340g uart serial adapter module stc Sale - Banggood.com
or
**Arduino UNO as a programmer (I personally sometimes get some errors and it's a little harder): **How to Program ESP8266 (ESP-01) Module with Arduino UNO - Hackster.io

I recommend the USB to TTL if you are not good at welding because with some ESP8266 Programmers you have to weld a push-button between GPIO0 and GND, the same with VCC and CH_PD pins.

If you are wondering how you make the connections, check the table below:
(USB to TTL)

USB to TTL ESP8266-01
Tx Rx
Rx Tx
3.3v Vcc
Gnd Gnd
Vcc CH_PD
Gnd GPIO0

**Note: **Attached to this post, you can find a photo of mine connection with USB to TTL converter -> ESP.
If you have one of these, programming an ESP is really simple and save you much time.

With the ESP8266 programmer, as I said, if you don't buy/have one with logical converter, you have to solder a push-button between the GPIO0 and Gnd, as well as with the Vcc and CH_PD pins.

I never worked with an Arduino Zero, but I'm sure that, whatever the Arduino board is, it's a lot easier to flash the ESP via USB to TTL converter.

In my case, I flash the ESP (with a USB to TTL converter) with a program that takes sensors data from the Arduino (via Serial connection [Tx Rx]) and sends it for a Server hosted in my computer, this is an example of what you can do with your ESP.
Note that you can buy a USB to TTL that has a CH340 chip adapter, that makes the work even easier, but I don't think that it is necessary.

If you're asking if you can still use your Arduino zero, yes you can, you just have to upload the program to your esp, via one of the options that I showed you up there, and program a simple serial communication between the ESP and the Arduino.

A short Serial example code (For Arduino Uno, Zero, etc to ESP8266):
Arduino Zero:
void setup() {
Serial.begin(115200);
}

void loop() {
// This will send a message every second

Serial.print("Hi from Arduino Zero");
delay(1000);
}

ESP8266-01:
void setup() {
Serial.begin(115200);
}

void loop() {
if (Serial.available()) { // When a message is received from Tx pin of Arduino Zero, this will print it
char arduinoChar[20];
Serial.readBytes(arduinoChar, 20); // This will store the received value on the arduinoChar array.
Serial.println(arduinoChar); // This serial.print is for debugging purposes, so you can check what you receive
}
}

Sorry for not being able to help you flash your module with the Arduino Zero, but I'm sure you will prefer, even if you have an Uno, to flash via a USB to TTL converter.

Hope I have helped you.
Have a great day, think about that.

Will be in alert.

Pedro

batista742k2:
Looks like you have another library for esp8266 shield conflicting with the one you should use in that case, and I think the compilation is giving you an error because of it (BlynkESP8266_Lib).

In your Arduino libraries directory (C:\Users\Kiril\Documents\Arduino\libraries) search for a folder named "BlynkESP8266_Lib", delete it or move it out temporarily and then restart your IDE.

By the way, I took a look at the Arduino zero, and there is an important thing I forgot to mention. If you are using a board like the Arduino to flash your ESP, you have to remove the microcontroller itself (in the case of Arduino, it's the ATmega328p-PU), I teste in when I came back home, and that's the one way it worked for me. You have to remove the microcontroller because, if not, you will face a timed out issue due to more than 1 device using hardware serial (Tx/Rx). In the case of the Arduino Zero, I think it's the same, the only problem is that you cant remove the microcontroller on the Arduino's Zero that I've seen.

You can try to do it if you have an Arduino UNO, but even with it, I recommend you a better and easiest solution, that is to use a USB to TTL converter or an ESP8266 programmer so you can flash your ESP directly from your PC, plugging the USB in.

ESP8266 programmer: Esp01 programmer adapter uart gpio0 esp-01 ch340g usb to esp8266 serial wireless wifi development board Sale - Banggood.com-arrival notice-arrival notice
or
USB to TTL: 3.3v 5v usb to ttl converter ch340g uart serial adapter module stc Sale - Banggood.com
or
Arduino UNO as a programmer (I personally sometimes get some errors and it's a little harder): How to Program ESP8266 (ESP-01) Module with Arduino UNO - Hackster.io

I recommend the USB to TTL if you are not good at welding because with some ESP8266 Programmers you have to weld a push-button between GPIO0 and GND, the same with VCC and CH_PD pins.

If you are wondering how you make the connections, check the table below:
(USB to TTL)

USB to TTL ESP8266-01
Tx Rx
Rx Tx
3.3v Vcc
Gnd Gnd
Vcc CH_PD
Gnd GPIO0

Note: Attached to this post, you can find a photo of mine connection with USB to TTL converter -> ESP.
If you have one of these, programming an ESP is really simple and save you much time.

With the ESP8266 programmer, as I said, if you don't buy/have one with logical converter, you have to solder a push-button between the GPIO0 and Gnd, as well as with the Vcc and CH_PD pins.

I never worked with an Arduino Zero, but I'm sure that, whatever the Arduino board is, it's a lot easier to flash the ESP via USB to TTL converter.

In my case, I flash the ESP (with a USB to TTL converter) with a program that takes sensors data from the Arduino (via Serial connection [Tx Rx]) and sends it for a Server hosted in my computer, this is an example of what you can do with your ESP.
Note that you can buy a USB to TTL that has a CH340 chip adapter, that makes the work even easier, but I don't think that it is necessary.

If you're asking if you can still use your Arduino zero, yes you can, you just have to upload the program to your esp, via one of the options that I showed you up there, and program a simple serial communication between the ESP and the Arduino.

A short Serial example code (For Arduino Uno, Zero, etc to ESP8266):
Arduino Zero:
void setup() {
Serial.begin(115200);
}

void loop() {
// This will send a message every second

Serial.print("Hi from Arduino Zero");
delay(1000);
}

ESP8266-01:
void setup() {
Serial.begin(115200);
}

void loop() {
if (Serial.available()) { // When a message is received from Tx pin of Arduino Zero, this will print it
char arduinoChar[20];
Serial.readBytes(arduinoChar, 20); // This will store the received value on the arduinoChar array.
Serial.println(arduinoChar); // This serial.print is for debugging purposes, so you can check what you receive
}
}

Sorry for not being able to help you flash your module with the Arduino Zero, but I'm sure you will prefer, even if you have an Uno, to flash via a USB to TTL converter.

Hope I have helped you.
Have a great day, think about that.

Will be in alert.

Pedro

Yeah thats exactly what happened. I tried to connect my ESP to internet using Blynk and their example codes and it actually got to the point where it tried to connect and timed out eventually. I still don't know what flashing means, I need simple and understandable instructions, because I am a beginner and English isnt my first language. I don't really care what way am I going to get weather results in the internet, the most important thing is that it happens. So what you are saying is that I can get it to work on Zero but its hard without additional items? The items I listed are the only items I have, and due to the pandemic and the fact that I have to present my work tomorrow, I can't acquire any extra parts.

I dont have buttons but i can detach chpd and gp100 wires and put them back. When exactly do i detach and reattach them though?