My updates via 4g router not working


I’ve been happily updating for quite a few years now using an EmonTx and separate arduino ethernet. I recently scrapped a slow BT based internet service and installed a Huawei B525 4g router connecting to the Smarty (Three) network. The emonTx continued to work fine using the esp method rather that Pi but the Arduino ethernet based system does not now work.

The same sketch seems to work just fine on routers that are not 4g based, getting an “OK” back from CMS and updating feeds successfully. It hasn’t worked on two different 4g routers and three networks - vodafone, giff gaff(02) and Smarty

I tried using a different Ethernet library without success but yesterday I reverted back to the original libraies and everything started working fine on my preferred Smarty 4g setup. Then at 3.36 am this morning it all stopped again and I’m really confused.

The arduino script (snippet below) works fine on two cable/ADSL routers and I thought not at all on 2 4g routers. Then just to confuse things furher it worked for about a day on my 4g system. I think* the JSON like string gets to emonCMS but there is no OK acknolagement. (*Adding an extra client.println(); elicits a grumpy http 400 error from

I’m probably missing something really obvious and admit that I’m using a legacy update format. However I don’t understand why this works fine on cabled systems and not at all bar once on a 4G router solution.

If anybody reads this and has had similar problems or can see an error in what follows I’d be very interested.

Best Regards


if (client.connect(emon_server, 80)) {
    Serial.println("WiFi Client connected to emonCMS");
    for (i = 1; i < noOfSensors; i++) {
    old = millis();
    while ( (millis() - old) < 500 ) // 500ms timeout for 'ok' answer from server
      while ( client.available() )
        c =;

My experience is that there are some significant compatibility issues with some routers and some Wi-Fi stacks - I think it is an authentication issue personally.

You simply need to daisy change a separate AP onto the main router.

I’ve got one of these with all my IOT devices connected to it. Far more stable than my expensive Ubiquiti gear sadly. They are out of stock unfortunately but that is likely to be a COVID problem I think. They are available on eBay for a bit more than I paid.

Thanks Brian, I will look into that as a solution.

I wondered whether there is any way of looking at a log file on to see why data transmitted with a particular write API is not getting an OK response. For some reason a GET that was working fine suddenly stopped working at 3:30 in the morning. My Router didn’t restart or do anthing at that time and I was asleep which is my aliby against doing something silly to the sketch.

I have removed the .json part of my test string and this should not be in the string when I ceck the API,

Could be a problem with the queues sometimes stall. @TrystanLea can usually fix it so just leave it running for now.

Thanks again Brian, I’m going to leaveit for now to clear my head. 've taken to scattergunning which is never good

Hello @David_Eager I’ve replied to your PM. Will take a look at this from this end see if there I can identify the issue. The queues are all running ok at the moment so likely something else.

Thanks Trystan, I’ve spent ~30 hours of time trying to get to the bottom of it. I hate admitting defeat :0|

Update - FIXED - I think this was a Huawei B525 router firmware issue.I found a regular message in the router logs that said there was a mac address conflict between the router and a Wemos D1 that I was using to run emonESP (the addresses were completely different??) . I changed to a different D1 and the original sketch on the Arduino Ethernet started posting to emoncms successfully again.

The original D1 and the router were running fine and seemed unrelated to the posting problems. I decided to replace the emonESP host with a low expectation of it fixing things but it did. Brian’s comments above about router incompatibility were the lead that got me to a solution - Thanks Brian!