Need some help about Z-Uno

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
Gbajolet
Posts: 12
Joined: 29 Apr 2020 13:14

Need some help about Z-Uno

Post by Gbajolet »

Dear All,

I have a project with tank and temperature level and also letter water meter and fountain flow adjustment. Now I am testing step by step ans I am using the program as example or project. My domotc box is EEdomus from connected object and the Z-Uno is referenced as compatible.

But: I tested the program with several temperature sensors (2 for me) and it is OK
I also tested the HC-SR04 program call: "Pellet bunker temperature and fulfillment level " and it is OK too

I joinned both programs and I recheck several time line per line, the hardware side was alredy rechecked and I didn't find my problem.
When I add some serial print command, everything seems OK but with the BOX, the temperature 1 and 2 are ok but the volume no. I spent hours to find my mistake without success. Could you help?

I join the code
Thank you by advance

Gilles

Code: Select all

// 2 temperature sensors DS18B20, 1 ultrasonic distance sensor HC-SR04

#include "ZUNO_DS18B20.h"

#define DS18B20_BUS_PIN 11                  // Pin to which DS18B20 bus is connected
#define N_SENSOR 2                          // Number of DS18B20 sensors

OneWire ow(DS18B20_BUS_PIN);
DS18B20Sensor ds18b20(&ow);

#define ADDR_SIZE 8                         // Size of address of devices on 1-wire bus
byte addresses[ADDR_SIZE * N_SENSOR];       // Here we store all the scanned addresses
#define ADDR(i) (&addresses[i * ADDR_SIZE]) // Macro to simplify our life
byte number_of_sensors;                     // Number of sensors found
word temperature[N_SENSOR];                 // Here we store temperatures

// Define Z-Wave channels. Add more if you need more sensors

ZUNO_SETUP_CHANNELS(
        ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_TWO_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS, getterTemp1),
        ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_TEMPERATURE, SENSOR_MULTILEVEL_SCALE_CELSIUS, SENSOR_MULTILEVEL_SIZE_TWO_BYTES, SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS, getterTemp2),
         
  //ultrasonic sensor        
        ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_GENERAL_PURPOSE_VALUE,4,SENSOR_MULTILEVEL_SIZE_TWO_BYTES,0,getterVol)  
);

ZUNO_SETUP_ASSOCIATIONS(ZUNO_ASSOCIATION_GROUP_SET_VALUE); // to control other devices

int readPin = 9;
int triggerPin = 10;
byte controlState = 0;
dword distance;
dword hauteur_eau;
dword distance_capteur;
dword distance_max;
dword volume;

void setup() {
  Serial.begin();
  number_of_sensors = ds18b20.findAllSensors(addresses);
  pinMode(readPin, INPUT);
  pinMode(triggerPin, OUTPUT);
  digitalWrite(triggerPin, LOW);
  distance_capteur=30;
  distance_max=230;
}

void loop() {
   
   int tmp;

  // trigger measurement
  digitalWrite(triggerPin, LOW);
  delayMicroseconds(10);
  digitalWrite(triggerPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin, LOW);

  // read pulse width
  tmp = pulseIn(readPin, HIGH, 100000);
Serial.println("tmp");
Serial.println(tmp);
    distance = tmp / 58; // convert to cm, see datasheet
   
    Serial.println(distance);
  
 hauteur_eau =(distance_max-distance);
  Serial.println(hauteur_eau);

  volume = (hauteur_eau *45);
   Serial.println(volume);
   Serial.println(temperature[0]);
   Serial.println(temperature[1]);

  for (byte i = 0; i < number_of_sensors; i++) {
    // Read temperature 
    // It already encoded for format VVV.vv and doesn't use float
    temperature[i] = ds18b20.getTempC100(ADDR(i));
  }
 
  // Report all the sensors at the end of the loop
  for(byte i = 0; i < 5; i++){
    zunoSendReport(i+1);
  }
  delay(1000);
}

// Getters. Add more if you need more sensors

 
word getterTemp1() {
  return temperature[0];
}

word getterTemp2() {
  return temperature[1];
}

dword getterVol() {
  return volume;
}
Gbajolet
Posts: 12
Joined: 29 Apr 2020 13:14

Re: Need some help about Z-Uno

Post by Gbajolet »

Additionnal information :"When I add some serial print command, everything seems OK" it is wrong , the "tmp" isn't measured.

Gilles
michap
Posts: 437
Joined: 26 Mar 2013 10:35
Contact:

Re: Need some help about Z-Uno

Post by michap »

Hi,
the first I see is that you have 3 sensors (2x temp + 1x level)

but you use:

Code: Select all

  // Report all the sensors at the end of the loop
  for(byte i = 0; i < 5; i++){
    zunoSendReport(i+1);
  }
should be

Code: Select all

  // Report all the sensors at the end of the loop
  for(byte i = 0; i < 3; i++){
    zunoSendReport(i+1);
  }
why the level (tmp) will not be printed out, do not see in this time - it is really working without temperature part?

Michael
Gbajolet
Posts: 12
Joined: 29 Apr 2020 13:14

Re: Need some help about Z-Uno

Post by Gbajolet »

Hello, thank you for your help.
Finally I found the problem: I add one temperature sensor: 3 + 1 distance sensor and after integration on the Box I had 4 widgets : 2 temp and 1 volume and 1 for nothing, I hide the last one and everything is ok, it seems that the problem is coming from the box

Gilles
Post Reply