Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Arduino Meltdown

  1. #1
    Join Date
    Nov 2020
    Posts
    7
    Post Thanks / Like

    Default Arduino Meltdown

    Greetings,
    im new here, last year was my first year doing a Christmas light display using a 32 channel Arduino solid state relay controller and vixen, after a lot of insanity we were able to get it going. Fast forward to this year I decided to add another 8 channels and all hell has broken loose. I thought I was getting somewhere but really i think all it is doing is randomly turning some channels on and off. out of 40 channels roughly 23 are doing anything. seems like channels 1-13 and 28-40 are randomly working and the rest are completely dead. attached is the sketch that worked correctly with 32 channels as well as the one I am attempting to use for 48 ch. I have attempted to use some sketches found here in the forums but get error messages when trying to load.
    I am using a genuine Arduino mega 2560
    five 8 / channel 5v high level solid state relays.
    Vixen 3
    57600 baud rate in vixen

    CH01 2
    CH02 3
    CH03 4
    CH04 5
    CH05 6
    CH06 7
    CH07 8
    CH08 9
    CH09 10
    CH10 11
    CH11 12
    CH12 13
    CH13 A0
    CH14 A1
    CH15 A2
    CH16 A3
    CH17 A4
    CH18 A5
    CH19 A6
    CH20 A7
    CH21 A8
    CH22 A9
    CH23 A10
    CH24 A11
    CH25 A12
    CH26 A13
    CH27 A14
    CH28 A15
    CH29 22
    CH30 23
    CH31 24
    CH32 25
    CH33 26
    CH34 27
    CH35 28
    CH 36 29
    CH37 30
    CH38 31
    CH39 32
    CH40 33

    Im sure i am missing something simple but am completely frazzled by this.
    any help would be greatly appreciated.

    Josh Wright
    /G\
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2021
    Posts
    108
    Post Thanks / Like

    Default Re: Arduino Meltdown

    // This code was written by Victor Perez for doityourselfchristmas.com based on the code from Zparticle, Si_champion and Neil Tapp.

    // To adapt the code to your case, just change this top section, with the #define lines.

    // Includes the watchdog timer library

    #include

    // This sets how many channels will vixen be sending. Can be set to any number from 1 to 48 for Arduino Mega, and 1 to 18 for Arduino Uno.

    #define CHANNEL_COUNT 48

    // speed for the com port for talking with vixen. From 9600 to 115200. Use the same speed as set in Vixen.

    #define VIXEN_COM_SPEED 57600

    // Timeout waiting for serial input before going to random mode (in milliseconds).

    #define TIME_OUT 1000

    // If the relays turn On and Off opposite to Vixen sequence, change "#define MODE NOT_INVERTED" for "#define MODE INVERTED"

    #define NOT_INVERTED 0

    #define INVERTED 1

    #define MODE NOT_INVERTED

    // which pins control which channels

    // You can change these assignment to use different pins, but be very careful to not repeat the same pin number for 2 channels.

    // DO NOT use pings 0 and 1, as those are for the serial port to talk to the computer.

    #define CH01 2

    #define CH02 3

    #define CH03 4

    #define CH04 5

    #define CH05 6

    #define CH06 7

    #define CH07 8

    #define CH08 9

    #define CH09 10

    #define CH10 11

    #define CH11 12

    #define CH12 13

    #define CH13 A0

    #define CH14 A1

    #define CH15 A2

    #define CH16 A3

    #define CH17 A4

    #define CH18 A5

    #define CH19 A6

    #define CH20 A7

    #define CH21 A8

    #define CH22 A9

    #define CH23 A10

    #define CH24 A11

    #define CH25 A12

    #define CH26 A13

    #define CH27 A14

    #define CH28 A15

    #define CH29 22

    #define CH30 23

    #define CH31 24

    #define CH32 25

    #define CH33 26

    #define CH34 27

    #define CH35 28

    #define CH36 29

    #define CH37 30

    #define CH38 31

    #define CH39 32

    #define CH40 33

    #define CH41 34

    #define CH42 35

    #define CH43 36

    #define CH44 37

    #define CH45 38

    #define CH46 39

    #define CH47 40

    #define CH48 41

    int channels[] = {CH01,CH02,CH03,CH04,CH05 ,CH06,CH07,CH08,CH09,

    CH10,CH11,CH12,CH13,CH14,CH15,CH16,CH17,CH18,CH19, CH20,CH21,CH22,

    CH23,CH24,CH25,CH26,CH27,CH28,CH29,CH30,CH31,CH32, CH33,CH34,CH35,

    CH36,CH37,CH38,CH39,CH40,CH41,CH42,CH43,CH44,CH45, CH46,CH47,CH48};

    int incomingByte[CHANNEL_COUNT];

    int i = 0; // Loop counter

    volatile unsigned long timer_a = 0; // new line

    //setup the pins/ inputs & outputs

    void setup(){

    // enable the watchdog timer with a time of 1 second. If the board freezes, it will reset itself after 1 second.

    wdt_enable(WDTO_1S);

    // specifically for the UNO

    sei();

    // initalize PWM Channels / Pins

    for (i=0; i < CHANNEL_COUNT; i++){

    pinMode(channels, OUTPUT);

    }

    // set all the realys to off to start with

    if (MODE == NOT_INVERTED) {

    for (i=0; i < CHANNEL_COUNT; i++){

    digitalWrite(channels, LOW);

    }

    }

    else {

    for (i=0; i < CHANNEL_COUNT; i++){

    digitalWrite(channels, HIGH);

    }

    }

    testSequence();

    // set up Serial according to the speed defined above.

    Serial.begin(VIXEN_COM_SPEED);

    }

    void loop()

    {

    if (Serial.available() >= (CHANNEL_COUNT+2)) {

    wdt_reset(); // resets the watchdog

    timer_a = millis (); // new line

    int uno = Serial.read();

    if (uno == 126){

    int dos = Serial.read();

    if (dos == 33){

    for (i=0; i < CHANNEL_COUNT; i++) {

    // read each byte

    incomingByte = Serial.read();

    }

    if (MODE == NOT_INVERTED) {

    for (i=0; i < CHANNEL_COUNT; i++){

    int value = incomingByte;

    if (value = TIME_OUT) {

    timer_a = millis ();

    int random_a = 0;

    for (i=0; i < CHANNEL_COUNT; i++){

    random_a = random(0, 2);

    if (random_a == 0) {

    digitalWrite(channels, LOW);

    }

    else {

    digitalWrite(channels, HIGH);

    }

    }

    }

    }

    }

    void testSequence(){

    if (MODE == NOT_INVERTED) {

    for (i=0; i < CHANNEL_COUNT; i++){

    wdt_reset(); // resets the watchdog

    digitalWrite(channels, HIGH);

    delay (500);

    digitalWrite(channels, LOW);

    }

    }

    else {

    for (i=0; i < CHANNEL_COUNT; i++){

    wdt_reset(); // resets the watchdog

    digitalWrite(channels, LOW);

    delay (500);

    digitalWrite(channels, HIGH);

    }

    }

    }


    Sent from my SM-N975U using Tapatalk
    Last edited by mr fix; 12-03-2021 at 04:55 PM.

  3. #3
    Join Date
    Jan 2021
    Posts
    108
    Post Thanks / Like

    Default Re: Arduino Meltdown

    Compare your sketch this one this sketch works perfectly.
    and in vixel ise the header ~!

    Sent from my SM-N975U using Tapatalk
    Last edited by mr fix; 12-03-2021 at 07:57 AM.

  4. #4
    Join Date
    Nov 2020
    Posts
    7
    Post Thanks / Like

    Default Re: Arduino Meltdown

    I am seriously dumb when it comes to this, I cannot get this sketch to upload to the arduino. I know I am supposed to change something at the top but I have no clue what exactly gets deleted and what gets added. is there a copy of this ready to go already?

  5. #5
    Join Date
    Jan 2021
    Posts
    108
    Post Thanks / Like

    Default Re: Arduino Meltdown

    Change this part that says #define CHANNEL_COUNT 16
    to say
    #define CHANNEL_COUNT 48
    And in the park that says inverted or not inverted it would depend on your relays

    Sent from my SM-N975U using Tapatalk

  6. #6
    Join Date
    Nov 2020
    Posts
    7
    Post Thanks / Like

    Default Re: Arduino Meltdown

    when i change it to 48 i get this error when trying to upload the sketch incompatible type in assignment of 'int to 'int [48]

    as far as the inverted not inverted would i change it like this?

    From:

    #define NOT_INVERTED 0

    #define INVERTED 1

    #define MODE NOT_INVERTED

    To:
    #define INVERTED 0

    #define NOT_INVERTED 1

    #define MODE INVERTED

    How do I know if it should be inverted or not?

    Sorry to be difficult this is defiantly not easy for me.

  7. #7
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    1,362
    Post Thanks / Like

    Default Re: Arduino Meltdown

    No. Don't change anything except the channel count. pay attention to which pins the channels are assigned to. Make sure that in the Vixen controller config window that you have 57600 Baud, 8 bits, 1 stop and enter the characters ~! into the Header field. Make sure Vixen controller channel count is 48 and that you have 48 elements defined. If you don't actually have 48 elements in the yard, create SPARE or DUMMY elements within Vixen
    Last edited by kev; 12-03-2021 at 06:05 PM.
    Kevin

  8. #8
    Join Date
    Nov 2020
    Posts
    7
    Post Thanks / Like

    Default Re: Arduino Meltdown

    I can copy and paste the sketch just fine but as soon as I cange this

    // This sets how many channels will vixen be sending. Can be set to any number from 1 to 48 for Arduino Mega, and 1 to 18 for Arduino Uno.
    #define CHANNEL_COUNT 16
    to#define CHANNEL_COUNT 48
    I get the error occurred while uploading the sketch mesage

  9. #9
    Join Date
    Jan 2021
    Posts
    108
    Post Thanks / Like

    Default Re: Arduino Meltdown

    olny change the numbers from 16 to 48

    Sent from my SM-N975U using Tapatalk

  10. #10
    Join Date
    Jan 2021
    Posts
    108
    Post Thanks / Like

    Default Re: Arduino Meltdown

    recopy that scetch i made the change for you see if it works now

    Sent from my SM-N975U using Tapatalk

Page 1 of 2 12 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
  •