Page 1 of 12 12311 ... LastLast
Results 1 to 10 of 112

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

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

    Default Arduino Uno & Vixen 3: Need help with sketch

    Hello,
    Eventually I would like to have a full blown christmas light display (obviously) but for now I am still trying to figure out Vixen and my Arduino Uno,

    Vixen 3:
    I have watched several How to Vixen videos and for the most part I believe Vixen is good to go. I have 5 single item lights, each patched to a single output on the Arduino (5 in total) and the Arduino is labeled as a generic serial controller. I have a short sequence just to test the cummunication with the Uno. I created a show and I schedule the show for time -2 minutes (is there a better way to test a show?). I made sure the baud rate and com ports match both the Arduino sketch, IDE settings and device manager.

    The Arduino:
    I have a simple 5 LED setup on a bread board. I have the 5 PWM outputs from the Arduino connected to the led and a resistor from the opposite leg of the led to ground and ground connected back to the arduino.

    The Sketch:
    Code:
    /*
    The purpose of this code is to allow the Arduino to use the
    generic serial output of vixen lights to control 5 channels of LEDs.
    Author: Matthew Strange
    Created: 14 October 2010
    Modifier: Ben Towner
    Modified: 19-OCT-2010
    Changes: Addition of 20 Digital On/Off Channels - Setup for Arduino Mega 2560
     
    */
     
    // PWM Output - ChanX=PWM Pin
    int Chan1 = 2;  
    int Chan2 = 3;  
    int Chan3 = 4;  
    int Chan4 = 5;  
    int Chan5 = 6;  
     
     
    int i = 0;     // Loop counter
    int incomingByte[5];   // array to store the 5 values from the serial port
     
    //setup the pins/ inputs & outputs
    void setup()
    {
      Serial.begin(9600);        // set up Serial at 9600 bps
     
      pinMode(Chan1, OUTPUT);   // sets the pins as output
      pinMode(Chan2, OUTPUT);
      pinMode(Chan3, OUTPUT);
      pinMode(Chan4, OUTPUT);
      pinMode(Chan5, OUTPUT);
    }
     
    void loop()
    {  // 5 channels are coming in to the Arduino
       if (Serial.available() >= 5) {
        // read the oldest byte in the serial buffer:
        for (int i=0; i<5; i++) {
          // read each byte
          incomingByte[i] = Serial.read();
        }
       
        analogWrite(Chan1, incomingByte[0]);   // Write current PWM values to LED pins
        analogWrite(Chan2, incomingByte[1]);  
        analogWrite(Chan3, incomingByte[2]);  
        analogWrite(Chan4, incomingByte[3]);  
        analogWrite(Chan5, incomingByte[4]);   
       }
    }
    Not sure about the code. I have done a few random sketches with the Uno, mostly beginner stuff but I am not certain at all about the serial detail.

    Anyways, I hook up my Arudino and the sketch verifies and uploads without issue. I set my scheduler to play the show 2 min out and when the show starts there is not activity on the UNO.

    I believe there is most likely several issues with the sketch and I would appreciate some help fixing it.

    Thank you!

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

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

    I don't see anything obvious with your sketch.
    Does your Arduino RX light flicker when hooked up to Vixen? It should.
    I didn't use a scheduler but just ran the sequence manually - although I currently don't have Vixen installed as its been over a year ago when I was doodling with it.
    Most sketches use a power on test to sequence through each light so ensure that the output is working correctly.
    Then work on the serial communication.

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

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

    See image of my Arduino. This is how it looks while the vixen is playing the sequence; cant really tell but the led labeled "L" stays on and the RX and TX remain off.
    I verified all the com ports and tried different baud rates with no luck. Dont really know why it is not working. Any ideas?

    20428143_10203453799143653_1378409262_n.jpg

    Image of vixen settings

    VIXEN SETTINGS.pdf
    Last edited by resjsu; 07-27-2017 at 11:17 PM.

  4. #4
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    705
    Post Thanks / Like

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

    what port does your pc report the arduino on?
    did you close the arduino ide?
    is the port on the pc set for 9600?
    your vixen setup pix i can't see but it needs to match.
    this is not a great sketch for production but should work for tessing. We can address that after you get it working.

  5. #5
    Join Date
    Oct 2014
    Location
    Sauk City, WI USA
    Posts
    705
    Post Thanks / Like

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

    your sketch says 23456 for pins but it looks like you have some other arrangement in the pix?

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

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

    Quote Originally Posted by MikeKrebs View Post
    your sketch says 23456 for pins but it looks like you have some other arrangement in the pix?
    Mike,
    I saw what you were talking about. I changed the code to match the pins. When I open the serial monitor there is no activity while I am playing the vixon sequence. Is there anyway to test if the serial communication is working?

    Code:
    /*
    The purpose of this code is to allow the Arduino to use the
    generic serial output of vixen lights to control 5 channels of LEDs.
    Author: Matthew Strange
    Created: 14 October 2010
    Modifier: Ben Towner
    Modified: 19-OCT-2010
    Changes: Addition of 20 Digital On/Off Channels - Setup for Arduino Mega 2560
     
    */
     
    // PWM Output - ChanX=PWM Pin
    int Chan1 = 5;  
    int Chan2 = 6;  
    int Chan3 = 9;  
    int Chan4 = 10;  
    int Chan5 = 11;  
     
     
    int i = 0;     // Loop counter
    int incomingByte[5];   // array to store the 5 values from the serial port
     
    //setup the pins/ inputs & outputs
    void setup()
    {
      Serial.begin(9600);        // set up Serial at 9600 bps
     
      pinMode(Chan1, OUTPUT);   // sets the pins as output
      pinMode(Chan2, OUTPUT);
      pinMode(Chan3, OUTPUT);
      pinMode(Chan4, OUTPUT);
      pinMode(Chan5, OUTPUT);
    }
     
    void loop()
    {  // 5 channels are coming in to the Arduino
       if (Serial.available() >= 5) {
        // read the oldest byte in the serial buffer:
        for (int i=0; i<5; i++) {
          // read each byte
          incomingByte[i] = Serial.read();
        }
       
        analogWrite(Chan1, incomingByte[0]);   // Write current PWM values to LED pins
        analogWrite(Chan2, incomingByte[1]);  
        analogWrite(Chan3, incomingByte[2]);  
        analogWrite(Chan4, incomingByte[3]);  
        analogWrite(Chan5, incomingByte[4]);   
       }
    }

  7. #7
    Join Date
    Mar 2017
    Location
    Indiana
    Posts
    52
    Post Thanks / Like

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

    Did you get a chance to try what MikeKrebs suggested? A serial port can only be active by one program at a time. Do you have the Arduino IDE closed? You might have to open Vixen after the IDE is closed so Vixen can activate the port. Vixen should start streaming to the serial port right away with all zero data, so the Arduino serial LEDs should start blinking.
    2017: bit.ly/2zUzCC9

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

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

    Quote Originally Posted by ShadowLight8 View Post
    Did you get a chance to try what MikeKrebs suggested? A serial port can only be active by one program at a time. Do you have the Arduino IDE closed? You might have to open Vixen after the IDE is closed so Vixen can activate the port. Vixen should start streaming to the serial port right away with all zero data, so the Arduino serial LEDs should start blinking.
    Hello,
    Yes I closed Vixen and uploaded the sketch to the Uno and then closed the IDE. I opened Vixen and ran the sequence and still nothing.

    I did a basic serial communication check using the pin 13 on and off and it worked.

    It seems like Vixen isnt communicating with the Uno board.

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

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

    Quote Originally Posted by resjsu View Post
    ... When I open the serial monitor there is no activity while I am playing the vixon sequence....
    You can't read Vixen and use the Serial Monitor at the same time. That will create communication conflicts. You must close the Serial Monitor before running Vixen.
    The RX LED flickering on your Arduino is an indication that you are receiving data.

    For a more thorough check you can use an Arduino MEGA board and an USB-TTL adapter connected to a different port than the Serial Monitor. Now you have a means to read Vixen data and then display this data to your monitor via the Serial Monitor. You will need to add the changes to your sketch.

  10. #10
    Join Date
    Mar 2017
    Location
    Indiana
    Posts
    52
    Post Thanks / Like

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

    Gotcha! Can you send a screen shot of your Vixen config for the serial port? I've attached what I'm using. Ignore the header setting I'm using.
    Attached Images Attached Images
    2017: bit.ly/2zUzCC9

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