ESP8266 & Arduino & GUI-O automatic pairing
-
@Bernard Hi!
Perhaps you are using older pairing code (the baud rate should be 115200). A brief explanation: 74k baud is used by the Esp8266 bootloader (as far as I know). When you program the Esp8266, you can set your own baud rate for uart - this is your new communication rate... Note that Esp8266 serves as a uart bridge between your device and GUI-O application (via a server of course).
There was also a potential problem with older pairing code, which resulted in the behaviour you're seeing (pairing failure). The memory allocation for pairing parameters was not big enough for some longer WiFi ssid names (and passwords).
Please re-download the pairing code (the baud should be set to 115k) and retry. Note that in the newer code (in ProgramAp::pairingRequestHandler method) the
StaticJsonDocument<500> responseDocument;
is allocated 500 bytes. Your current code is allocating less. Can you confirm this?
I will appreciate the feedback.
Best regards,
kl3m3n -
@kl3m3n said in ESP8266 & Arduino & GUI-O automatic pairing:
ProgramAp::pairingRequestHandler )
Good morning,
In the program " program_app.cpp I find: // Prepare response object StaticJsonDocument<500> responseDocument; it seems to be correct. Stupid question but where can I adjust the 115200 bd? and where download "ProgramAp::pairingRequestHandler )"?
Thank you for your patience Bernard -
@Bernard You are using the right code then.
You can set the baud rate via
#define _GUIO_SERIAL_BAUDRATE baud
where the baud is your desired baud rate... You can use 9600 if you want to... Just make sure that you use the same baud when communicating with Esp8266 (after pairing!).
Let's get back to pairing first... After you select "guio_ea9f6d93b119" network, try waiting a bit until Android prompts you to switch networks... Don't switch the network and after this press back button to return to the application.
Best regards,
kl3m3n -
@kl3m3n
After GIO wifi password => I activate the GUIO_xxxx network, my phone does not prompt me to change network but asks me if I want to keep the guio_xxxxxx wifi connection. I answer yes, I go back, a window with a big green V invites me to reconnect to my wifi router => continue, I select my wifi router, I press back and after 1 second my phone tells me that You have to start the procedure again! if I leave it in this state, a window tells me "Iot connection error. Connection refused, retry in 5 seconds. I think that's the procedure? Before this procedure, is there any other reason to TO DO ? Bernard -
@kl3m3n
small clarification: after being asked to reconnect to my wifi router, I see the blue led of the wifi module light up for about 300 msec. -
@Bernard Hi.
Can you please take a look at this video and tell me where do you encounter the problem?
If I understand correctly, the pairing data is exchanged OK. The problem occurs after you reconnect to your router and press back button (at time 0:55 in video above)? You get "Please retry pairing" error?
Also, this error you are describing (Iot connection error. Connection refused, retry in 5 seconds) is raising alarms for me... Can you check IoT settings from the settings menu... Can you connect to IoT (Settings -> Connections -> IoT -> Connect)? It seems there is something wrong with your credentials. Did you by chance modify anything?
Best regards
kl3m3n -
@kl3m3n
it is precisely at second 58 of the video, when I return from my reconnection to my wifi. Regarding IoT parameters:
Autoconnect is ON (in blue), Server Name = No set, SSL port Number =50000, User-name=gui-o-mqtt-generic, User password = Hidden from user, If I click on it, 9 black dots appear! ! which looks like a password , ,Client id_ No set, Enable IoT notification= disable, Open IoT notification= nothing, Notification to show = nothing
PS: I removed the password in Hidden from user, and tried a connection again, without success!
Bernard -
@Bernard Yes, you have wrong credentials. This is what's causing the problem. You have changed the settings somehow...
I advise you to clear application data or uninstall and reinstall the application. This will reset the settings to default. Alternatively, you could input the correct settings, but I recommend reinstall... It will be easier for you. Then retry pairing.
Note that you must keep the default settings if you want to connect to GUI-O server!
Best regards,
kl3m3n -
@Bernard said in ESP8266 & Arduino & GUI-O automatic pairing:
@kl3m3n
I forgot 2 parameters in IoT: Connect: Disconnected , New: Add new device: nothing, but after trying to connect I find the name I put in "Pairing device name" -
We are progressing! I uninstalled GUI-O and reinstalled. a new connection attempt and now I arrive at "waiting for peraid device" the blue bar advances for 2 minutes and after that it invites me to start the procedure again. This could be a bad configuration of the wifi module?!
it's a wemos D1 mini ESP8266, in the arduino IDE I used the Lolin(Wemos) D1 mini pro.
Bernard -
@Bernard how do you put Esp8266 into pairing mode? Once the pairing data is stored on Esp8266, it will boot directly into stationary (working) mode. Do you clear the parameters with !CLEAR_PARAMS command?
You must make sure that the WiFi password you input during pairing is correct, otherwise Esp8266 cannot connect. When Esp8266 is connected to the server successfully, the LED should be permanently ON! Please check that the built-in LED configuration is correct for your board (see config.h).
Best regards
kl3m3n -
@kl3m3n
I see in config.h the following parameters: // Serial communication baud rate
#define _GUIO_SERIAL_BAUDRATE 9600// LED used for main signaling tasks (e.g., built-in LED)
#define _GUIO_LED_MAIN LED_BUILTIN// Pin that serves as AP/reset button
#define _GUIO_AP_BUTTON D4, the password is 12345678, after flashing the module if I press the reset key I have the following text in the serial monitor of the IDE:
"ets Jan 8 2013,rst cause:2, bootmode:(3,7)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00051370
~ld ".
I note that at the end of the pairing attempt, as described yesterday, the blue led flach ~ 300 msec . I also specify that during the pairing phase, the wifi module is connected to my PC for l power and that I have not changed any parameters in config.h or elsewhere. Before starting the procedure in IoT there is: Autoconnect: Automatic (re)connect, Connect: "connected", New: "Add a new device ". After the procedure in New, I find the device associated with the device ( Bernard or GUIO or Test.
Bernard -
If I'm not mistaken, normally after the initialization phase with Arduino IDE, if I press the reset button of the Wifi module I should see on the serial monitor something like:
GUI-O ESP8266
AP mode
ssid: guio_xxxxxxxx
password:12345678
AP status 1.
It's just no ? -
@Bernard please uncomment
#define _GUIO_DEBUG
in config.h to output more information on uart. Recompile and reupload the code to Esp8266. This will give us more information to work with.
It is definitely some problem on Esp8266 side (not on the GUI-O app side).
Regards,
kl3m3n -
@kl3m3n
Here is what I see on the IDE terminal:
Pairing request: {
"mqttHostName": "mqtt.gui-o.com",
"mqttUserName": "gui-o-mqtt-generic",
"mqttUserPassword": "lqXeZpv5VJyv0XBT",
"networkPassword": "---------",
"networkSsid": "-----",
"publishTopic": "95fb4171-2024-42de-978e-fcbb6c6caf10",
"subscribeTopic": "b1126463-4511-45b0-84fa-350ad2a41751"
}
Pairing response: {
"pairingResponse": 0,
"pairingDeviceName": "guio_ea9f6d93b119",
"networkSsid": "------",
"networkPassword": "---------",
"mqttHostName": "mqtt.gui-o.com",
"mqttUserName": "gui-o-mqtt-generic",
"mqttUserPassword": "lqXeZpv5VJyv0XBT",
"subscribeTopic": "b1126463-4511-45b0-84fa-350ad2a41751",
"publishTopic": "95fb4171-2024-42de-978e-fcbb6c6caf10"
}
Pairing succeeded! Copying parameters and scheduling restart...
b
gC))k%
H
I a 0gf) X ʎ t N
y )1% 9o)C C9
E )/
**** ESP8266 GUI-O ****GUI-O parameters not found... initializing...
AP Mode
ssid: guio_ea9f6d93b119
password: 12345678
AP status: 1
I deliberately erased password and ssid but they are correct.
Bernard -
@Bernard It seems that the pairing parameters are not saved into Esp8266 EEPROM successfully... This triggers booting into AP (pairing) mode...
I am wondering if your board selection is ok?
@Bernard said in ESP8266 & Arduino & GUI-O automatic pairing:
This could be a bad configuration of the wifi module?!
it's a wemos D1 mini ESP8266, in the arduino IDE I used the Lolin(Wemos) D1 mini pro.Best regards,
kl3m3n -
@kl3m3n
Good morning,
actually i think the wifi modul is faulty. I tried to flash it with 5 different combinations but it's always the same result. I will therefore recommend one and I will keep you informed of the evolution of things. In any case, thank you very much for your patience and valuable advice! maybe these exchanges will be useful to others, but I think it's bad luck.
Kind regards Bernard -
@Bernard Hi.
I suggest you try a simple EEPROM write / read example for ESP8266.
Does this work?Best regards,
kl3m3n -
@kl3m3n
Hello kl3m3n
As explained at the beginning of our discussions, I do not know the C language at all. I will therefore be unable to write this procedure!
But on my last pairing attempt, I got to "IoT connection successful" but the blue bar advances for 2 minutes then prompts me to start the process again and what I read on the serial interface of L' IDE and always the same thing as quoted on 09.02.at.9:23 p.m. There is indeed a read-write problem in the ESP! have a good week-end. Bernard -
@kl3m3n
What I have trouble understanding is that the "Pairing request: { process seems to work since there is a "Pairing response: { , then Pairing succeeded! Copying parameters and scheduling restart . so why " GUI-O parameters not found... initializing...