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

Thread: Arduino Intermittent connection with vixen

  1. #1
    Join Date
    Dec 2016
    Location
    Miami, FL
    Posts
    31
    Post Thanks / Like

    Default Arduino Intermittent connection with vixen

    Hi I am attempting to run 6 8 relay boards with a mega 2560. I am using external power to the relay boards and have removed the jumper on the board. When I connect to Vixen I am running into a problem When I launch vixen it tends to not connect to the Arduino. Sometimes if I go in and delete he device and create it again in Vixen it will work. The sketch I am using has a random sequence when there is no serial traffic and that seems to work fine. I'm assuming there is something not working in the sketch..... Please help!!

    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.
     
     // 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 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 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
    // Up to here for Arduino uno.
     #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[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) {

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

    Default Re: Arduino Intermittent connection with vixen

    Your published sketch is incomplete, as seen by the incomplete void loop() routine.

    There have been many successful reports of victor's sketch over the years, so I doubt there is a bug in it.
    You didn't indicate which version of Vixen you are using, but Vixen 2x does stop when the sequence is done while Vixen 3x keeps the data stream going with channel nulls when the sequence is done.

    It could be a USB driver issue or a MEGA USB firmware issue. We would need more accurate data to track it down.

  3. #3
    Join Date
    Dec 2016
    Location
    Miami, FL
    Posts
    31
    Post Thanks / Like

    Default Re: Arduino Intermittent connection with vixen

    Thanks for the quick repose. I am running Vixen 3.3u2. Here is the text from the error logs maybe this can help.

    12/26/2016 09:37:56 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 09:39:56 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 09:41:56 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 09:43:56 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 11:07:01 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 11:09:01 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 11:11:01 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 11:11:51 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 11:14:12 [VixenModules.Output.GenericSerial.Module] COM10 is in use. Starting controller retry timer for d22c9233-16e9-4008-a215-e577f78a7a2e
    12/26/2016 11:25:36 [Vixen.Sys.Managers.HardwareUpdateThread] Controller Generic Serial error System.IO.IOException: A device attached to the system is not functioning.

    at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
    at System.IO.Ports.SerialStream.EndWrite(IAsyncResult asyncResult)
    at System.IO.Ports.SerialStream.Write(Byte[] array, Int32 offset, Int32 count, Int32 timeout)
    at System.IO.Ports.SerialPort.Write(Byte[] buffer, Int32 offset, Int32 count)
    at VixenModules.Output.GenericSerial.Module.UpdateSta te(Int32 chainIndex, ICommand[] outputStates)
    at Vixen.Sys.Output.OutputController.Update()
    at Vixen.Sys.Managers.HardwareUpdateThread._ThreadFun c() at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
    at System.IO.Ports.SerialStream.EndWrite(IAsyncResult asyncResult)
    at System.IO.Ports.SerialStream.Write(Byte[] array, Int32 offset, Int32 count, Int32 timeout)
    at System.IO.Ports.SerialPort.Write(Byte[] buffer, Int32 offset, Int32 count)
    at VixenModules.Output.GenericSerial.Module.UpdateSta te(Int32 chainIndex, ICommand[] outputStates)
    at Vixen.Sys.Output.OutputController.Update()
    at Vixen.Sys.Managers.HardwareUpdateThread._ThreadFun c()
    12/26/2016 11:25:37 [Vixen.Sys.Managers.OutputDeviceExecution`1] Device Generic Serial experienced an error during execution and was shutdown.
    Thanks for the help.

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

    Default Re: Arduino Intermittent connection with vixen

    I'm not familiar with Vixen logs to know what to do about your issue.
    One line says "12/26/2016 11:25:36 [Vixen.Sys.Managers.HardwareUpdateThread] Controller Generic Serial error System.IO.IOException: A device attached to the system is not functioning."
    This suggests that your Arduino USB is not communicating properly. Perhaps you need to disconnect the USB cable from the Arduino and try again? This error could be an Arduino driver issue too, I suppose. Are you using the Arduino IDE USB driver, or a generic one?

  5. #5
    Join Date
    Dec 2016
    Location
    Miami, FL
    Posts
    31
    Post Thanks / Like

    Default Re: Arduino Intermittent connection with vixen

    Quote Originally Posted by LightUp View Post
    I'm not familiar with Vixen logs to know what to do about your issue.
    One line says "12/26/2016 11:25:36 [Vixen.Sys.Managers.HardwareUpdateThread] Controller Generic Serial error System.IO.IOException: A device attached to the system is not functioning."
    This suggests that your Arduino USB is not communicating properly. Perhaps you need to disconnect the USB cable from the Arduino and try again? This error could be an Arduino driver issue too, I suppose. Are you using the Arduino IDE USB driver, or a generic one?
    I am actually running a "clone" with the ch340chip. The computer recognizes it perfectly. I can get Vixen to see it by deleting the device and then creating it again. The problem is once I power off it wont see it again.

  6. #6
    Join Date
    Dec 2017
    Location
    Southeast Missouri
    Posts
    11
    Post Thanks / Like

    Default Re: Arduino Intermittent connection with vixen

    I realize this is an old post but did you ever find a solution? This is the first year I'm playing with sequencing and I'm running into the same thing. I'm using the victor code unmodified on a Mega 2560 clone with the CH340 chip. Vixen will appear to be sending data based on the lights on the Arduino, but the Arduino isn't responding. Every once and awhile I'll happen into the right sequence of reboots, resets, IDE uploads, and possibly coffee sips and it'll work. From a fresh boot the Arduino goes into the random flash routine and the lights work while that part of the code is going.

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

    Default Re: Arduino Intermittent connection with vixen

    My experience with using Vixen to communicate to an Arduino is that you have to apply power to the Arduino before you open Vixen. I don't think Vixen will recognize a new serial device once it is open.
    Do you have the header field filled out correctly in your Generic Serial configuration page? Matching baud rates?
    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
    Dec 2017
    Location
    Southeast Missouri
    Posts
    11
    Post Thanks / Like

    Default Re: Arduino Intermittent connection with vixen

    Thank you for the response, I could use a second set of eyes on this. So far I've tried powering (power and connecting USB) up the Arduino before boot, after boot before Vixen opens, after Vixen opens, hitting reset while Vixen is open but before opening the sequence. I've also tried USB2, USB3, an i5 computer, a Dual Core, Win7 x64, Win 7 x32, WinXP, 4 different sketches (currently running the original "victor" code unmodified) two different Arduinos, and different USB cables. Com settings are the same in the sketch, Vixen, and device manager. Vixen is set to use a ~! header and no footer like the sketch calls for. I've also tried Vixen 2 and Vixen 3. Seriously the only thing that generally seems to work is 1) Open the IDE and upload the sketch, 2) close the IDE and open Vixen, then 3) Run a sequence. At that point I get a predictable and controllable communication. If I then reboot the whole thing falls apart and stops working. The only constant that I see is are the Arduinos and com drivers. I'm planning on modifying the sketch a little to set the onboard LED off at the beginning of the loop and then on at the completion of the header. At least that way I'll be able to tell if the Arduino is seeing *valid* data. I'm also thinking of loading the latest bootloader on one of my Arduinos and seeing if it makes a difference. I know a lot of people run that sketch and setup, there's something goofy in my hardware, or some part of the manual that I missed.

    Steve

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

    Default Re: Arduino Intermittent connection with vixen

    The only thing I can add right now is that I did have one of my MEGAs that I had to upload the sketch to every night. Apparently the memory did not work well on that particular one. Maybe you have two that are like that.

    You have tried many more troubleshooting scenarios than I ever have. I don't think that I can add much more. You could pose this question on the Arduino.com forum.

    Can you post some screen shots of your Generic Serial configuration?
    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.

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

    Default Re: Arduino Intermittent connection with vixen

    When I recently upgraded my Arduino IDE to 1.8.5, it asked if I wanted to install the Arduino USB driver. I said yes.
    Is it possible that you said NO and thus are using a different USB driver? I don't use Vixen much, except for an occasional quick test, but have not noticed an issue communicating with my UNO, or MEGA board and Vixen 3. I was using a laptop win 7 X64.

Page 1 of 3 123 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
  •