Error -301 with Arduino mega and shield W5100

Gilles Mangin-Voirin il 16 Giu 2021
Ultime attività Replicato da Gilles Mangin-Voirin il 18 Giu 2021

I don't understand what the -301 error means when trying to write a field to ThingSpeak. I checked my key and my write ID is OK ... The same program on another Arduino Mega and shield W5100 (but on another channel) works well ... Does anyone have any idea what the meaning of this error code is to know in which direction to look! Thank you

code :

void thingspeak(float t, float h, float units, int lum, int TempInt){

ThingSpeak.setField(1, t);								
ThingSpeak.setField(2, h);								
ThingSpeak.setField(3, units);							
ThingSpeak.setField(4, lum);								
ThingSpeak.setField(5,TempInt);							
ThingSpeak.setStatus("Update OK: ");					
    /* écriture des champs dans ThingSpeak */
  int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);			
if(x == 200){										
  Serial.println(F("Update of ThingSpeak ok."));				
              } 									
  else err(6,x);									// error handling
                                                   		   }        		// end of function thingspeak
Gilles Mangin-Voirin
Gilles Mangin-Voirin il 16 Giu 2021

I have 2 different IP addresses and MAC addresses. (on each of my 2 Arduino) And the shield is well connected to the internet since before trying to update Thingspeak, my program sends me 2 emails (emailender libraries from Mischianti Renzo) which I receive very well ....

Thanks for the suggestion.

Vinod
Vinod il 17 Giu 2021

The 301 is typically when the library cannot connect to the ThingSpeak API server. If you have ruled out the connectivity issue, I'd recommend investigating what is different between the two Arduinos and their shields. Maybe firmware needs to be updated? You might also want to diff the .INO files of the sketch that does work, and the one that doesn't. What is the difference between them?

Vinod
Vinod il 16 Giu 2021

Since you mention 2 devices with the shield, one working and another not, have you looked at your router's config and can you see that two Arduinos are connected to it? My guess is that you have a MAC address collision and the second Arduino is not even connected to the internet.

Gilles Mangin-Voirin
Gilles Mangin-Voirin il 17 Giu 2021

I'm moving towards solving the problem: with a w5500 shield the ThingSpeak update works normally without having modified the program. However it worked with another w5100, I found this post talking about communication speed and a resistance value problem :

https://forum.arduino.cc/t/inthernet-shield-et-freebox/430123/11

the model with which I was testing at a resistance mark 511. Finally with the shield w5500 it works except that suddenly the I2C does not work any more ... While it worked correctly with the w5100 ... Thank

Vinod
Vinod il 17 Giu 2021

Sounds like brownouts could be interrupting your connectivity. Maybe consider a 2A/5V power supply to your Arduino & shield? Also, on another thread a user mentioned he had to update his device firmware to get it working, albeit that was for a different device (MKR1000).

Gilles Mangin-Voirin
Gilles Mangin-Voirin il 18 Giu 2021

Yes I saw the post on firmware update for the MKR1000, but I did not find a software update for the sheild W5100. Did you see anything about the sheild w5100 update? For the power supply, I will test currently I am powered by the USB port of the computer. Thank you

Gilles Mangin-Voirin
Gilles Mangin-Voirin il 18 Giu 2021

I just tried with the 2 resistors of 120 ohms between the terminals 1,2 and 3,6 of the RJ 45 on the W5100, it still does not change anything with this shield the error -301 ... on the shield W5500 that works well ... (except I2C interface ...) Thank you