Garage Door opener



  • When load the arduino software this is the serial monitor
    I have a gateway, a motion detector, and a temperature monitor all on a vera 3 with ui7
    My garage door opener uses a 5:10 modified window control jason.
    My motion control is node 2
    My temperature is node 6
    when the temperatue node updates the garage door arduino sees it as node 200 and starts to really screw up.
    This node shuts down and will not function all other nodes work fine.
    Plese help!

    Here is the serial monitor from arduino
    Started sensor.
    Sending: from=5, to=255, childId=255, mtype=4, type=9, crc=235, '', sent via 255
    Sent successfully
    Received: from=0, to=5, childId=255, mtype=4, type=10, crc=51, '0'
    Mess crc ok.
    Message addressed for this node.
    Using relay 0. Distance is 0
    Relay=0, distance=1
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=255, mtype=0, type=17, crc=94, '1.2+', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=255, mtype=4, type=7, crc=100, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=0, type=3, crc=8, '1.2+', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=2, type=2, crc=69, '', sent via 0
    Sent successfully
    Received: from=0, to=5, childId=10, mtype=3, type=2, crc=152, '0
    '
    Mess crc ok.
    Message addressed for this node.
    Received: from=0, to=5, childId=10, mtype=1, type=3, crc=235, '100
    '
    Mess crc ok.
    Message addressed for this node.
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=150, '100
    ', sent via 0
    Sent successfully
    100
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=245, '1', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    0
    1
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=2, type=3, crc=163, '', sent via 0
    Sent successfully
    Received: from=0, to=5, childId=10, mtype=3, type=3, crc=126, '0
    '
    Mess crc ok.
    Message addressed for this node.
    0
    1
    1
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    Received: from=0, to=5, childId=10, mtype=1, type=3, crc=235, '26
    '
    Mess crc ok.
    Message addressed for this node.
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=150, '26
    ', sent via 0
    Sent successfully
    26
    0
    0
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=138, '100', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=2, type=3, crc=163, '', sent via 0
    Sent successfully
    Received: from=0, to=5, childId=10, mtype=3, type=3, crc=61, '100
    '
    Mess crc ok.
    Message addressed for this node.
    100
    0
    0
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=138, '100', sent via 0
    Sent successfully
    Received: from=0, to=5, childId=10, mtype=1, type=3, crc=103, '82
    '
    Mess crc ok.
    Message addressed for this node.
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=26, '82
    ', sent via 0
    Sent successfully
    82
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=245, '1', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    0
    1
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=2, type=3, crc=163, '', sent via 0
    Sent successfully
    Received: from=0, to=5, childId=10, mtype=3, type=3, crc=126, '0
    '
    Mess crc ok.
    Message addressed for this node.
    0
    1
    1
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=0, to=5, childId=10, mtype=1, type=3, crc=30, '20
    '
    Mess crc ok.
    Message addressed for this node.
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=99, '20
    ', sent via 0
    Sent successfully
    20
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=245, '1', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    0
    1
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=2, type=3, crc=163, '', sent via 0
    Sent successfully
    Received: from=0, to=5, childId=10, mtype=3, type=3, crc=126, '0
    '
    Mess crc ok.
    Message addressed for this node.
    0
    1
    1
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=2, crc=146, '0', sent via 0
    Sent successfully
    Relaying message back to gateway.
    Sending: from=5, to=0, childId=10, mtype=1, type=3, crc=116, '0', sent via 0
    Sent successfully
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=13, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=169, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=201, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=137, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=137, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=137, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=137, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=137, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=137, '

    '
    Mess crc error.
    Received: from=208, to=208, childId=208, mtype=0, type=13, crc=137, '

    '
    Mess crc error.
    Received: from=2, to=64, childId=16, mtype=1, type=16, crc=44, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'
    Mess crc error.
    Received: from=19, to=19, childId=19, mtype=3, type=49, crc=49, '1'

    Here is the Arduino code:
    #include <Sensor.h>
    #include <SPI.h>
    #include <EEPROM.h>
    #include <Servo.h>
    #include <RF24.h>

    #define SERVO_DIGITAL_OUT_PIN 3
    //#define SERVO_MIN 1 // Fine tune your servos min. 0-180
    //#define SERVO_MAX 0 // Fine tune your servos max. 0-180
    int pulsePin = 8;
    int openDoor = 4;
    int doorV =0 ;
    int lastDoorValue = 0;
    int closed =1;
    // Set RADIO_ID to something unique in your sensor network (1-254)
    // or set to AUTO if you want gw to assign a RADIO_ID for you.
    #define RADIO_ID 5
    #define CHILD_ID 10 // Id of the sensor child
    Sensor gw(9,10);
    //Servo myservo; // create servo object to control a servo
    // a maximum of eight servo objects can be created Sensor gw(9,10);

    void setup()
    {
    Serial.begin(BAUD_RATE);
    gw.begin(RADIO_ID);
    // myservo.attach(SERVO_DIGITAL_OUT_PIN);
    // Register all sensors to gw (they will be created as child devices)
    gw.sendSensorPresentation(CHILD_ID, S_LIGHT);
    // Fetch servo state at startup
    gw.getStatus(CHILD_ID, V_LIGHT);
    setRelayStatus(gw.getMessage()); // Wait here until status message arrive from gw
    pinMode(openDoor,INPUT);
    pinMode(pulsePin,OUTPUT);
    //gw.sendVariable(CHILD_ID,I_BATTERY_LEVEL );
    //setRelayStatus(gw.getMessage());

    }

    void loop()
    {

    if (gw.messageAvailable()) {
      // New messsage from gw
      message_s message = gw.getMessage(); 
      setRelayStatus(message);
     gw.getStatus(CHILD_ID, V_DIMMER);
     setRelayStatus(gw.getMessage());
     doorV=digitalRead(openDoor);
    

    if (lastDoorValue != doorV) checkStatus();
    // Serial.println(lastDoorValue);
    //Serial.println(doorV);
    //Serial.println( readVcc(), DEC );
    }
    }
    void setRelayStatus(message_s message) {
    if (message.header.type==V_DIMMER) { // This could be M_ACK_VARIABLE or M_SET_VARIABLE
    int val = atoi(message.data);
    Serial.println(val);
    if (val > 0){
    doorUp();
    delay (750);
    checkStatus();

     }
     if (val == 0){
        doorDown();
        delay (750);
        checkStatus();
        
     }
    

    }

    if (message.header.type==V_UP){
      doorUp();
      delay (750);
      checkStatus();
    }
     if (message.header.type==V_DOWN) {
      doorDown();
      delay (750);
      checkStatus();
    }
     if (message.header.type==V_STOP) {
      doorStop();
      delay (750);
     checkStatus();
    }
    

    }

    void doorUp(){
    doorV=digitalRead(openDoor);
    if (doorV == 1){
    digitalWrite(pulsePin, HIGH);
    delay (750);
    digitalWrite(pulsePin, LOW);
    gw.sendVariable(CHILD_ID, V_LIGHT, 1);
    // myservo.write(SERVO_MIN);
    gw.sendVariable(CHILD_ID, V_DIMMER,0);
    }
    delay (750);
    lastDoorValue=0;

    }
    void doorDown(){
    doorV=digitalRead(openDoor);
    if (doorV == 0){
    digitalWrite(pulsePin, HIGH);
    delay (750);
    digitalWrite(pulsePin, LOW);
    gw.sendVariable(CHILD_ID, V_LIGHT, 0);
    //myservo.write(SERVO_MAX);
    gw.sendVariable(CHILD_ID, V_DIMMER,100);
    }
    delay (750);
    lastDoorValue=1;

    }

    void doorStop(){
    digitalWrite(pulsePin, HIGH);
    delay (750);
    digitalWrite(pulsePin, LOW);
    delay (750);
    }
    void checkStatus(){
    doorV=digitalRead(openDoor);
    Serial.println(lastDoorValue);
    Serial.println(doorV);
    if (doorV == 0){
    gw.sendVariable(CHILD_ID, V_LIGHT, 0);
    // myservo.write(SERVO_MAX);
    gw.sendVariable(CHILD_ID, V_DIMMER, 100);
    lastDoorValue=0 ;
    }
    if (doorV == 1){
    gw.sendVariable(CHILD_ID, V_LIGHT, 0);
    // myservo.write(SERVO_MIN);
    gw.sendVariable(CHILD_ID, V_DIMMER, 0);
    lastDoorValue=1;
    }
    }



  • Never mind I updated to 1.4 and tweaked the code all is working fine.


  • Admin

    This post is deleted!


Suggested Topics

11
Online

11.4k
Users

11.1k
Topics

112.7k
Posts