Chart o tendencias historicas

Buenas tardes amigos

He realizado un proyecto con arduino uno y cayenne , en donde he configurado cuatro datos tipo analog en el dashboard pero al revisar el grafico chart o curvas historicas(trend) solo se registra uno, mas no los demas … como se puede configurar el chart a los demas datos.

gracias

can you share the code you are using.

buenos días este es el código

#include<ModbusMaster.h>
#include<CayenneMQTTEthernet.h>

char username = “aa3b8080-a99c-11ea-93bf-d33a96695544”;
char password = “071871dc4273146c6038f8f147db4ab76122c73e”;
char clientID = “606c2fc0-b970-11ea-a67f-15e30d90bbf4”;
//Definicion de pines virtuales y fisico para cayenne

#define VIRTUAL_CHANNEL_13 13
#define VIRTUAL_CHANNEL_14 14
#define VIRTUAL_CHANNEL_15 15
#define ACTUATOR_PINN 5 // Do not use digital pins 0 or 1 since those conflict with the use of Serial.

//permite habilitar y deshabilitar la comunicacion del MAX RS485
#define MAX485_DE 7 //3
#define MAX485_RE_NEG 6 //2
uint8_t j;
uint16_t data[8],mw1,result;
word Estado_PS,Estado_Auma;
float PIT01_C1,PIT02_C1,FIT01_C1,PV01_C1;
bool falla_UPS,falla_suministro,falla_valvula;

//******************************************
ModbusMaster node;

void preTransmission()
{
digitalWrite(MAX485_RE_NEG, 1);
digitalWrite(MAX485_DE, 1);
}

void postTransmission()
{
digitalWrite(MAX485_RE_NEG, 0);
digitalWrite(MAX485_DE, 0);
}

void setup()
{//----------------------configuracion for cayenne-------------

pinMode(4,OUTPUT);
pinMode(2,INPUT_PULLUP);
// attachInterrupt(0, blink, CHANGE);
//------------------------------------------
pinMode(MAX485_RE_NEG, OUTPUT);
pinMode(MAX485_DE, OUTPUT);
pinMode(8,OUTPUT);
// inicia en modo recepecion
digitalWrite(MAX485_RE_NEG, 0);
digitalWrite(MAX485_DE, 0);
//velocidad de comunicacion serial modbus
Serial.begin(9600);

// esclavo modbus 4
node.begin(4, Serial);
// Callbacks allow us to configure the RS485 transceiver correctly
node.preTransmission(preTransmission);
node.postTransmission(postTransmission);

pinMode(ACTUATOR_PINN, OUTPUT);

Cayenne.begin(username, password, clientID);

}
bool state = true;
bool M3;
void loop() {

// Toggle the coil at address 0x0002 (Manual Load Control)
// result = node.writeSingleCoil(0x0002, state);
// state = !state;
result = node.writeSingleCoil(0x0003, M3);

//*******************************************************
node.setTransmitBuffer(6,mw1);
result = node.writeMultipleRegisters(0,8);
// Read 16 registers starting at 0x3100)
// result = node.readInputRegisters(0x3100, 16);
result = node.readHoldingRegisters(420,8);
// result = node.readCoils(0,8);

if (result == node.ku8MBSuccess)
{
for (j = 0; j < 8; j++)
{
data[j] = node.getResponseBuffer(j);

  if(data[1]<100){
    digitalWrite(8,HIGH);
  }
  else{digitalWrite(8,LOW); }
 
}

}

delay(10);
PIT01_C1=data[0]/100.0;
PIT02_C1=data[1]/100.0;
FIT01_C1=data[2]/10.0;
PV01_C1=data[3]/100.0;
Estado_PS=data[4];
Estado_Auma=data[5];

if(bitRead(Estado_PS,0)==1){
falla_suministro=true;}
else{falla_suministro=false;}

if(bitRead(Estado_PS,1)==1){
falla_UPS=true;}
else
{falla_UPS=false;}

if(bitRead(Estado_Auma ,15)==1){
falla_valvula=true;}
else
{falla_valvula=false;}

// PV03_A=data[6]/100.0;
// PV04_B=data[7]/100.0;
Cayenne.loop();
}

CAYENNE_IN(VIRTUAL_CHANNEL_13)
{
int value = getValue.asInt();
CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL2, ACTUATOR_PINN, value);

// Write the value received to the digital pin.
digitalWrite(ACTUATOR_PINN, value);

}
//CAYENNE_IN(VIRTUAL_CHANNEL_14)
//{
//
// CAYENNE_LOG(“Got a value: %s”, getValue.asInt());
// mw1=getValue.asInt();

//}
CAYENNE_IN(VIRTUAL_CHANNEL_15)
{

CAYENNE_LOG(“Got a value: %s”, getValue.asInt());
M3=getValue.asInt();

}

//Salidas de modulo arduino to cayenne

CAYENNE_OUT(9)
{
CAYENNE_LOG(“Send data for Virtual Channel 9”);
// This command writes the device’s uptime in seconds to the Virtual Channel.
Cayenne.virtualWrite(9, millis());
}
CAYENNE_OUT(0)
{
CAYENNE_LOG(“Send data for Virtual Channel 0”);

Cayenne.virtualWrite(0, PIT01_C1);
}
CAYENNE_OUT(1)
{
CAYENNE_LOG(“Send data for Virtual Channel 1”);

Cayenne.virtualWrite(1,PIT02_C1);
}
CAYENNE_OUT(2)
{
CAYENNE_LOG(“Send data for Virtual Channel 2”);

Cayenne.virtualWrite(2,FIT01_C1);
}
CAYENNE_OUT(3)
{
CAYENNE_LOG(“Send data for Virtual Channel 3”);

Cayenne.virtualWrite(3,PV01_C1);
}
CAYENNE_OUT(4)
{
CAYENNE_LOG(“Send data for Virtual Channel 2”);

Cayenne.virtualWrite(4,falla_suministro);
}
CAYENNE_OUT(5)
{
CAYENNE_LOG(“Send data for Virtual Channel 2”);

Cayenne.virtualWrite(5,falla_UPS);
}

//CAYENNE_OUT(VIRTUAL_CHANNEL)
//{
// // Read data from the sensor and send it to the virtual channel here.
// // For example, to send a digital value you can use the following:
// int value = digitalRead(SENSOR_PIN);
// Cayenne.virtualWrite(VIRTUAL_CHANNEL, value, TYPE_DIGITAL_SENSOR, UNIT_DIGITAL);

CAYENNE_OUT(6)
{
CAYENNE_LOG(“Send data for Virtual Channel 2”);

Cayenne.virtualWrite(6,falla_valvula);

}

you need to use correct data types Data types for Cayenne MQTT API

example:-

Cayenne.virtualWrite(0, PIT01_C1, "analog_sensor", "null" );

you will need to remove the previously added widget from the cayenne dashboard and let it re-add on the next publish.

gracias por la ayuda…

Tengo unas dudas con referencia a la plataforma cayenne
1.- Cuantos dispositivos(board arduino o raspberry)puedo conectar por al dashboard por usuario .?

2.- el chart (trend) cuanto tiempo puede guardar los históricos de los datos , hay límites ?
3.-Al usar arduino o raspberry se tiene que pagar por alguna licencia , lo puedo usar en mi empresa a modo de proyecto la aplicación es para monitorear el nivel de un reservorio.

4.- hay términos de uso

gracias por la ayuda

there is no particular limit to the number of device you can add to cayenne.

the chart can view and store data for only one month.

Cayenne is free to use.
if your project is something that requires more reliability and secures you need to check the cayenne sister platform https://mydevices.com/