Results 1 to 5 of 5

Thread: Relay random release problem

  1. #1
    Join Date
    Feb 2019
    Location
    Provins France
    Posts
    10
    Post Thanks / Like

    Default Relay random release problem

    Hello everyone, I allow myself to ask for help by this post because I can not find the solution to my problem. I use the latest version of vixen coupled with multiple arduino Mega, Uno and Nano. Some pixel controls and other relays. My problem is the relays, at the beginning of the configuration everything worked properly but after unplugging and reconnecting the usb plugs of the Arduino Mega and Uno to my pc, the relays is triggered randomly ... That is to say that when my relay 1 must NORMALLY turn on window 1 of my house, well relay 1 turns on window 2 .... or 5 sometimes; and the same for all the other relays that do not turn on the right windows, while everything worked perfectly when configuring the generic exit on Vixen ... I'm heading to you to find out if anyone had already had this problem . I contact you from France and I use a translator so sorry if my spelling is not good. .I wish you a wonderful end-of-year celebration
    Code:
    #define MEGA_VIXEN
    //#define UNO_VIXEN
    
    #ifdef MEGA_VIXEN
      #define MAX_CHANNELS 52
      int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53};
    #endif
    
    #ifdef UNO_VIXEN
      #define MAX_CHANNELS 18
      int channels[MAX_CHANNELS] = {2,3,4,5,6,7,8,9,10,11,12,13,A0,A1,A2,A3,A4,A5};
    #endif
    
    int incomingByte[MAX_CHANNELS];
    
    void setup()
    {
    pinMode (10, OUTPUT);
    pinMode (38, OUTPUT);
    
      int i;  
      Serial.begin(9600); // set up Serial at 9600 bps
      for ( i = 0; i < MAX_CHANNELS; i ++ )  pinMode(channels[i], OUTPUT);
    }
    void loop(){
    
    digitalWrite (10, HIGH);
    digitalWrite (38, HIGH);
      
      int i;  
      if (Serial.available() >= MAX_CHANNELS)
      {
        for (i=0; i < MAX_CHANNELS; i ++)      incomingByte[i] = Serial.read();
      }
      //for (i = 0; i < MAX_CHANNELS; i ++ )    analogWrite(channels[i], incomingByte[i]);
      for (i = 0; i < MAX_CHANNELS; i ++ ) digitalWrite(channels[i], ~incomingByte[i]);  
    }
    51fUlHZo-aL._AC_UY218_ML3_.jpg
    Attached Images Attached Images
    Last edited by LUTIN; 11-24-2019 at 07:58 AM.

  2. #2
    Join Date
    Feb 2019
    Location
    Provins France
    Posts
    10
    Post Thanks / Like

    Default Re: Relay random release problem

    I also use this code for my UNO ...
    Code:
    /* 
    This sketch allows the Arduino to read 16 bytes of data from Vixen and turn on
    its pins accordingly, which in turn controls a solid state relay hooked up to Xmas lights.
    */
    
    // Define pins on Arduino that will control the relay.
    #define CHANNEL_01 2
    #define CHANNEL_02 3
    #define CHANNEL_03 4
    #define CHANNEL_04 5
    #define CHANNEL_05 6
    #define CHANNEL_06 7
    #define CHANNEL_07 8
    #define CHANNEL_08 9
    #define CHANNEL_09 10
    #define CHANNEL_10 11
    #define CHANNEL_11 12
    #define CHANNEL_12 13
    #define CHANNEL_13 14
    #define CHANNEL_14 15
    #define CHANNEL_15 16
    #define CHANNEL_16 17
    
    // Define size of array to hold channels
    #define CHANNEL_COUNT 16
    
    // Define array to hold channels
    int channels[] =
    {
      CHANNEL_01, CHANNEL_02, CHANNEL_03, CHANNEL_04, CHANNEL_05, CHANNEL_06, CHANNEL_07, CHANNEL_08,
      CHANNEL_09, CHANNEL_10, CHANNEL_11, CHANNEL_12, CHANNEL_13, CHANNEL_14, CHANNEL_15, CHANNEL_16
    };
    
    // Define array to hold incoming data stream from Vixen
    int incomingByte[8];
    
    // Define baud rate. This figure must match that of your profile configuration in Vixen!
    #define BAUD_RATE 9600
    
    void setup()
    {
      // Begin serial communication
      Serial.begin(BAUD_RATE);
    
      // Set up each channel as an output
      for(int i = 0; i < CHANNEL_COUNT; i++)
      {
        pinMode(channels[i], OUTPUT);
      }
    }
    
    void loop()
    { 
      if (Serial.available() >= CHANNEL_COUNT)
      {
        // Read data from Vixen, store in array
        for (int i = 0; i < CHANNEL_COUNT; i++)
        {
          incomingByte[i] = Serial.read();
        }
        // Write data from array to a pin on Arduino
        for (int i = 0; i < CHANNEL_COUNT; i++)
        {
          digitalWrite(channels[i], incomingByte[i]);
        }
        }
    }

  3. #3
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    857
    Post Thanks / Like

    Default Re: Relay random release problem

    Quote Originally Posted by LUTIN View Post
    I also use this code for my UNO ...
    Code:
    /* 
    This sketch allows the Arduino to read 16 bytes of data from Vixen and turn on
    its pins accordingly, which in turn controls a solid state relay hooked up to Xmas lights.
    */
    
    // Define pins on Arduino that will control the relay.
    #define CHANNEL_01 2
    #define CHANNEL_02 3
    #define CHANNEL_03 4
    #define CHANNEL_04 5
    #define CHANNEL_05 6
    #define CHANNEL_06 7
    #define CHANNEL_07 8
    #define CHANNEL_08 9
    #define CHANNEL_09 10
    #define CHANNEL_10 11
    #define CHANNEL_11 12
    #define CHANNEL_12 13
    #define CHANNEL_13 14
    #define CHANNEL_14 15
    #define CHANNEL_15 16
    #define CHANNEL_16 17
    
    // Define size of array to hold channels
    #define CHANNEL_COUNT 16
    
    // Define array to hold channels
    int channels[] =
    {
      CHANNEL_01, CHANNEL_02, CHANNEL_03, CHANNEL_04, CHANNEL_05, CHANNEL_06, CHANNEL_07, CHANNEL_08,
      CHANNEL_09, CHANNEL_10, CHANNEL_11, CHANNEL_12, CHANNEL_13, CHANNEL_14, CHANNEL_15, CHANNEL_16
    };
    
    // Define array to hold incoming data stream from Vixen
    int incomingByte[8];
    
    // Define baud rate. This figure must match that of your profile configuration in Vixen!
    #define BAUD_RATE 9600
    
    void setup()
    {
      // Begin serial communication
      Serial.begin(BAUD_RATE);
    
      // Set up each channel as an output
      for(int i = 0; i < CHANNEL_COUNT; i++)
      {
        pinMode(channels[i], OUTPUT);
      }
    }
    
    void loop()
    { 
      if (Serial.available() >= CHANNEL_COUNT)
      {
        // Read data from Vixen, store in array
        for (int i = 0; i < CHANNEL_COUNT; i++)
        {
          incomingByte[i] = Serial.read();
        }
        // Write data from array to a pin on Arduino
        for (int i = 0; i < CHANNEL_COUNT; i++)
        {
          if (incomingByte[i] <= 127) {
    				digitalWrite(channels[i], LOW);
    			}
    			else {
    				digitalWrite(channels[i], HIGH);
        }
        }
    }

    When not using dimming you have to test the incoming byte to see if it should be on or off. I removed one line of code and replaced with the highlighted code. The code I inserted should do that. Double check the syntax. I got the code snippet from this link - http://doityourselfchristmas.com/for...th-Random-mode
    Kevin

    2017 - Pi3 w/FPP controlling 8 ESPixelsticks driving 1250pixels and 3 Arduino MEGAS communicating with ESP-01s driving 96 channels
    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  4. #4
    Join Date
    Feb 2019
    Location
    Provins France
    Posts
    10
    Post Thanks / Like

    Default Re: Relay random release problem

    Thank you very much for your response Kev, I will try your code tomorrow and I will keep you informed : thup:

  5. #5
    Join Date
    Feb 2019
    Location
    Provins France
    Posts
    10
    Post Thanks / Like

    Default Re: Relay random release problem

    Hello Kev, I tried to enter the code in the arduino but I have an error message that appears, I reverify all my wiring and everything is well connected and paying more attention to the behavior of the relay, I I realized that the relays do not trigger in random mode but that they are actually shifted by 1 ... that is to say that the channel 1 triggers the relay 2 ... Instead of triggering the relay 1 normally and when I reinitialize the code in the arduino and I reboot ... It works but the next restart of the PC it re-bug again ...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •