I'm using an arduino nano with an ethernet shield (ENC28J60), and ethernet eem to be working (I can create a webserver with Ethercard library).However, i'm stuck when i try to connect to a MQTT server.

I tried NanodeMQTT (stuck at waitforlink), Adafruit MQTT Library + Ethernet.h ( MQTT_connect() : Connection failed, endlessly retrying), PubSubClient + Ethernet.h (client.connect return 0) and some others.

At this point i am wondering if i am doing the right configuration each time:

when asked an ip, i set the static one i want for my arduino :

when asked an gwip, i set one of wy internet router :

when asked for a server, i set it to my mqtt server ipv4 : (and port is 1883)

when asked for a mac adress, i keep the one in the example, or just write a random one

Do you know what can cause the ethernet.h or mqtt library to fail, but still ethercard is working fine ?

  • Try simple then add features. For example, try to get the Ethernet working first. Then add the MQTT. Who is asking for IP addresses? Are you saying these are the IP addresses you have added to your program / sketch? If your program / sketch is not long maybe you can include it in your question.
    – st2000
    Nov 22, 2019 at 17:29
  • 2
    try UIPEthernet library instead of Ethernet, which is for a different chip
    – Juraj
    Nov 22, 2019 at 17:45
  • i'm using the basic bluit-in examples for theese libraries, and did not include them since i tried 3 and none worked. But since Ethercard work on my end, i will try to fiddle with it and a MQTT library then. Also tried UIPEthernet with no success, but did not even realise it was a standard library designed for ENC28J60, thanks for pointing that out, maybe i can just adapt some Ethernet.h code by replacing it with UIPEthernet
    – Neil
    Nov 23, 2019 at 10:40

1 Answer 1


Thanks to Juraj pointing me that UIPEthernet is just a replacement for the Ethernet library, I finnally found this article Which works just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.