Comments on: ESP8266 NodeMCU Publish Sensor Readings to ThingSpeak (easiest way) https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Wed, 27 Nov 2024 11:04:11 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Ramon https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-987043 Wed, 27 Nov 2024 11:04:11 +0000 https://randomnerdtutorials.com/?p=103639#comment-987043 Hello Sara,
I would appreciate help to change the code to replace the BME280 sensor with a sensor connected to A0 (resistive divider) on the ESP8266 to measure Voltage
Thank you so much

]]>
By: Francisco https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-897150 Fri, 08 Mar 2024 20:18:03 +0000 https://randomnerdtutorials.com/?p=103639#comment-897150 In reply to James Graham.

Hello James and Sara;
From one semi-retired to another, thanks for your post.
I’m using an Wemos D1 ESP8266 and after inserting the Channel ID in X, it works fine for me.
Thanks for the tutorial and post itself.
Best regards,
Francisco.

]]>
By: vishrutha https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-837532 Sat, 27 May 2023 17:31:05 +0000 https://randomnerdtutorials.com/?p=103639#comment-837532 In reply to Isti.

hello is this code worked for you

]]>
By: Isti https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-794817 Sat, 29 Oct 2022 09:58:37 +0000 https://randomnerdtutorials.com/?p=103639#comment-794817 In reply to Isti.

typing mistake:
SoftwareSerial nodemcu(8, 9); // Rx = 8 & Tx = 9

]]>
By: Isti https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-794816 Sat, 29 Oct 2022 09:55:42 +0000 https://randomnerdtutorials.com/?p=103639#comment-794816 Hi,
I am making project where I am using multiple sensors, arduino uno r3 and Nodemcu esp8266. I want to read data from the sensors using arduino and upload the data to thingspeak channel through Nocemcu esp8266. But I’m having a trouble to post the accurate data to thingspeake. Please help me out here with proper coding. Here I’m uploading my codes for arduino and nodemcu esp8266.

𝐀𝐫𝐝𝐮𝐢𝐧𝐨 𝐂𝐨𝐝𝐞:
#include <SoftwareSerial.h>
#include “DHT.h”
#include <Wire.h>
#include <SPI.h>
#define DHTPIN 7
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
SoftwareSerial nodemcu(3, 2); // Rx = 8 & Tx = 9
String myString;

void setup() {
dht.begin();
Serial.begin(9600);
nodemcu.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
float h = dht.readHumidity();
Serial.print(F(“Humidity: “));
Serial.println(h);
nodemcu.println(h);

float t = dht.readTemperature();
Serial.print(F(“Temperature: “));
Serial.println(t);
nodemcu.println(t);
// myString = String(“coming from arduino: “) + “\n” + String(“Humidity: “) + String(h) + “\n” + String(“Temperature: “) + String(t) + “\n”;
delay(3000);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
𝐍𝐨𝐝𝐞𝐦𝐜𝐮 𝐞𝐬𝐩𝟖𝟐𝟔𝟔 𝐂𝐨𝐝𝐞:
#include <SoftwareSerial.h>
#include <ESP8266WiFi.h>
#include <Wire.h>

String apiKey = “*******************”; // Enter your Write API key here
const char *ssid = “xxxxxxx”; // Enter your WiFi Name
const char *pass = “yyyyyyy”; // Enter your WiFi Password
const char *server = “api.thingspeak.com”;
WiFiClient client;
String myString; // complete message from Arduino, which consists of sensors data
float h,t;

void setup() {
// Debug console
Serial.begin(9600);
Serial.println(“Connecting to “);
Serial.println(ssid);

//connect to your local wi-fi network
WiFi.begin(ssid, pass);

//check wi-fi is connected to wi-fi network
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(“.”);
}
Serial.println(“”);
Serial.println(“WiFi connected”);
Serial.print(“IP Address: “);
delay(5000);
Serial.println(WiFi.localIP());
delay(5000);
}

void loop() {
h = Serial.read();
// myString=myString+h;
// Serial.println(h);

t = Serial.read();
// myString=myString+t;
// Serial.println(t);

if (client.connect(server, 80)) {

String postStr = apiKey;
postStr += "&field1=";
postStr += String(h);
postStr += "\r\n\r\n";

postStr += "&field2=";
postStr += String(t);
postStr += "\r\n\r\n";

client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);

}
client.stop();
Serial.println(“Waiting…”);
delay(3000);
}

]]>
By: Euan https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-732105 Wed, 16 Mar 2022 22:15:14 +0000 https://randomnerdtutorials.com/?p=103639#comment-732105 I think I’ve set everything up right but I still get this error message, any help would be appreciated. ‘invalid use of incomplete type ‘class setup()::WiFiClient’

]]>
By: dave https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-730637 Tue, 08 Mar 2022 00:39:06 +0000 https://randomnerdtutorials.com/?p=103639#comment-730637 In reply to Sara Santos.

I did some more research.
I just got the new computer and have not connected a board yet.
it seems that connecting the board is also a requirement.

that might answer why I never had the problem before and why no one else does.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-730463 Mon, 07 Mar 2022 11:24:44 +0000 https://randomnerdtutorials.com/?p=103639#comment-730463 In reply to dave.

Hi.
You just need to install the ESP8266 boards in the Arduini IDE and then select an ESP8266 board.
You can check this tutorial: https://randomnerdtutorials.com/installing-esp8266-nodemcu-arduino-ide-2-0/
Regards,
Sara

]]>
By: dave https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-730373 Mon, 07 Mar 2022 03:46:28 +0000 https://randomnerdtutorials.com/?p=103639#comment-730373 where to get ?
what version ?

ESP8266WiFi.h

arduino ide 2.0.0 does not offer this in the library manager I am using.

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-nodemcu-thingspeak-publish-arduino/#comment-729019 Sat, 26 Feb 2022 11:48:33 +0000 https://randomnerdtutorials.com/?p=103639#comment-729019 In reply to Matthew Hosini.

Hi.
Unfortunately, we don’t have any courses about that subject.
Regards,
Sara

]]>