Results 1 to 8 of 8

Thread: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

  1. #1
    Join Date
    Nov 2018
    Posts
    5
    Post Thanks / Like

    Default all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    Hi all
    I am a newbie first Christmas, followed the setup of "cheapskate"on you tube. Using the Victor sketch it seemed to upload fine. I have (2) SainSmart 8-Channel 5V Solid State Relay Module Board for Arduino Uno Duemilanove MEGA2560 MEGA1280 ARM DSP PIC 8 channel SS relays and a Arduino Compatible Mega 2560 Atmega2560 Mega2560 R3 Board + USB Cable. After testing with a vixen setup only channel 3 on one of the board lights up. I have verified the connections and the led tends to flicker when the program first runs then stays solid on. no other channels light at all
    let me know if you need anything else. All help is greatly welcome... I cant wait to get this working.
    I verified the obvious and was able to get the upload to the arduino with no errors it appears.

  2. #2
    Join Date
    Oct 2016
    Posts
    11
    Post Thanks / Like

    Default Re: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    What code are you running on the Arduino?

  3. #3
    Join Date
    Nov 2018
    Posts
    5
    Post Thanks / Like

    Default Re: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    // 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 <avr/wdt.h>

    // 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 32

    // 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 INVERTED


    //Switch Mode
    #define mode_switch 7


    // 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 22
    #define CH02 23
    #define CH03 24
    #define CH04 25
    #define CH05 26
    #define CH06 27
    #define CH07 28
    #define CH08 29
    #define CH09 30
    #define CH10 31
    #define CH11 32
    #define CH12 33
    #define CH13 34
    #define CH14 35
    #define CH15 36
    #define CH16 37
    #define CH17 38
    #define CH18 39
    #define CH19 40
    #define CH20 41
    #define CH21 42
    #define CH22 43
    #define CH23 44
    #define CH24 45
    #define CH25 46
    #define CH26 47
    #define CH27 48
    #define CH28 49
    #define CH29 50
    #define CH30 51
    #define CH31 52
    #define CH32 53


    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} ;

    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[i], OUTPUT);
    }

    // set all the realys to off to start with
    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    digitalWrite(channels[i], LOW);

    }
    }

    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    digitalWrite(channels[i], 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[i] = Serial.read();
    }
    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    int value = incomingByte[i];
    if (value <= 127) {
    digitalWrite(channels[i], LOW);
    }
    else {
    digitalWrite(channels[i], HIGH);
    }
    }
    }
    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    int value = incomingByte[i];
    if (value < 127) {
    digitalWrite(channels[i], HIGH);
    }
    else {
    digitalWrite(channels[i], LOW);
    }
    }
    }

    }
    }
    }
    // Random mode code. Random mode starts if no serial input has been received in TIME_OUT millisenconds
    else {
    wdt_reset(); // resets the watchdog
    // If the switch is connected to ground, keep all the lights on when Vixen is not running.
    if (digitalRead (mode_switch) == LOW) {
    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], HIGH);
    }
    }
    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], LOW);
    }
    }
    }
    // If the switch is NOT connected to ground, then run in Ramdom mode.
    else {
    unsigned long diff = millis() - timer_a;
    if (diff >= 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[i], LOW);
    }
    else {
    digitalWrite(channels[i], HIGH);
    }
    }
    }
    }
    }
    }





    void testSequence(){

    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], HIGH);
    delay (500);
    digitalWrite(channels[i], LOW);
    }
    }

    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], LOW);
    delay (500);
    digitalWrite(channels[i], HIGH);
    }
    }
    }


    Quick reply to this message Reply Reply With Quote Reply With Quote Multi-Quote This Message .

    --------------------------------------------------------------------------------



    Post Thanks / Like - 0 Thanks, 0 Likes

  4. #4
    Join Date
    Nov 2018
    Posts
    5
    Post Thanks / Like

    Default Re: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    I am using the victor perez code listed below

    // 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 <avr/wdt.h>

    // 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 32

    // 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 INVERTED


    //Switch Mode
    #define mode_switch 7


    // 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 22
    #define CH02 23
    #define CH03 24
    #define CH04 25
    #define CH05 26
    #define CH06 27
    #define CH07 28
    #define CH08 29
    #define CH09 30
    #define CH10 31
    #define CH11 32
    #define CH12 33
    #define CH13 34
    #define CH14 35
    #define CH15 36
    #define CH16 37
    #define CH17 38
    #define CH18 39
    #define CH19 40
    #define CH20 41
    #define CH21 42
    #define CH22 43
    #define CH23 44
    #define CH24 45
    #define CH25 46
    #define CH26 47
    #define CH27 48
    #define CH28 49
    #define CH29 50
    #define CH30 51
    #define CH31 52
    #define CH32 53


    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} ;

    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[i], OUTPUT);
    }

    // set all the realys to off to start with
    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    digitalWrite(channels[i], LOW);

    }
    }

    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    digitalWrite(channels[i], 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[i] = Serial.read();
    }
    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    int value = incomingByte[i];
    if (value <= 127) {
    digitalWrite(channels[i], LOW);
    }
    else {
    digitalWrite(channels[i], HIGH);
    }
    }
    }
    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    int value = incomingByte[i];
    if (value < 127) {
    digitalWrite(channels[i], HIGH);
    }
    else {
    digitalWrite(channels[i], LOW);
    }
    }
    }

    }
    }
    }
    // Random mode code. Random mode starts if no serial input has been received in TIME_OUT millisenconds
    else {
    wdt_reset(); // resets the watchdog
    // If the switch is connected to ground, keep all the lights on when Vixen is not running.
    if (digitalRead (mode_switch) == LOW) {
    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], HIGH);
    }
    }
    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], LOW);
    }
    }
    }
    // If the switch is NOT connected to ground, then run in Ramdom mode.
    else {
    unsigned long diff = millis() - timer_a;
    if (diff >= 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[i], LOW);
    }
    else {
    digitalWrite(channels[i], HIGH);
    }
    }
    }
    }
    }
    }





    void testSequence(){

    if (MODE == NOT_INVERTED) {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], HIGH);
    delay (500);
    digitalWrite(channels[i], LOW);
    }
    }

    else {
    for (i=0; i < CHANNEL_COUNT; i++){
    wdt_reset(); // resets the watchdog
    digitalWrite(channels[i], LOW);
    delay (500);
    digitalWrite(channels[i], HIGH);
    }
    }
    }


    Quick reply to this message Reply Reply With Quote Reply With Quote Multi-Quote This Message .

    --------------------------------------------------------------------------------



    Post Thanks / Like - 0 Thanks, 0 Likes


    Edit / Delete Edit Post Quick reply to this message Reply Reply With Quote Reply With Quote Multi-Quote This Message .

    --------------------------------------------------------------------------------






    + Reply to Thread



    Quick Navigation Arduino Top


































































































































































































































































































































    .

    Previous Thread | Next Thread


    Tags for this Thread


    Add / Edit Tags
    None

    View Tag Cloud



    Bookmarks



    Submit to Digg Digg
    Submit to del.icio.us del.icio.us

  5. #5
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    749
    Post Thanks / Like

    Default Re: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    Did you put a header in your Vixen generic serial controller setup section? It needs to be "~!" .
    You said you are using two 8 channel sainsmart boards for a total of 16 channels. But the code you posted is looking for 32 channels. You need to modify the code to match his many channels you are using. The code and Vixen channel count need to match. Comment out any channels you are not using and edit the DEFINE_CHANNEL_COUNT to 16.
    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.

  6. #6
    Join Date
    Nov 2018
    Posts
    5
    Post Thanks / Like

    Default Re: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    ok got that set but not sure where to place the header is that at the top of the code or when you load it into aduino?

  7. #7
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    749
    Post Thanks / Like

    Default Re: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    The header goes in Vixen generic serial configuration box, the same place you set the band rate. It is in the Vixen application.
    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.

  8. #8
    Join Date
    Nov 2018
    Posts
    5
    Post Thanks / Like

    Default Re: all hooked up arduino and vixen upload worked but only 1 led on the relay is lit

    this site is awesome and hopefully one day I will know enough to help others thanks so much and happy thanksgiving

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
  •