Topic: Disconnect message on RemoteXY
Hello
I have a problem using RemoteXY application on my Arduino phone.
More then one time the connection between my Arduino board and the application is stopped by this DISCONNECTED message and I do not know wat can be the root cause for this issue. Maybe you can offer me some suggestion for a possible improvement.
My setup description:
I'm using Arduino Uno board R3 with Atmega328-PU
ESP8266-E01 for Wi-Fi connection
The RemoteXY is configured to use the WI-FI connection not cloud connection.
Some times is working fine but there are some times that is disconnecting very often
The code is build to monitor a consumption of one external heater and three NTC's.
The Code that is running on the Arduino328
"
//////////////////////////////////////////////
// SAVE VALUE IN TO EEPROM //
//////////////////////////////////////////////
#include <EEPROM.h>
//////////////////////////////////////////////
// Current mesure include library //
//////////////////////////////////////////////
#include "ACS712.h"
// ACS712 5A uses 185 mV per A
// ACS712 20A uses 100 mV per A
// ACS712 30A uses 66 mV per A
//ACS712 configuration
ACS712 ACS(17, 5.0, 1023, 100);//5V VDD
//ACS712 ACS(25, 3.3, 4095, 185);//3.3V VDD
//////////////////////////////////////////////
// Temperature include library //
//////////////////////////////////////////////
#include <OneWire.h>
#include <DallasTemperature.h>
//Data wire is plugged into port 2 on the Arduino
#define ONE_WIRE_BUS 18
#define ONE_WIRE_BUS1 19
OneWire oneWire(ONE_WIRE_BUS);
OneWire oneWire1(ONE_WIRE_BUS1);
DallasTemperature sensors(&oneWire);
DallasTemperature sensors1(&oneWire1);
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
//RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266_HARDSERIAL_POINT
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 115200
#define REMOTEXY_WIFI_SSID "ESP8266"
#define REMOTEXY_WIFI_PASSWORD "123456789"
#define REMOTEXY_SERVER_PORT 1002
//RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] = // 453 bytes
{ 255,2,0,69,0,190,1,16,13,2,129,0,31,57,39,3,6,91,38,3,
24,65,81,85,65,82,73,85,77,32,67,79,78,84,82,79,76,76,69,82,
0,129,0,71,58,14,2,26,95,15,2,24,66,121,32,66,111,103,100,97,
110,32,86,49,46,54,0,70,16,7,9,4,4,7,13,4,4,24,37,0,
68,51,7,25,86,29,5,32,50,36,13,24,13,13,65,109,112,46,0,86,
97,114,105,97,98,108,101,32,50,0,86,97,114,105,97,98,108,101,32,51,
0,129,0,7,5,9,3,6,8,12,4,24,72,101,97,116,101,114,0,129,
0,39,5,17,3,5,70,24,4,24,84,101,109,112,101,114,97,116,117,114,
101,0,67,4,39,11,14,6,6,80,12,5,24,13,11,129,0,50,11,4,
6,15,80,3,5,24,67,0,67,4,56,13,9,4,6,85,12,5,24,13,
11,129,0,63,13,2,4,15,85,3,5,24,70,0,129,0,12,10,10,2,
13,14,7,2,24,80,79,87,69,82,0,129,0,67,9,10,2,32,76,11,
3,24,82,111,111,109,32,84,77,80,0,67,4,67,11,11,6,32,80,12,
5,24,13,11,129,0,77,11,4,6,41,80,3,5,24,67,0,67,4,84,
13,9,4,32,85,12,5,24,13,11,129,0,91,13,2,4,41,85,3,5,
24,70,0,129,0,40,9,10,2,6,76,16,3,24,87,97,116,101,114,32,
84,77,80,0,129,0,71,19,8,2,36,29,8,2,24,84,77,80,32,76,
111,119,0,129,0,44,19,8,2,42,20,14,2,24,84,77,80,32,83,69,
84,0,7,21,54,18,9,4,44,23,9,4,24,13,28,129,0,54,11,2,
6,49,75,2,6,24,47,0,129,0,82,11,2,6,23,75,2,6,24,47,
0,67,4,21,9,10,4,25,13,10,4,24,13,11,129,0,28,9,2,4,
32,13,2,4,24,65,0,129,0,20,9,2,4,24,13,2,4,24,47,0,
70,16,66,18,4,4,46,28,4,4,134,37,0 };
//this structure defines all the variables and events of your control interface
struct {
//input variables
int16_t edit_1; // 32767.. +32767
//output variables
uint8_t Heater_LED; // led state 0 .. 1
float onlineGraph_1_var1;
float onlineGraph_1_var2;
float onlineGraph_1_var3;
char Aq_TEMP_1[11]; // string UTF8 end zero
char Aq_TEMP_2[11]; // string UTF8 end zero
char Ex_TEMP_1[11]; // string UTF8 end zero
char EX_TEMP_2[11]; // string UTF8 end zero
char Aq_Heater[11]; // string UTF8 end zero
uint8_t TEMP_LED; // led state 0 .. 1
//other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
//const int Current_Sensor = 17;
const int Heater_LED = 11;
const int TEMP_LED = 10;
float low_lim = 0;
float High_lim = 10;
void setup() {
Serial.begin(115200);
RemoteXY_Init ();
sensors.begin();
sensors1.begin();
ACS.autoMidPoint();
pinMode(Heater_LED, OUTPUT);
pinMode(TEMP_LED, OUTPUT);
RemoteXY.edit_1 = EEPROM.read(0);
}
void loop() {
RemoteXY_Handler ();
sensors.requestTemperatures();
sensors1.requestTemperatures();
RemoteXY.onlineGraph_1_var2 = low_lim;
RemoteXY.onlineGraph_1_var3 = High_lim;
float average = 0;
uint32_t start = millis();
for (int i = 0; i < 50; i++)
{
average += ACS.mA_AC();
}
float mA = average / 100.0;
uint32_t duration = millis() - start;
mA = mA/1000;
if(mA<=0.20){
mA=0.00;
}
RemoteXY.onlineGraph_1_var1 = mA;
if (mA<0.1){
digitalWrite(Heater_LED,LOW);
RemoteXY.Heater_LED = LOW;
dtostrf(mA, 0, 2, RemoteXY.Aq_Heater);
}
else
{
digitalWrite(Heater_LED,HIGH);
RemoteXY.Heater_LED = HIGH;
dtostrf(mA, 0, 2, RemoteXY.Aq_Heater);
}
int value = atoi (RemoteXY.edit_1);EEPROM.update(0,RemoteXY.edit_1);//Set_temperature limit
float tempC = sensors.getTempCByIndex(0);
dtostrf(tempC, 0, 1, RemoteXY.Aq_TEMP_1);
if (tempC < RemoteXY.edit_1)
{
digitalWrite(TEMP_LED,HIGH);
RemoteXY.TEMP_LED = HIGH;
}
if (tempC > RemoteXY.edit_1)
{
digitalWrite(TEMP_LED,LOW);
RemoteXY.TEMP_LED = LOW;
}
float tempF = sensors.getTempFByIndex(0);
dtostrf(tempF, 0, 1, RemoteXY.Aq_TEMP_2);
float tempC1 = sensors1.getTempCByIndex(0);
dtostrf(tempC1, 0, 1, RemoteXY.Ex_TEMP_1);
float tempF1 = sensors1.getTempFByIndex(0);
dtostrf(tempF1, 0, 1, RemoteXY.EX_TEMP_2);
}
"
There are some restriction related to the code from Arduino or a timing issue that I need to respect to have a better connection?
Thank you in advance for your help!!!