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


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

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

sp_Feed sp_TopicIcon
Wemos D1 mini - Vodafone New Zealand 4G
No permission to create posts
August 11, 2017
4:56 am
New Member
Forum Posts: 2
Member Since:
August 1, 2017
sp_UserOfflineSmall Offline

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.

August 12, 2017
7:51 am

Forum Posts: 272
Member Since:
January 29, 2014
sp_UserOfflineSmall Offline

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

August 14, 2017
10:24 pm
New Member
Forum Posts: 2
Member Since:
August 1, 2017
sp_UserOfflineSmall Offline

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: 166

Currently Online:
34 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Epiphoneejf, Bbet1814On, Konstantintus, inalv69, bryancv1, priscillaql69

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457