Page 11 of 12 FirstFirst ... 9101112 LastLast
Results 101 to 110 of 112

Thread: Arduino Uno & Vixen 3: Need help with sketch

  1. #101
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    528
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Cool! It always feels good to get that first success.
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  2. #102
    Join Date
    Jul 2017
    Posts
    50
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Quote Originally Posted by kev View Post
    Cool! It always feels good to get that first success.
    Kev,
    Running into an issue when testing out the led strip on the mega. It is the same setup I had as on the UNO, again just testing since I have never used a mega. Anyways, I have pins 4,5 and 6 connected to a LED strip and when tested using vixen and a "set level" feature the led blinks red, green blue really fast while the set level feature is active and then it turns off. So, it seems it knows Vixen is sending something but doesnt follow what vixen says to do. I played around with it and when I turned on headers and input "~!" the LED light strip flashes with the on board "rx" led; so again, its like the LED strip is just getting power and blinking as fast as the rx led. Is there anything different about the mega pins I am missing? Again I have my pins connected to 4,5,6 on the pwm side of the board.

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

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Hmmm....

    I have not used the PWM pins as PWM. So my help is guessing. Do your baud rates match? If you use Victor_PV sketch can you get them to just turn on and off? Did you select MEGA when you recompiled the code?
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  4. #104
    Join Date
    Jul 2017
    Posts
    50
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Kev,
    After reading through about 300 posts on the long PV_Victor thread I read someones comment that said the controller in Vixen needs to have the same channel count as the sketch which mine did not. I thought I could put the amount of channels the controller contains in Vixen and then only patch the quantity I want to use in my sketch. Once I changed the channel count in vixen it worked perfectly. So now I have the mega working with the PWM sketch and LED strip acting correctly and the uno board with victor sketch and ac wreath working correctly. Now, I will attempt to set up both controllers at once and have them run simultaneously with 1 element each, the uno with the wreath and the mega with the dimming LED strip; I will upload a video, not that you havent seen it but just to show off the little progress I have made haha. I also have to begin planning how I will package and organize everything because even with the minimal elements I am using to test my table looks like an electricians nightmare haha.

    As I was wiring up the ac wreath I realized I will have a lot of elements needing access to the power, how did you supply power to everything? Did you use some form of a power rail? Also, do you connect everything to a power strip with a surge protector at all? I am fairly certain the outlets in my garage have the GFCI so I think thats an additional surge protector but I think ill still use an additional protector on top of that.

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

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    I did not use a surge protector for any of my controller boxes last year. As far as powering all of the AC elements, I had one AC connection to each of my controller boxes. Inside the box, I had an AC distribution board that I made just to route AC to all of the SSRs. Each 8 channel SSR had it's own fuse. Each output on the SSR had a two position connector that I put female AC pigtails into. Then I ran AC cords from each pigtail out to the element. For the pigtails and AC cords, I bought 1000' of SPT-1 two conductor wire and SPT-1 Vampire plugs (male and female). My AC SSRs were use BTA06 triacs which are rated for 6 amps when heat sinks are properly utilized. I tried to not load them more than 1-2 amps and not using heatsinks. I was using all LED strings, so the loads were usually less than 1 amp per channel.

    I think that you could connect the SPT-1 cable directly to your SSR terminals. Alot of people wire duplex AC outlets to the SSR outputs, but that really isn't necessary. It just adds work and expense.

    I think that cabling is the most overlooked expense of this hobby.

    I bought the SPT-1 wire here - https://thechristmaslightemporium.co...and-spt-2-wire
    I bought the SPT-1 Vampire plugs here - https://thechristmaslightemporium.co...-vampire-plugs
    Attached Images Attached Images
    Last edited by kev; 11-12-2017 at 10:47 PM.
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  6. #106
    Join Date
    Jul 2017
    Posts
    50
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Quote Originally Posted by kev View Post
    I think that cabling is the most overlooked expense of this hobby.[/url]
    HAHAHA, just when I thought I was done spending money you drop this gem on me. Thank you for the info, I will look it over but I had to respond to this first haha.

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

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Back in Post #65 I said that I used a Dri-Box but I meant to say SOCKIT-Box.
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  8. #108
    Join Date
    Jul 2017
    Posts
    50
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Kev,
    Ran into a weird issue...So I tried to modify the PV sketch again to test the MEGA and UNO (LED and AC elemtn) together, if you remember I already tested the ac/ssr/uno and it worked but I guess I forgot how I modified the sketch so I tried it again. Anyways, I set up only 1 channel in the victor sketch and in the vixen and all other paramters were correct (just take my word). I played it and the mega worked fine but the uno was just playing the random mode. I spent a good long while playing with the sketch etc and come to find out it will not work with just 1 channel, I have to specify 2 or more channels in the sketch and matching channel count in vixen for it to work. The uploaded sketch is what I had to use for 1 channel and 1 ac element test setup. I just thought this was wierd, does this seem odd to you? I am assuming its just something I am unaware of.

    https://www.youtube.com/watch?v=LKWm...ature=youtu.be

    Code:
     // 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.
    
     //MUST USE HEADER "~!" IN VIXEN, DO NOT USE FOOTER
     //This is code I used to test 1 ac element with ssr 
    
     // 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 6
    
     // 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 CH06 6
    
    
    // Up to here for Arduino uno.
    
     
     int channels[] = {CH06};
    
     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
         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);
       }
     }
    }

  9. #109
    Join Date
    Dec 2014
    Location
    Southern California
    Posts
    528
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    Well....My wife wants me to vacate the dining room also!!! I might have read something in the hundreds of posts about some minimum number of channels. But it won't matter in the end because you will have a lot!!!!
    Kevin

    2016 - 184 channels of Blinking/Flashing using 4 Arduino MEGAs and cheap home-made props.

  10. #110
    Join Date
    Nov 2009
    Location
    Morrisburg, On, Canada
    Posts
    2,398
    Post Thanks / Like

    Default Re: Arduino Uno & Vixen 3: Need help with sketch

    resjsu:
    I too recall some past discussion on the number of Vixen minimum number of bytes, or channels.

    I thought it was 3 bytes; 1 data byte, one header byte and one footer byte. So if you don't use a header and footer, Vixen is still setup to send a minimum of 3 bytes. But I haven't verified it. Should be easy to test with a simple sketch.

    If you claim that 1 channel can be sent in a MEGA board but not the UNO board then I would suspect your testing method. The UNO and MEGA should read the same channels, or serial data train, from Vixen.

    I couldn't find the former discussion dealing with one data channel.

Page 11 of 12 FirstFirst ... 9101112 LastLast

Tags for this Thread

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
  •