Page 1 of 1

how to use wakup interval and deep sleep

Posted: 03 Oct 2016 20:22
by schleicheisen
hallo want to make a battery driven DHT22 Multisensor.
The problem is, i could not save the wakup interval and when the z-uno is in deep sleep it never wakes up.

has some one an example?

Code: Select all

#include "ZUNO_DHT.h"
DHT    dht22_sensor(11, DHT22);

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,
      getter_temperature),
  ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_RELATIVE_HUMIDITY,
      SENSOR_MULTILEVEL_SCALE_PERCENTAGE_VALUE,
      SENSOR_MULTILEVEL_SIZE_TWO_BYTES,
      SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
      getter_humidity));

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING);

void setup() {
  dht22_sensor.begin();
}
void loop() {
  zunoSendDeviceToSleep();
}

word getter_humidity() {
  dht22_sensor.read(true);
  float luftfeuchtigkeit = dht22_sensor.readHumidity() * 100;
  zunoSendReport(2);  
  return luftfeuchtigkeit;
}

word getter_temperature() {
  dht22_sensor.read(true);
  float temperatur = dht22_sensor.readTemperature() * 100;
  zunoSendReport(1);  
  return temperatur;
}

Re: how to use wakup interval and deep sleep

Posted: 04 Oct 2016 02:02
by ftrueck
Hi from Germany to Germany... :-D

As far as I understood the wakeup is toggled by the user button on the zuno OR on INT1 going low.
Seems there is no timer running triggering the wakeup.
I don't know if there is a way to wake up without external triggering of Service button or INT1

Re: how to use wakup interval and deep sleep

Posted: 04 Oct 2016 03:15
by ftrueck
Correction: The board does wake up! You have to set a wake up interval. The default is 3600 sec. The minimum interval is 240 sec. Shorter values are not accepted by the board. In zWave UI you should see last activity. In my case it showed activity every 4 minutes (240 secs).

Re: how to use wakup interval and deep sleep

Posted: 04 Oct 2016 03:51
by ftrueck
More findings: The wakeup interval can only be set in steps of 240 secs.

Here is my code which is currently running:

Code: Select all

#include "ZUNO_DHT.h"

DHT    dht22_sensor(11, DHT22);

// set up channel
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,
                          getterTemp),
  ZUNO_SENSOR_MULTILEVEL(ZUNO_SENSOR_MULTILEVEL_TYPE_RELATIVE_HUMIDITY, 
                          SENSOR_MULTILEVEL_SCALE_PERCENTAGE_VALUE, 
                          SENSOR_MULTILEVEL_SIZE_TWO_BYTES, 
                          SENSOR_MULTILEVEL_PRECISION_TWO_DECIMALS,
                          getterHumid)
);

ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING);

void setup() {
  dht22_sensor.begin();
}

void loop() {
  zunoSendReport(1);
  zunoSendReport(2);
  zunoSendDeviceToSleep();
}

word getterTemp() {
  dht22_sensor.read(true); 
  return (dht22_sensor.readTemperature() * 100);
}

word getterHumid() {
  dht22_sensor.read(true); 
  return (dht22_sensor.readHumidity() * 100);
}

Re: how to use wakup interval and deep sleep

Posted: 04 Oct 2016 21:31
by schleicheisen
Hello ftureck,

i have tested your code and also the same problem

i could not change the Interval in the expert UI and the z-uno doesn't wake up
This function sends the device to sleep.
For ZUNO_SLEEPING_MODE_SLEEPING mode Z-Uno will wake up after wakeup period (set up via Wakeup Command Class) or on INT1 going LOW or Key Scanner detects press.
For ZUNO_SLEEPING_MODE_FREQUENTLY_AWAKE mode Z-Uno will wake up on packet recieved or on INT1 going LOW or Key Scanner detects press.

Re: how to use wakup interval and deep sleep

Posted: 05 Oct 2016 01:46
by ftrueck
Use expert commands and go to wakeup section. Enter the interval (multiple of 240) in the text box. Before hitting set button you have to wakeup the zuno. For this press service button as many times quickly until the red led blinks. Then quickly hit the set button. Zuno should now stop flashing the red led and go to sleep again. Now you have to verify if you were successful. Wakeup zuno as before and hit the get button. Now click the wakeup button and check the result. If the entry interval has the correct value everything should be ok. If not, you have to repeat. There is a caveeat: In my case I was able to set the interval once. A second try with different value was not successful. I've had to do a full hardware reset (default interval = 3600). Maybe this is not necessary, but I've had to.