Wemos D1 mini - Vodafone New Zealand 4G | ESP8266 Wi-Fi Module | Forum


Please consider registering


— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
Wemos D1 mini - Vodafone New Zealand 4G
New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
August 11, 2017 - 4:56 am
sp_Permalink sp_Print

Hello All

I thought it would be of some help to this community to share my experiences with getting a thingspeak device working here in New Zealand.

I am using a wemos D1 mini to upload my temperature data to thingspeak for a year or so before it “stopped” working.  My original project used LUA and worked fine.

I thought the problem was that the code had become corrupted (I found a few people who mentioned the same problems as I was having) so I set about converting the LUA code to Arduino.

I could not for the life of me get any of the example code on the web working at all.  I could connect to the wifi no problem; it would allocate my wemos an IP address.  When the code ran I could even see the IP address of the thingspeak servers, and it connected to them fine.

The problem was when the code got to the following line, it would time out and fail.

client.print("POST /update HTTP/1.1

I took the device to work(a fibre connection to the internet), and the code work perfectly, but I could not get it to work at my home, or even through a wifi hotspot from my cellphone.

I discovered that the problem was with my internet connection at my home.  My internet connection is through Vodafone using their wireless broadband 4G network.  It appears that Vodafone (I won’t say blocks) but doesn’t allow the particular ports used by the WiFiClient connection through.

I changed my code so that it uses the HTTP client instead.  This worked well, and I have been successfully using this for a few months now.

Relevant Snippets of the code I used is below.

I am sending two strings of information to thing speak.  The temperature outside my house, and the voltage of my batteries, thus the two values being passed to the function.


#include <ESP8266HTTPClient.h>  // instead of #include <ESP8266WiFi.h>




void PostToThingSpeak(float celsius, float voltage){

String updateURL = "http://";

updateURL += String(server);

updateURL +="/update?api_key=";

updateURL += String(apiKey);

updateURL +="&field1=";

updateURL += String(celsius);

updateURL +="&field2=";

updateURL += String(voltage);


int httpCode = client.GET();  // I guess I could check that I get a “1” as confirmation but I implemented that yet




For those of us who like a  “TLDR” Summary:

Could not connect using normal "client" code through vodafones network here in new Zealand, so had to adjust the code to use the httpclient method.


Forum Posts: 252
sp_UserOfflineSmall Offline
August 12, 2017 - 7:51 am
sp_Permalink sp_Print

For the record what port was your original code connecting to?

New Member
Forum Posts: 2
sp_UserOfflineSmall Offline
August 14, 2017 - 10:24 pm
sp_Permalink sp_Print

I was connecting using port 80...

for example the code below was one of the examples I tried to use.....and I could not get it to work....

(I have since then spoken to a friend who works in IT, and apparently there are different APN's that can be used with vodafone NZ network, and some of them allow different ports access through their firewalls, but I am not sure I can confirm or deny this)

if (client.connect(server,80)) {
String postStr = apiKey;
postStr +="&field1=";
postStr += String(t);
postStr +="&field2=";
postStr += String(h);
postStr += "

client.print("POST /update HTTP/1.1
client.print("Host: api.thingspeak.com
client.print("Connection: close
client.print("X-THINGSPEAKAPIKEY: "+apiKey+"
client.print("Content-Type: application/x-www-form-urlencoded
client.print("Content-Length: ");

Serial.print("Temperature: ");
Serial.print(" degrees Celsius Humidity: ");
Serial.println("Sending data to Thingspeak");
Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:







Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565


Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee