0

I built this project: http://www.instructables.com/id/Low-cost-WIFI-temperature-data-logger-based-on-ESP/?ALLSTEPS The ESP8266 outputs something and I think it should be ok. But there are no entries in the Thingspeak channel. I already double-checked the API-Write Key. Here's the serial output:

Setting up WIFI...
> IP unavaiable, Waiting...
IP unavaiable, Waiting...
IP unavaiable, Waiting...
IP unavaiable, Waiting...
IP unavaiable, Waiting...
IP unavaiable, Waiting...
Config done, IP is 192.168.1.9
Last temp: 216875
Temp:21.6875.6875 C

Sending data to thingspeak.com
Last temp: 216875
Temp:21.6875.6875 C

Sending data to thingspeak.com
Got disconnection...
Last temp: 216875
Temp:21.6875.6875 C

Sending data to thingspeak.com
Got disconnection...
Last temp: 216875
Temp:21.6875.6875 C

Sending data to thingspeak.com
Got disconnection...
Last temp: 216875
Temp:21.6875.6875 C

How can I solve this problem?

1
  • Do you need any more feedback? If not then please consider accepting the answer so SO can mark this case as closed. Commented May 3, 2016 at 20:45

1 Answer 1

1

It was a bug in the SDK that the code in the project you referenced ever worked. In pre-1.0 SDKs conn:send was synchronous i.e. you could call it sequentially and it would block until each string was sent. Espressif later changed the underlying function to be asynchronous. Hence, the code at https://github.com/ok1cdj/ESP8266-LUA/blob/master/Thermometer-DS18B20-Thingspeak/ds1820.lua#L77 fails. See the the net.socket:send() API documentation for more details.

However, since you're already on a recent firmware version (from the dev branch I believe) you should make full use of the new HTTP module. http.put() is way more convenient than to operate on the raw socket.

See https://mathworks.com/help/thingspeak/update-a-channel.html for how to PUT data to ThingSpeak.

Side note: I suggest you also use DS18B20 sample code from https://github.com/nodemcu/nodemcu-firmware/tree/dev/lua_modules/ds18b20 provided by the NodeMCU team. That code is much more likely to be in sync with the firmware.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.