Page 1 of 3

Where to connect water meters outputs to z-uno shield

Posted: 24 Jul 2020 22:42
by jadlr
Hi
I bought a z-uno shield and i want to use it as a water meter. I upload the water meter example
https://z-uno.z-wave.me/examples/Water-Meter/

But i don't know where i should connect the two cables from each data meter (dry contacts output) to the z-uno shield.
Should be on an analog input but ....

I tried the configurator but there are several options and i don't have a clue where i should do the connections.
https://z-uno.z-wave.me/shield/configur ... C&pin12=NC

Please advice
Thank you

Re: Where to connect water meters outputs to z-uno shield

Posted: 26 Jul 2020 11:35
by PoltoS
As stated in the very beginning of the code, it is pin 0/1:
#define PIN_COLD 0
#define PIN_HOT 1

You can change them to any other pin in the code. Those are Z-Uno pins, so for the shield change then to other pins like A1-A4 or 8-12 as pins 0/1 are not connected on Z-Uno bornes.

Re: Where to connect water meters outputs to z-uno shield

Posted: 28 Jul 2020 15:09
by jadlr
Thank you
Using the ink bellow i cannot find the pins you suggest
https://z-uno.z-wave.me/shield/configur ... C&pin12=NC

Is there any picture that i can use in order to do the right connections?

Re: Where to connect water meters outputs to z-uno shield

Posted: 29 Jul 2020 01:07
by PoltoS
As mentioned above, those pins are not connected to the Shield, so you are suggested to change them to 8-12

Re: Where to connect water meters outputs to z-uno shield

Posted: 29 Jul 2020 19:38
by jadlr
Thank you
You know where are the pins 8,9,10,11,12 on the z-uno shield?
Is there any picture with that information?
Regards

Re: Where to connect water meters outputs to z-uno shield

Posted: 30 Jul 2020 03:21
by PoltoS

Re: Where to connect water meters outputs to z-uno shield

Posted: 23 Aug 2020 16:04
by jadlr
Thank you

I decided for now using only one water meter.

I change the following water meter example from two water meters to one
https://z-uno.z-wave.me/examples/Water-Meter/

Using your guides i configure in order to use pin 7 and changed the code accordantly

https://z-uno.z-wave.me/shield/configur ... m_3=normal

No problem compiling and add to fibaro homecenter 3.

But no change at all on Fibaro homecenter 3 objects when i simulate pulses from the water meter.
Is there any problem on the code bellow? No error messages but...


#include "EEPROM.h"

// channel number
#define ZUNO_CHANNEL_NUMBER_COLD 1

#define PIN_COLD 7

#define PIN_PULSE 13

#define EEPROM_ADDR 0x800
#define EEPROM_UPDATE_INTERVAL 120000

#define TICK_VALUE 1 // in liters

struct meter_data {
unsigned long ticks_cold;
byte crc8;
};

meter_data my_meter_data;

unsigned long last_update_millis = 0;
byte data_updated = FALSE;

#define DEBOUNCE_COUNT 3
byte cold_triggered = 0;
byte cold_debounce = DEBOUNCE_COUNT;

ZUNO_SETUP_CHANNELS(ZUNO_METER(ZUNO_METER_TYPE_WATER, METER_RESET_ENABLE, ZUNO_METER_WATER_SCALE_METERS3, METER_SIZE_FOUR_BYTES, METER_PRECISION_THREE_DECIMALS, getterCold, resetterCold));

byte my_crc8(byte * data, byte count) {
byte result = 0xDF;

while(count--) {
result ^= *data;
data++;
}
return result;
}

void update_meter_data() {
my_meter_data.crc8 = my_crc8((byte*)&my_meter_data, sizeof(meter_data) - 1);
EEPROM.put(EEPROM_ADDR, &my_meter_data, sizeof(meter_data));
}

void setup() {
// Dry contacts of meters connect to these pins
pinMode(PIN_COLD, INPUT_PULLUP);


// Get last meter values from EEPROM
EEPROM.get(EEPROM_ADDR, &my_meter_data, sizeof(meter_data));

// Check data
if (my_crc8((byte*)&my_meter_data, sizeof(meter_data) - 1) != my_meter_data.crc8) {
// Invalid data - reset all
my_meter_data.ticks_cold = 0;
update_meter_data();
}
}

void loop() {
if (!digitalRead(PIN_COLD)) {
if (!cold_triggered) {
cold_debounce--;
if (!cold_debounce) {
my_meter_data.ticks_cold++;
data_updated = true;
cold_triggered = true;
zunoSendReport(ZUNO_CHANNEL_NUMBER_COLD);
}
}
} else {
cold_debounce = DEBOUNCE_COUNT;
cold_triggered = false;
}

// To save EEPROM from a lot of r/w operation
// write it once in EEPROM_UPDATE_INTERVAL if data was updated
if (data_updated && (millis() - last_update_millis) > EEPROM_UPDATE_INTERVAL) {
update_meter_data();
data_updated = false;
last_update_millis = millis();
}
delay(100);
}

void resetterCold(byte v) {
my_meter_data.ticks_cold = 0;
update_meter_data();
}



unsigned long getterCold(void) {
return my_meter_data.ticks_cold * TICK_VALUE;
}

Re: Where to connect water meters outputs to z-uno shield

Posted: 25 Aug 2020 00:46
by PoltoS
Make sure to use Multichannel association in Fibaro (to #1:0)

Re: Where to connect water meters outputs to z-uno shield

Posted: 09 Sep 2020 18:58
by jadlr
Hi

How can i do it on homecenter 3?

Thank you

Re: Where to connect water meters outputs to z-uno shield

Posted: 10 Sep 2020 00:26
by PoltoS
No idea ;( Haven't tried it yet