Problem with 2.1.1

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
schmidmi
Posts: 55
Joined: 01 Dec 2016 16:45
Location: Germany (Karlsruhe)

Problem with 2.1.1

Post by schmidmi »

I did a upgrade of the Adruino IDE to 1.8.5. Then I installed the Z-UNO 2.1.1 board and made an upgrade for the bootloader on the Z-UNO.
All these steps worked fine.

Then I made a download of my sketch wich was running fine with Arduino 1.6.5 and Z_UNO 2.0.9.
After about 2 cycles Z-UNO stops working and the red LED is switched on.
During the upload of the sketch I get the following info:


RAW Info:
AA AA BB BB 01 15 01 10
00 01 02 0B A0 0A 82 B2
02 7F C6 70 6B 7F FF 7F
F1 01 15 02 0B 33 C2 01
08 16 12 FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF
FF FF FF 1A 10 05 E6 02
C8 01 DC 00 01
----------------------------------------------------------
FIRMWARE DATA
----------------------------------------------------------
REVISION:02.11
Z-WAVE FREQUENCY:EU
ORIGINAL FW. CRC32: A0 0A 82 B2
CURRENT FW. CRC16: 33 C2
RADIO CHANNELS: 02
----------------------------------------------------------
HARDWARE DATA
----------------------------------------------------------
CALIBRATION
MAIN:08 TX: 16 12
DEVICE PUBLIC KEY:
HEX: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
DEC: 65535-65535-65535-65535-65535-65535-65535-65535-65535-65535-65535-65535-65535-65535-65535-65535
----------------------------------------------------------
PRODUCTION DATA
----------------------------------------------------------
YOUR ZUNO S/N: 1A 10 05 E6 02 C8 01 00 01
----------------------------------------------------------
PRODUCTION TIME:
WEEK:26 YEAR:2016
WORKSTATION:
NUMBER:1 SEQUENCE:712
HARDWARE:
CHIP:1510 REVISION:1
----------------------------------------------------------
There is also no connection to my HC2 anymore...

Urgent help needed!
Thanks.

Code: Select all

// Z-UNO used to connect a Mitsubishi A/C controller to Fibaro HC 2
// It provides the actual temperature and an ON/OFF switch.
// The device can be operated via HC 2 or with a local push button.
// Due to the small amount of ram, it was not possible to implement a connection to 
// the A/C controller via IR within this device.
// So the task of sending the 288 Bit IR codes is done by an additional Arduino device.
// The Z-UNO provides an binary output to talk to the Arduino.
// September 2017
// by Michael Schmidt

#include <ZUNO_DS18B20.h>
#include <ZUNO_OLED_I2C.h>
#include <EEPROM.h>


// pin connection ds18b20
#define PIN_DS18B20 11

// Shows the state of the device
#define LED_PIN 13

// Output to control the Arduino
#define ControlPin 6

// Input for the local On/Off button
#define SWITCH_LOCAL 18

// local push button handled with ISR
ZUNO_SETUP_ISR_INT0(int0_handler);
// suppression of chatter for the push button
ZUNO_SETUP_ISR_GPTIMER(gpt_handler);

OneWire ow(PIN_DS18B20);

// local Display for temperature an state
OLED oled;
// onewire connection temperature sensors
DS18B20Sensor ds1820(&ow); 

byte addr1[8];
int temp = 0;           // here we will store the actual temperature
int lastTemp = 0;           // temperature during the last scan cycle
byte currentLEDValue;   // Last saved LED value
float temperature;
bool buttonLock = false; // flag to void chattering of the push button
// 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_SWITCH_BINARY(getSWBin,setSWBIN)
);

void setup() {

    pinMode(LED_PIN, OUTPUT);
    pinMode(SWITCH_LOCAL,INPUT_PULLUP);
    zunoExtIntMode(ZUNO_EXT_INT0, FALLING);

    pinMode(ControlPin, OUTPUT); 
    digitalWrite(ControlPin, LOW); 
  
    oled.begin();
    oled.clrscr();
      

    // Get the last state before shut down
//    EEPROM.get(0,&currentLEDValue,1);
    
    setSWBIN(currentLEDValue);
    oled.gotoXY(0,5);
    oled.print("Status    : ");
    if (currentLEDValue == 0)
    {
      oled.print("Aus");
    }
    else
    {
      oled.print("Ein");
    }
    oled.gotoXY(0,2);
    oled.print("Temperatur:       *C");

    zunoGPTInit(ZUNO_GPT_SCALE1024);  
    zunoGPTSet(30000); 
}

void loop() {
    ds1820.scanAloneSensor(addr1);
    // obtaining readings from the sensor ds18b20
    temperature = ds1820.getTemperature(addr1);
    // make scaled word value for report
    temp=int((temperature*100));
    // send data to channel
    // data will be send in case of a change of value only
    if (abs(temp - lastTemp) >= 5)
    {
      //zunoSendReport(1);
      lastTemp = temp; // store the actual value for the next compare
      oled.gotoXY(72,2);
      //oled.print(temperature); // This will cause the Z-UNO to block

      // Some nasty lines of code to avoid blocking
      // The float value for the temperature is converted into 2 integers
      // to write them to the OLED display
      int temp4Display = ((highByte(temp) * 256 ) + lowByte(temp));
      int temp4DisplayH = temp4Display / 100;
      int temp4DisplayL = temp4Display - (temp4DisplayH * 100); 
      oled.print(temp4DisplayH);
      oled.print(",");
      oled.print(temp4DisplayL);
      zunoSendReport(1);
    }
    delay(30000);
}

// methode to update the state of the device
void setSWBIN(byte value) {
  // value is a variable, holding a "new value"
  // which came from the controller or other Z-Wave device
  if (value > 0) {               // if greater then zero
    digitalWrite (LED_PIN, HIGH); //turn the LED on (HIGH is the voltage level)
  } else {                         // if equals zero
    digitalWrite(LED_PIN, LOW);   //turn the LED off by making the voltage LOW
  }
  // we'll save our value for the situation, when the controller will ask us about it
  if (currentLEDValue != value)
  {
    currentLEDValue = value;

    // Store the actual state in EEProm
//    EEPROM.put(0,&currentLEDValue,1);

    // Update HC 2
    zunoSendReport(2);

    // Update local display
    oled.gotoXY(0,5);
    oled.print("Status    : ");
    
    if (currentLEDValue == 0)
    {
      oled.print("Aus");
    }
    else
    {
      oled.print("Ein");
    }
  }
  
}

// Interrupt handler to read the local push button
void int0_handler()
{
  if (buttonLock)
  {
    return;
  }
  buttonLock = true; // disable the push button
  zunoGPTEnable(1);
  if (currentLEDValue == 0)
  {
    setSWBIN(255);
  }
  else
  {
    setSWBIN(0);
  }
  
}

// Enable the push button after a certain time
void gpt_handler() {
    zunoGPTSet(30000);
    buttonLock = false;
}


// Binary value read by HC2
byte getSWBin() {
  return currentLEDValue;
}

// Temperature read by HC2
word getterTemp() {
    return temp;
}
schmidmi
Posts: 55
Joined: 01 Dec 2016 16:45
Location: Germany (Karlsruhe)

Re: Problem with 2.1.1

Post by schmidmi »

I made some further investigations.
When not using my DS18B20 the sketch is not blocked anymore but still no connection to my HC2.
Do i have to exclude and include the device in my HC2?
schmidmi
Posts: 55
Joined: 01 Dec 2016 16:45
Location: Germany (Karlsruhe)

Re: Problem with 2.1.1

Post by schmidmi »

After several retries of uploading the firmware and sketch, no it works fine. But I had to exclude and include the device in my HC 2.
Problem solved!
petergebruers
Posts: 255
Joined: 26 Jul 2015 17:29

Re: Problem with 2.1.1

Post by petergebruers »

Thank you for reporting this. I have been changing the sketch on my Z-Uno a lot lately, but I have not yet seen such a behavior. I'll keep an eye on it!
Post Reply