Hi! Actually I'm trying to store data from 5 sensors on the ThingSpeak cloud. I was able to do it 2-3 days back, but right now I'm trying to do the same for last 2-3 hours and it's just not happening. There's nothing wrong with the code because it's getting compiled properly. I'm using ThingSpeak.writeFields(2261556,"93S04OOU67USDX64"); I tried printing its value after storing in a temporary variable........The value comes out to be -301. Is there any fix for this? I need it urgently for a project. I hope to receive some help soon. Thanks! -301 error of ThingSpeak 301 error generally means connectivity. What kind of device do you have? I would try moving the device or try connecting to a different network. For troubleshooting, you can try updating from a web browser, with thins kind of commansd in the browser address bar. https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXXXXX&field1=123 Just make sure to replace XXXXXXXXXXXXXXXX with your write API key for the channel. Ive redacted yours above, jut to keep it safe. @Christopher Stapels Thanks for replying! I tried it through web it's working. However, I aim to collect the data from sensors, store it o ThingSpeak and then access it through a mobile application. So, I want a solution for the -301 error coming while connecting to ThingSpeak for writing the data. I'm using a Windows. Are you running the code on a desktop computer? If your PC is has an ethernet connection, you wont need to use the ThingSpeak device library. Please describe the experiment. What kind of sensors? Are they connected directly to the computer? Do you need to update data from the mibile device or just read it? What device/program/interface/computer ar you using this command on? ThingSpeak.writeFields(2261556,"xxxxxxxxxxxxxxxx"); Yes, I'm running the code on my Windows laptop. In the experiment I'm simply collecting data from DHT11, flame, rain, Soil Moisture and Passive Infrared sensors. These are in total 5 sensors. They are connected to a Node MCU. On the mobile app, I just need to read the data. I'm using the command on Arduino IDE installed on my Windows 11 laptop. I hope I answered all the questions. Can you suggest a way out please? OK Node MCU was the key I was looking for. Are you programming in Arduino IDE or some other program? Are you making a connection to the Wifi? Is the connection successful? If you're not sure, you can add a little more of the code you are using on the Node MCU. Are you using example code from the ThingSpeak library? Yes, I'm using Arduino IDE. I'm using my mobile hotspot for my laptop & NodeMCU. I have provided my code below. #include <SimpleDHT.h> #define DHT11_PIN D3 SimpleDHT11 dht11 (DHT11_PIN); #define flame_sensor D0 #define pir D5 #define rain_sensor D4 #define soil_sensor A0 #include <ESP8266WiFi.h> #include <ThingSpeak.h> WiFiClient client; long myChannelNumber = 2262440; const char myWriteAPIKey[] = "BCQMZ9ELD7W2O6CL"; void setup() { Serial.begin(9600); WiFi.begin("Redmi 9 Prime","hi"); while(WiFi.status() !=WL_CONNECTED){ delay(100); Serial.print("."); } Serial.println(); Serial.println("NodeMCU is Connected"); Serial.println(WiFi.localIP()); ThingSpeak.begin(client); pinMode(flame_sensor,INPUT); pinMode(pir,INPUT); pinMode(rain_sensor,INPUT); pinMode(soil_sensor,INPUT); } void loop() { //DHT11 byte temperature, humidity; int error = dht11.read (& temperature, & humidity, NULL); Serial.print ("DHT: Temperature:"); Serial.print ((int) temperature); Serial.println ("° C,"); Serial.print ("DHT: humidity:"); Serial.print ((int) humidity); Serial.println ("%"); //FLAME SENSOR int flame = digitalRead(flame_sensor); Serial.println(flame); //PIR SENSOR int state = digitalRead(pir); if (state) Serial.println("PIR: Motion detected!!"); else Serial.println("PIR: No motion detected..."); //RAIN SENSOR int rain = analogRead(rain_sensor); Serial.print("RAIN: "); Serial.println(rain); //SOIL MOISTURE SENSOR int moisture = ( 100.00 - ( (analogRead(soil_sensor)/1023.00) * 100.00 ) ); Serial.print("SOIL: "); Serial.println(moisture); Serial.println(); ThingSpeak.setField(1,(int)temperature); ThingSpeak.setField(2,(int)humidity); ThingSpeak.setField(3,flame); ThingSpeak.setField(4,state); ThingSpeak.setField(5,rain); ThingSpeak.setField(6,moisture); int i = ThingSpeak.writeFields(2262440,"BCQMZ9ELD7W2O6CL"); Serial.println(i); delay(2000); } Can you try a fixed WiFi network, that isnt the mobile hotspot? Ive suceeded before with an ESP device and a mobile hotspot, but -301 is generally a wifi strength issue, so that woul dbe the best troubleshooting for now. Another thing you can try is to put a little more delay after the wifi is connected before you set up the ThingSpeak client just to make sure everything is ready. perhaps after this line: Serial.println("NodeMCU is Connected"); add delay(3000); Thats a long shot though. The strength issue is most likely. thingspeak -301 error connection error