knolleary / pubsubclient

A client library for the Arduino Ethernet Shield that provides support for MQTT.
http://pubsubclient.knolleary.net/
MIT License
3.79k stars 1.47k forks source link

Hang using arduino nano with UIP driver #54

Open ccfiel opened 9 years ago

ccfiel commented 9 years ago

Hello I am using pubsubclient with arduino nano and UIP driver for ENC28J60 ethernet https://github.com/ntruchsess/arduino_uip. But I have notice that sometimes it will publish data and sometimes it does not. If i put this PubSubClient client(server, 1883, callback, ethClient); in my code sometimes the device get an IP and sometimes does not. Have any body here tried used this in arduino NANO and ENC28J60?

tlindener commented 9 years ago

I've only used it with an Arduino Uno. From what I've experienced this is relatively stable... But I would recommend everony to use a more stable solution.

Just to be clear: Not the PubSubClient seems to be the cause, but instead the Ethernet device.

theslavek commented 9 years ago

I have also tried the same, Arduino NANO + ENC28J60, but I have managed to do the publishes only so far. I am unable to handle any subscribe from the desired topic. Anyways, this combination seems to be as a quite unstable solution... Have you managed to do the subscribe on this?

anupam19 commented 9 years ago

Had any one tried pub and sub parallel?

theslavek commented 9 years ago

How much in parallel do you mean? Is there anything particular you are dealing in parallel with? I have just managed to do periodical pub (after 5 secs) with constant sub in the loop without any delay and it seems to be working (asynchronous callback function on sub with context switching)... Despite I consider it as a very unstable solution (Arduino Nano + ENC28J60 using UIPEthernet.h and PubSubClient.h), probably because the overhead of MQTT while using TCP is quite big...

anupam19 commented 9 years ago

Giving you an example: I am publishing accelerometer result (x,y,z) after 10 ms. and one sub is open in arduino. accelerometer pub will continue to push data and sub will continue to wait. whenever I push data say ON to arduino one LED should be on and when OFF it should be off.I tried with it. When I booted arduino. It was doing fine. but gradually the response time slowed down and after 1 hour there is no pub coming to me from arduino or nether my push ON/OFF were working. as if everything frozen. I tested with anyone of it (ie. either pub or sub, single action program). It worked fine. But together it was not. Do you have any suggestion on this?