Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Mega 2560- 32 channel Vixen Help!

  1. #1
    Join Date
    Sep 2016
    Posts
    12
    Post Thanks / Like

    Default Mega 2560- 32 channel Vixen Help!

    I am new here so pardon my stupidity, before I get ripped up for what I hope is a quick fix I have been searching and working on tis for two days,

    The Problem: I want my lights / relays to be off until vixen turns them on. current status is on and vixen turns them off

    Build info: Mega 2560 using outputs 22 to 53
    4 banks of 8 solid state relays
    ( Just looking for on/off so should be fine )

    The code
    after testing a lot of codes this one seams to work minus flipping on to off

    Code
    /************************************************** ************************************************** *********
    * This code was put together to run Arduino Mega 2650 with Vixen 3
    * Connect Arduino to PC via USB
    *
    * David (DaVaR) Sargent
    * http://www.village4christmas.com/
    * http://www.christmaslighthunt.com/
    *
    * Special Thanks to the following people who guided me to build this code.
    *
    * -Scott Shaver @
    * http://doityourselfchristmas.com/for...el-Relay-Board
    *
    * -wirenut1980@
    * http://www.instructables.com/id/Ardu...-arduino-code/
    *
    * NOTE * The PWM values that need to be sent to the relay board are reversed from the
    * values comming in from Vixen. Vixen 0-255 (off-on), Relays 255-0 (off-on)
    ************************************************** ************************************************** *********/

    // Define which pins control which channels with Vixen 3 and Arduino Mega
    #define CHAN01 22
    #define CHAN02 23
    #define CHAN03 24
    #define CHAN04 25
    #define CHAN05 26
    #define CHAN06 27
    #define CHAN07 28
    #define CHAN08 29
    #define CHAN09 30
    #define CHAN10 31
    #define CHAN11 32
    #define CHAN12 33
    #define CHAN13 34
    #define CHAN14 35
    #define CHAN15 36
    #define CHAN16 37
    #define CHAN17 38
    #define CHAN18 39
    #define CHAN19 40
    #define CHAN20 41
    #define CHAN21 42
    #define CHAN22 43
    #define CHAN23 44
    #define CHAN24 45
    #define CHAN25 46
    #define CHAN26 47
    #define CHAN27 48
    #define CHAN28 49
    #define CHAN29 50
    #define CHAN30 51
    #define CHAN31 52
    #define CHAN32 53

    int channels[] = {CHAN01,CHAN02,CHAN03,CHAN04,CHAN05,CHAN06,CHAN07, CHAN08,CHAN09,
    CHAN10,CHAN11,CHAN12,CHAN13,CHAN14,CHAN15,CHAN16,C HAN17,CHAN18,CHAN19,CHAN20,
    CHAN21,CHAN22,CHAN23,CHAN24,CHAN25,CHAN26,CHAN27,C HAN28,CHAN29,CHAN30,CHAN31,CHAN32};



    // Total Channel Count
    #define CHANNEL_COUNT 32

    // Serial Speed
    #define PC_COM_SPEED 9600


    int i = 0;
    int incomingByte[CHANNEL_COUNT];

    void setup()
    {
    Serial.begin(PC_COM_SPEED);

    // Set the channel pins to output mode
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    pinMode(channels[channelIndex],OUTPUT);
    }

    powerOnSelfTest();
    }


    void loop()
    {
    if (Serial.available() >= CHANNEL_COUNT)
    {
    for (int i=0; i<CHANNEL_COUNT; i++)
    {
    incomingByte[i] = Serial.read();
    }
    digitalWrite(CHAN01, incomingByte[0]);
    digitalWrite(CHAN02, incomingByte[1]);
    digitalWrite(CHAN03, incomingByte[2]);
    digitalWrite(CHAN04, incomingByte[3]);
    digitalWrite(CHAN05, incomingByte[4]);
    digitalWrite(CHAN06, incomingByte[5]);
    digitalWrite(CHAN07, incomingByte[6]);
    digitalWrite(CHAN08, incomingByte[7]);
    digitalWrite(CHAN09, incomingByte[8]);
    digitalWrite(CHAN10, incomingByte[9]);
    digitalWrite(CHAN11, incomingByte[10]);
    digitalWrite(CHAN12, incomingByte[11]);
    digitalWrite(CHAN13, incomingByte[12]);
    digitalWrite(CHAN14, incomingByte[13]);
    digitalWrite(CHAN15, incomingByte[14]);
    digitalWrite(CHAN16, incomingByte[15]);
    digitalWrite(CHAN17, incomingByte[16]);
    digitalWrite(CHAN18, incomingByte[17]);
    digitalWrite(CHAN19, incomingByte[18]);
    digitalWrite(CHAN20, incomingByte[19]);
    digitalWrite(CHAN21, incomingByte[20]);
    digitalWrite(CHAN22, incomingByte[21]);
    digitalWrite(CHAN23, incomingByte[22]);
    digitalWrite(CHAN24, incomingByte[23]);
    digitalWrite(CHAN25, incomingByte[24]);
    digitalWrite(CHAN26, incomingByte[25]);
    digitalWrite(CHAN27, incomingByte[26]);
    digitalWrite(CHAN28, incomingByte[27]);
    digitalWrite(CHAN29, incomingByte[28]);
    digitalWrite(CHAN30, incomingByte[29]);
    digitalWrite(CHAN31, incomingByte[30]);
    digitalWrite(CHAN32, incomingByte[31]);
    }
    }


    void powerOnSelfTest()
    {
    Serial.println("Power on self test running.");
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    Serial.print("Channel: ");
    Serial.println(channelIndex+1,DEC);
    analogWrite(channels[channelIndex], 255); // Turn ON relays one channel at a time
    delay(100); // Wait .1 seconds
    analogWrite(channels[channelIndex], 0);
    }

    turnAllLightsOn();
    delay(1000);
    turnAllLightsOff();
    delay(1000);
    turnAllLightsOn();
    delay(2000);
    turnAllLightsOff();
    }

    void turnAllLightsOn()
    {
    // Turn all Channels ON
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    analogWrite(channels[channelIndex], 255);
    }
    }

    void turnAllLightsOff()
    {
    // Turn all Channels OFF
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    analogWrite(channels[channelIndex], 0);
    }
    }

  2. #2
    Join Date
    Sep 2016
    Posts
    12
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    update:
    I removed

    delay(2000);
    turnAllLightsOff();
    }

    now every thing is in the off position until I start vixen. then it goes back to always on.


    moved some values from 0 to 255 and 255 to 0 but new and don't new what I am doing!
    Last edited by phil_one; 08-23-2019 at 05:03 PM.

  3. #3
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    1,051
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    If I recall correctly, Vixen outputs a steady stream of zeros when it runs. This happens even if a sequence is not playing. If your lights come on, then you have the output inverted.

    Just for information purposes, are your lights AC or DC?

    Set the "channels" in the code below to the first set of pins you use. Start the serial monitor (set to 115200). Read the screen and check the lights. When you run this test, do the lights work right? If so, a zero output is ON and a 255 is off. I think you said you were going to use on/off only. digitalWrite will work better than analogWrite.
    Code:
    int channels[] = {2,3,4,5,6,7,8,10};
    const int CHANNEL_COUNT = 8;
    const int ON  = 0;
    const int OFF = 255;
    void setup() {
      Serial.begin(115200);
      Serial.write("Setup");
      for (int ci = 0; ci < CHANNEL_COUNT; ci++) {
        pinMode(channels[ci], OUTPUT);
      }
      Serial.print("All off");
      for (int ci = 0; ci < CHANNEL_COUNT; ci++) {
        digitalWrite(channels[ci], OFF);
      }
      Serial.print("They should be off");
      delay(1000);
    }
    
    void loop() {
      for (int ci = 0; ci < CHANNEL_COUNT; ci++) {
        digitalWrite(channels[ci], ON);
        Serial.print("loop ");
        Serial.print(ci);
        Serial.print("\t");
        Serial.print(channels[ci]);
        Serial.print(" ON");
        delay(2000);
        digitalWrite(channels[ci], OFF);
        Serial.print(" OFF");
        Serial.print("\n");
      }
    }

  4. #4
    Join Date
    Nov 2018
    Location
    Houston, Texas
    Posts
    92
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    If you still need help ... I run 2 of the arduino mega 2560 with 96 Chanelís the code I use would be same for 32 channels and willing to share with you just let me know and I can send just msg me if youíd like .



    Sent from my iPhone using Tapatalk

  5. #5
    Join Date
    Nov 2018
    Location
    Houston, Texas
    Posts
    92
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    Quote Originally Posted by phil_one View Post
    I am new here so pardon my stupidity, before I get ripped up for what I hope is a quick fix I have been searching and working on tis for two days,

    The Problem: I want my lights / relays to be off until vixen turns them on. current status is on and vixen turns them off

    Build info: Mega 2560 using outputs 22 to 53
    4 banks of 8 solid state relays
    ( Just looking for on/off so should be fine )

    The code
    after testing a lot of codes this one seams to work minus flipping on to off

    Code
    /************************************************** ************************************************** *********
    * This code was put together to run Arduino Mega 2650 with Vixen 3
    * Connect Arduino to PC via USB
    *
    * David (DaVaR) Sargent
    * http://www.village4christmas.com/
    * http://www.christmaslighthunt.com/
    *
    * Special Thanks to the following people who guided me to build this code.
    *
    * -Scott Shaver @
    * http://doityourselfchristmas.com/for...el-Relay-Board
    *
    * -wirenut1980@
    * http://www.instructables.com/id/Ardu...-arduino-code/
    *
    * NOTE * The PWM values that need to be sent to the relay board are reversed from the
    * values comming in from Vixen. Vixen 0-255 (off-on), Relays 255-0 (off-on)
    ************************************************** ************************************************** *********/

    // Define which pins control which channels with Vixen 3 and Arduino Mega
    #define CHAN01 22
    #define CHAN02 23
    #define CHAN03 24
    #define CHAN04 25
    #define CHAN05 26
    #define CHAN06 27
    #define CHAN07 28
    #define CHAN08 29
    #define CHAN09 30
    #define CHAN10 31
    #define CHAN11 32
    #define CHAN12 33
    #define CHAN13 34
    #define CHAN14 35
    #define CHAN15 36
    #define CHAN16 37
    #define CHAN17 38
    #define CHAN18 39
    #define CHAN19 40
    #define CHAN20 41
    #define CHAN21 42
    #define CHAN22 43
    #define CHAN23 44
    #define CHAN24 45
    #define CHAN25 46
    #define CHAN26 47
    #define CHAN27 48
    #define CHAN28 49
    #define CHAN29 50
    #define CHAN30 51
    #define CHAN31 52
    #define CHAN32 53

    int channels[] = {CHAN01,CHAN02,CHAN03,CHAN04,CHAN05,CHAN06,CHAN07, CHAN08,CHAN09,
    CHAN10,CHAN11,CHAN12,CHAN13,CHAN14,CHAN15,CHAN16,C HAN17,CHAN18,CHAN19,CHAN20,
    CHAN21,CHAN22,CHAN23,CHAN24,CHAN25,CHAN26,CHAN27,C HAN28,CHAN29,CHAN30,CHAN31,CHAN32};



    // Total Channel Count
    #define CHANNEL_COUNT 32

    // Serial Speed
    #define PC_COM_SPEED 9600


    int i = 0;
    int incomingByte[CHANNEL_COUNT];

    void setup()
    {
    Serial.begin(PC_COM_SPEED);

    // Set the channel pins to output mode
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    pinMode(channels[channelIndex],OUTPUT);
    }

    powerOnSelfTest();
    }


    void loop()
    {
    if (Serial.available() >= CHANNEL_COUNT)
    {
    for (int i=0; i<CHANNEL_COUNT; i++)
    {
    incomingByte[i] = Serial.read();
    }
    digitalWrite(CHAN01, incomingByte[0]);
    digitalWrite(CHAN02, incomingByte[1]);
    digitalWrite(CHAN03, incomingByte[2]);
    digitalWrite(CHAN04, incomingByte[3]);
    digitalWrite(CHAN05, incomingByte[4]);
    digitalWrite(CHAN06, incomingByte[5]);
    digitalWrite(CHAN07, incomingByte[6]);
    digitalWrite(CHAN08, incomingByte[7]);
    digitalWrite(CHAN09, incomingByte[8]);
    digitalWrite(CHAN10, incomingByte[9]);
    digitalWrite(CHAN11, incomingByte[10]);
    digitalWrite(CHAN12, incomingByte[11]);
    digitalWrite(CHAN13, incomingByte[12]);
    digitalWrite(CHAN14, incomingByte[13]);
    digitalWrite(CHAN15, incomingByte[14]);
    digitalWrite(CHAN16, incomingByte[15]);
    digitalWrite(CHAN17, incomingByte[16]);
    digitalWrite(CHAN18, incomingByte[17]);
    digitalWrite(CHAN19, incomingByte[18]);
    digitalWrite(CHAN20, incomingByte[19]);
    digitalWrite(CHAN21, incomingByte[20]);
    digitalWrite(CHAN22, incomingByte[21]);
    digitalWrite(CHAN23, incomingByte[22]);
    digitalWrite(CHAN24, incomingByte[23]);
    digitalWrite(CHAN25, incomingByte[24]);
    digitalWrite(CHAN26, incomingByte[25]);
    digitalWrite(CHAN27, incomingByte[26]);
    digitalWrite(CHAN28, incomingByte[27]);
    digitalWrite(CHAN29, incomingByte[28]);
    digitalWrite(CHAN30, incomingByte[29]);
    digitalWrite(CHAN31, incomingByte[30]);
    digitalWrite(CHAN32, incomingByte[31]);
    }
    }


    void powerOnSelfTest()
    {
    Serial.println("Power on self test running.");
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    Serial.print("Channel: ");
    Serial.println(channelIndex+1,DEC);
    analogWrite(channels[channelIndex], 255); // Turn ON relays one channel at a time
    delay(100); // Wait .1 seconds
    analogWrite(channels[channelIndex], 0);
    }

    turnAllLightsOn();
    delay(1000);
    turnAllLightsOff();
    delay(1000);
    turnAllLightsOn();
    delay(2000);
    turnAllLightsOff();
    }

    void turnAllLightsOn()
    {
    // Turn all Channels ON
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    analogWrite(channels[channelIndex], 255);
    }
    }

    void turnAllLightsOff()
    {
    // Turn all Channels OFF
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    analogWrite(channels[channelIndex], 0);
    }
    }
    Ok I think you have the wrong sainsmart relays they look same but one is low level trigger and other is high level trigger the one you want is the high level trigger sainsmart relays from what I understand they work opposite.


    Sent from my iPhone using Tapatalk

  6. #6
    Join Date
    Nov 2018
    Location
    Houston, Texas
    Posts
    92
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    Quote Originally Posted by phil_one View Post
    I am new here so pardon my stupidity, before I get ripped up for what I hope is a quick fix I have been searching and working on tis for two days,

    The Problem: I want my lights / relays to be off until vixen turns them on. current status is on and vixen turns them off

    Build info: Mega 2560 using outputs 22 to 53
    4 banks of 8 solid state relays
    ( Just looking for on/off so should be fine )

    The code
    after testing a lot of codes this one seams to work minus flipping on to off

    Code
    /************************************************** ************************************************** *********
    * This code was put together to run Arduino Mega 2650 with Vixen 3
    * Connect Arduino to PC via USB
    *
    * David (DaVaR) Sargent
    * http://www.village4christmas.com/
    * http://www.christmaslighthunt.com/
    *
    * Special Thanks to the following people who guided me to build this code.
    *
    * -Scott Shaver @
    * http://doityourselfchristmas.com/for...el-Relay-Board
    *
    * -wirenut1980@
    * http://www.instructables.com/id/Ardu...-arduino-code/
    *
    * NOTE * The PWM values that need to be sent to the relay board are reversed from the
    * values comming in from Vixen. Vixen 0-255 (off-on), Relays 255-0 (off-on)
    ************************************************** ************************************************** *********/

    // Define which pins control which channels with Vixen 3 and Arduino Mega
    #define CHAN01 22
    #define CHAN02 23
    #define CHAN03 24
    #define CHAN04 25
    #define CHAN05 26
    #define CHAN06 27
    #define CHAN07 28
    #define CHAN08 29
    #define CHAN09 30
    #define CHAN10 31
    #define CHAN11 32
    #define CHAN12 33
    #define CHAN13 34
    #define CHAN14 35
    #define CHAN15 36
    #define CHAN16 37
    #define CHAN17 38
    #define CHAN18 39
    #define CHAN19 40
    #define CHAN20 41
    #define CHAN21 42
    #define CHAN22 43
    #define CHAN23 44
    #define CHAN24 45
    #define CHAN25 46
    #define CHAN26 47
    #define CHAN27 48
    #define CHAN28 49
    #define CHAN29 50
    #define CHAN30 51
    #define CHAN31 52
    #define CHAN32 53

    int channels[] = {CHAN01,CHAN02,CHAN03,CHAN04,CHAN05,CHAN06,CHAN07, CHAN08,CHAN09,
    CHAN10,CHAN11,CHAN12,CHAN13,CHAN14,CHAN15,CHAN16,C HAN17,CHAN18,CHAN19,CHAN20,
    CHAN21,CHAN22,CHAN23,CHAN24,CHAN25,CHAN26,CHAN27,C HAN28,CHAN29,CHAN30,CHAN31,CHAN32};



    // Total Channel Count
    #define CHANNEL_COUNT 32

    // Serial Speed
    #define PC_COM_SPEED 9600


    int i = 0;
    int incomingByte[CHANNEL_COUNT];

    void setup()
    {
    Serial.begin(PC_COM_SPEED);

    // Set the channel pins to output mode
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    pinMode(channels[channelIndex],OUTPUT);
    }

    powerOnSelfTest();
    }


    void loop()
    {
    if (Serial.available() >= CHANNEL_COUNT)
    {
    for (int i=0; i<CHANNEL_COUNT; i++)
    {
    incomingByte[i] = Serial.read();
    }
    digitalWrite(CHAN01, incomingByte[0]);
    digitalWrite(CHAN02, incomingByte[1]);
    digitalWrite(CHAN03, incomingByte[2]);
    digitalWrite(CHAN04, incomingByte[3]);
    digitalWrite(CHAN05, incomingByte[4]);
    digitalWrite(CHAN06, incomingByte[5]);
    digitalWrite(CHAN07, incomingByte[6]);
    digitalWrite(CHAN08, incomingByte[7]);
    digitalWrite(CHAN09, incomingByte[8]);
    digitalWrite(CHAN10, incomingByte[9]);
    digitalWrite(CHAN11, incomingByte[10]);
    digitalWrite(CHAN12, incomingByte[11]);
    digitalWrite(CHAN13, incomingByte[12]);
    digitalWrite(CHAN14, incomingByte[13]);
    digitalWrite(CHAN15, incomingByte[14]);
    digitalWrite(CHAN16, incomingByte[15]);
    digitalWrite(CHAN17, incomingByte[16]);
    digitalWrite(CHAN18, incomingByte[17]);
    digitalWrite(CHAN19, incomingByte[18]);
    digitalWrite(CHAN20, incomingByte[19]);
    digitalWrite(CHAN21, incomingByte[20]);
    digitalWrite(CHAN22, incomingByte[21]);
    digitalWrite(CHAN23, incomingByte[22]);
    digitalWrite(CHAN24, incomingByte[23]);
    digitalWrite(CHAN25, incomingByte[24]);
    digitalWrite(CHAN26, incomingByte[25]);
    digitalWrite(CHAN27, incomingByte[26]);
    digitalWrite(CHAN28, incomingByte[27]);
    digitalWrite(CHAN29, incomingByte[28]);
    digitalWrite(CHAN30, incomingByte[29]);
    digitalWrite(CHAN31, incomingByte[30]);
    digitalWrite(CHAN32, incomingByte[31]);
    }
    }


    void powerOnSelfTest()
    {
    Serial.println("Power on self test running.");
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    Serial.print("Channel: ");
    Serial.println(channelIndex+1,DEC);
    analogWrite(channels[channelIndex], 255); // Turn ON relays one channel at a time
    delay(100); // Wait .1 seconds
    analogWrite(channels[channelIndex], 0);
    }

    turnAllLightsOn();
    delay(1000);
    turnAllLightsOff();
    delay(1000);
    turnAllLightsOn();
    delay(2000);
    turnAllLightsOff();
    }

    void turnAllLightsOn()
    {
    // Turn all Channels ON
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    analogWrite(channels[channelIndex], 255);
    }
    }

    void turnAllLightsOff()
    {
    // Turn all Channels OFF
    for(int channelIndex=0;channelIndex<CHANNEL_COUNT;channelI ndex++){
    analogWrite(channels[channelIndex], 0);
    }
    }
    https://youtu.be/HQSQ5XZMHXg

    This may help


    Sent from my iPhone using Tapatalk

  7. #7
    Join Date
    Dec 2011
    Posts
    5,874
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    Also this has broken text >> CHANNEL_COUNT;channelI ndex++ @ lines >56,111,131 and 139 .

  8. #8
    Join Date
    Sep 2016
    Posts
    12
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    @willmar yes still have not got it running the way I am looking to have it run, I would love to see the code. thanks
    Last edited by phil_one; 08-27-2019 at 12:15 PM.

  9. #9
    Join Date
    Sep 2016
    Posts
    12
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    the relays are not to problem, when I Run test on older relays turn on vixen they also power up, have tired some other code that was recommended but still can not "invert" the 255-0 to 0-255 coming out of vixen.

    I am a not the best at codeing but i know haredwear and what it takes to build.

  10. #10
    Join Date
    Nov 2018
    Location
    Houston, Texas
    Posts
    92
    Post Thanks / Like

    Default Re: Mega 2560- 32 channel Vixen Help!

    Quote Originally Posted by phil_one View Post
    the relays are not to problem, when I Run test on older relays turn on vixen they also power up, have tired some other code that was recommended but still can not "invert" the 255-0 to 0-255 coming out of vixen.

    I am a not the best at codeing but i know haredwear and what it takes to build.
    Ok so the guy in the video I shared dean has a complete set of videos on setting up 32 or more channels with Arduino mega and vixen as well as the relays healso gives you the code which is same one I used . Heís the reason I started lights because he walks you thru each and every step including vixen . I followed step by step and had a small show up in just a few weeks and knew nothing about lights or vixen or arduino .
    He just started a new series for pixels which I will do next year . I will send code I use but your vixen set up would have to match I would think .


    Sent from my iPhone using Tapatalk

Page 1 of 3 123 LastLast

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
  •