ESP8266 with Arduino IDE

Can you please post your resource definition?

Resource definition was the same as in library example. By the way after reloading the page for a couple of times, the problem got resolved. Please look into it.

Great to know it finally worked. If the resource does not appear in the api explorer it uses to be a symptom of a delay inside the loop or any resource, an unstable connection with the device, and so on. It is useful to enable DEBUG when having problems to see what is happening really:

http://docs.thinger.io/arduino/#coding-enabling-debug-output

Hey , I am quite new to thinger.io.
what if if the ESP resets itself for some reason and doesn’t remember previous GPIO state ? Is there any provision in the code/lib, that ESP can be setup to read user defined GPIO state from the thinger.io server ? Any help is greatly appreciated.
Thank You.

Hy! Thinger doesn’t have any feature to allow that (even jet jejej), but you can create a file in your flash memory or use EEPROM.h to save the last GPIO status.

I guess maybe you can try to write the GPIO to a bucket every time it has a change, and in setup you can read this bucket, (I’ve never did this, just answering with the idea of where would I try to accomplish the task).

Or you can make a call to write from device A (the GPIO status you want to keep) to thinger device B (the device will keep you the GPIO status backup) to storage this kind of values, and in setup of device A make a call to read GPIO status from device B variables, and of course make a call to read from device B variable status from device A, in this way you warantee if any device reboots, will recover the GPIO status from the other one, its like a kind of redundancy, I see this solution more easy to accomplish, there are examples of calls to write and read between thingers devices in the same and differents thinger accounts.

I don´t like the EEPROM solution in this particular case, because the life of this memory is short, you can write it just around of 10.000 times,and if you have a process that changes a lot the GPIO states, you can finish your EEPROM life pretty fast, I recommend to storage at EEPROM the configuration, because when the micro is configured and working, the configuration doesn’t changes frequently.

Today I wanted to connect to thinger.io with my ESP8266 to monitor my test project.

Unfortunately I was not successful. I have followed the steps of your online turotorial with no luck.
My ESP8266 is connected to my wifi and I have definitely entered correct username,
deviceID and credentials ( I have even tried 2 devices, if I accidentally misspell something).

The library was successfully installed automatically and I don’t get any errors when i compile the project.

What else can I do, to connect the device to the website and start using all of it functionality?

hi @kosi96, can you enable the debug output of the sketch to see what is happening?

Hi,

I did and this is what I’ve got in Serial Monitor error

If I ping it from my PC I also lose all the packets.

Hi,
I’ve been in your situation when using ESP8266.
My suggestion is try to use NodeMCU instead of ESP8266. It is more stable. Seriously.
Did you ever test thinger platform using another DevKit?

I have tried using NodeMCU 1.0 with no luck. Same error…
Is is normal that I don’t get any packets back if I ping it?

Nope, this is my first and only device for now…

Hi @kosi96, the server will not respond to ping… there is a firewall there blocking ping requests. Regarding your log… are you using the default Thinger.io example for NodeMCU, or just using an ESP8266 with AT commands? This log is not the default log reported by Arduino libraries enabling the debug. Can you share your sketch? Best.

Oh, thanks for the explanation. I’ve tried quite a few different sketch with no success. This is the most basic one for ESP8266 right?


Sorry for late replay, I didn’t have my PC with me during the weekend.

Hi,

yes, this is a basic example for the ESP8266. Please, enable the debug there, by adding the following sentence to the top of the file:

#define _DEBUG_

Then open the serial monitor to see what is happening there.

I did and got the same reply as the first picture I’ve posted. I have followed this link for debugging the ESP8266

Hey, having the same issues.
Sketch:
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <ThingerWifi.h>

#define DEBUG

#define SSID “belkin.e3e”
#define SSID_PASSWORD “password”

ThingerWifi thing(“hotronics”, “someid”, “someid”);

void setup() {
Serial.begin(115200);
pinMode(BUILTIN_LED, OUTPUT);

thing.add_wifi(SSID, SSID_PASSWORD);

// resource input example (i.e. turning on/off a light, a relay, configuring a parameter, etc)
thing[“led”] << [](pson& in){ digitalWrite(BUILTIN_LED, in ? HIGH : LOW); };

// resource output example (i.e. reading a sensor value)
thing[“millis”] >> [](pson& out){ out = millis(); };

// resource input/output example (i.e. passing input values and do some calculations)
thing[“in_out”] = [](pson& in, pson& out){
out[“sum”] = (long)in[“value1”] + (long)in[“value2”];
out[“mult”] = (long)in[“value1”] * (long)in[“value2”];
};
}

void loop() {
thing.handle();
}

Serial output:
sta config unchangedscandone
wifi evt: 2
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 4
cnt

connected with belkin.e3e, channel 4
dhcp client start…
wifi evt: 0
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
wifi evt: 7
ip:192.168.2.10,mask:255.255.255.0,gw:192.168.2.1
wifi evt: 3
[hostByName] request IP for: iot.thinger.io
[hostByName] Host: iot.thinger.io IP: 18.202.4.104
:ref 1
:wr 37 0
:wrc 37 37 0
:ack 37
:rcl
:abort
wifi evt: 7

I can’t see the device connected to the thinger io platform. I double checked all constants. What would you recommend I do? I’m using NodeCMU

Thats weird, I haven’t seen something like that response at serial console, by thinger debug,

Check what version of esp8266 board are you using, recently I made a fresh installation and installed last arduino ide (1.8.8), last esp8266 library (2.5.0 beta) and didn’t work, installed the previous one (2.4.2) and worked again.

I would try with other board too, and basic skecth, although you have a pretty basic sketch, to solve communication issue, after that, go to next step

Hope this helps.

I have the same problem like Apaezmx.
Your solution to use arduino 1.8.8 and library thinger.io 2.4.2 solve the problem.
Thanks !
But, unfortunately the function : write_bucket doesn’t work with this version 2.4.2…
I tried with others versions without success.

Hi @eric2, did you tried the current version from master? It solves some problem related with SSL, as we told here:

Notice that the code provided by @Apaezmx is not for ESP8266.

Thanks for your answer !
Yes, everything is working for the NodeMCU. With :

  • board : the version 2.4.2 of esp8266 board (by ESP8266 community) (not the 2.5.0 - beta !!! )
  • library : the version 2.9.2 of thinger.io
  • (soft : the version 1.8.8 Arduino IDE)

Great !