Camera tally light control

Hi,

I want to create a tally light control for my video switcher "Extron ISS_400"

My hardware: Arduino one, Ethernet shield, Mayhew labs mux shield

The Video switcher has 8 inputs and 2 outputs (preview and program)
the mux shield is used to control the 8 bicollor LED's (1 led /video input) when an input is tied to previev the led is green en when the input is tied to program the led is red.

To query the input binding you have to send "1&" for preview and "2&" for program to the Extron and you get a numeric respons from the extron (1-8)

eg: if input 7 is tied to the preview output and you send "1&" you get in return 7.

I have already some code where I can query the input manualy via the serial monitor but I want that query will be done automaticly.

Can some one help me out?

Kind regard

Koen

Post the code you have. Then please elaborate on what you want the arduino to do - sending the commands 'automatically' sounds trivial, but what do you want to do with the result?

Hi Wildbill,

I want to store the values i get from the video switcher as 2 intergers called "Preview" and "Program"
With this 2 integers i will control the output LED's
Below you can find my code I already have.
I problem is how to get and store the 2 values for Preview and Program

Kind regards

//Tally control based on Arduino uno, arduino Mux Shield and Arduino Ethernet Shield  connected to Extron ISS408   
//http://mayhewlabs.com/arduino-mux-shield (Analog inputs 0-2 are shifted to 3-5 (0-1 used by Ethernet shield))
//http://www.arduino.cc/en/Main/ArduinoEthernetShield

/*
This program is used to control a tally light for 8 camera's,
we use pin numbers 17-19 (instead of analog numbers 3-5). 
Mux 0 is used to control camera tally 1-8 
Mux 1 is used to control screen tally in parallel with Mux0
Tally RED (program) is controlled with even outputs 1, 3, 5, 7, 9, 11, 13, 15
Tally GREEN (preview) is controlled with od outputs 0, 2, 4, 6, 8, 10, 12, 14 
Pin 8 is used to control the online LED
To simplify this code further, one might use nested for loops or function calls.
*/

//Give convenient names to the control pins
#define CONTROL0 5    //MUX control pin 0 (S3 is connected to Arduino pin 2)
#define CONTROL1 4
#define CONTROL2 3
#define CONTROL3 2

#define ConnectedLED 8

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {  
  0x90, 0xA2, 0xDA, 0x00, 0x5A, 0x61 };
byte ip[] = { 
  192,168,1,200};//192,168,254,252 };

// Enter the IP address of the server you're connecting to:
byte server[] = { 
  192,168,1,3};//192,168,254,254 }; 

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 23 is default for telnet;
// if you're using Processing's ChatServer, use  port 10002):
Client client(server, 23);


void setup()
{
  //Set MUX control pins to output
  pinMode(CONTROL0, OUTPUT);
  pinMode(CONTROL1, OUTPUT);
  pinMode(CONTROL2, OUTPUT);
  pinMode(CONTROL3, OUTPUT);
  
  //Set ConnecedLED pin to output
  pinMode (ConnectedLED, OUTPUT);
  
  // start the Ethernet connection:
  Ethernet.begin(mac, ip);


  int Program = 0; // #input connected to Program
  int Preview = 0; // #input connected to Preview

}
void readProgram()
{
  Serial.println("Reading Program");
  if (client.connected()){
    client.println("1&");
    delay(10);
  }
}  
void readPreview()
{
  Serial.println("Reading Preview");
  if (client.connected()){
    client.println("1&");
    delay(10);
  }

}
void telnetconnect() 
{
  // start the serial library:
  Serial.begin(9600);
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("reconnecting...");

  // if you get a connection, report back via serial:
  if (client.connect()) {
    Serial.println("connected");
    digitalWrite (ConnectedLED, HIGH);
  } 
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}
void loop()
{
if (!client.connected())
  {
  Serial.println("not connected");  
  telnetconnect();
  }

  //Since all 3 multiplexers have the same control pins, the one multiplexer data line we want to 
  //talk to should be set to output and the other two multiplexer lines should be be 'bypassed' by 
  //setting the pins to input
    
  //Turn on output to digital pin 17 and 18(MUX 0 and MUX 1) and turn off the other multiplexer data pins
  pinMode(17, OUTPUT);
  pinMode(18, OUTPUT);
  pinMode(19, INPUT);
    
  ////This for loop is used to scroll through the FIRST multiplexer
  //for (int i=0; i<4; i++)
  //{    
    
    
  //  //The following 4 commands set the correct logic for the control pins to select the desired input
  //  //See the Arduino Bitwise AND Reference: http://www.arduino.cc/en/Reference/BitwiseAnd
  //  //See the Aruino Bitshift Reference: http://www.arduino.cc/en/Reference/Bitshift
  //  digitalWrite(CONTROL0, (i&15)>>3); //S3
  //  digitalWrite(CONTROL1, (i&7)>>2);  //S2
  //  digitalWrite(CONTROL2, (i&3)>>1);  //S1
  //  digitalWrite(CONTROL3, (i&1));     //S0
    
  //  digitalWrite(17, HIGH);
  //  digitalWrite(18, HIGH);
  //  delay(1000);
  //  digitalWrite(17, LOW);
  //  digitalWrite(18, LOW);
  //  delay(1000);
  //}
  
  
  
  // if there are incoming bytes available 
  // from the server, read them and print them:
  
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }

  // as long as there are bytes in the serial queue,
  // read them and send them out the socket if it's open:
  while (Serial.available() > 0) {
    char inChar = Serial.read();
    if (client.connected()) {
      client.print(inChar); 
    }
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    digitalWrite (ConnectedLED, LOW);
    // do nothing:
    //while(true);
  }
//readProgram();

}

Reusing what you have, this should give you want you want:

void readProgram()
{
char ch=0;
Serial.println("Reading Program");
if (client.connected())
  {
  client.println("1&");
  while(ch==0)
    {
    if(client.available())
      {
      ch=client.read();
      Program=ch-'0';
      }
    }
  }

It is not robust though - there is no timeout and it will be problematic if you get CR/LF or any other data with the single digit you're expecting.

edit: typo in the code

Hi Wildbill,

When the connection is made for the 1st time you get a welcome message like "(c) Copyright 2002, Extron Electronics, ISS 408 Vx.xx"
The message is ended with a CR/LF also the values that i get back from the switcher are terminated with a CR/LF.

I got this code

void readProgram()
{
  Serial.println("Reading Program");
  if (client.connected()){
    client.println("2&");
    delay(10);
    while (client.available()>0) {
      char c = client.read();
      Program = atoi(&c); 
      Serial.print(Program);
    }
    Serial.println("");
  }
}

But i don't have acces to the video switcher for the moment i can't test it.
I will give your code also a try.

Kind regards

Koen

Hi,

my code is working but there where some small mistaces in "the read functions where not in the loop" and I also found out that we can't use the Mux shield becouse you can't activate more than one output on the same time. I have an old velleman K8000 and will try the work with that via I2C

//Tally control based on Arduino uno, arduino Mux Shield and Arduino Ethernet Shield  connected to Extron ISS408   
//The mux shield is not working there can only be 1 output actief at the same time, will use Velleman K8000 on I2C
//http://mayhewlabs.com/arduino-mux-shield (Analog inputs 0-2 are shifted to 3-5 (0-1 used by Ethernet shield))
//http://www.arduino.cc/en/Main/ArduinoEthernetShield

/*
This program is used to control a tally light for 8 camera's,
we use pin numbers 17-19 (instead of analog numbers 3-5). 
Mux 0 is used to control camera tally 1-8 
Mux 1 is used to control screen tally in parallel with Mux0
Tally RED (program) is controlled with even outputs 1, 3, 5, 7, 9, 11, 13, 15
Tally GREEN (preview) is controlled with od outputs 0, 2, 4, 6, 8, 10, 12, 14 
Pin 8 is used to control the online LED
To query the input binding you have to send "1&" for preview and "2&" for program to the Extron and you get a numeric respons from the extron (1-8)
To simplify this code further, one might use nested for loops or function calls.
*/


#define ConnectedLED 8

#include <SPI.h>
#include <Ethernet.h>

// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = {  
  0x90, 0xA2, 0xDA, 0x00, 0x5A, 0x61 };
byte ip[] = { 
  //192,168,1,200};
  192,168,254,252 };

// Enter the IP address of the server you're connecting to:
byte server[] = { 
  //192,168,1,3};
  192,168,254,254 }; 

// Initialize the Ethernet client library
// with the IP address and port of the server 
// that you want to connect to (port 23 is default for telnet;
// if you're using Processing's ChatServer, use  port 10002):
Client client(server, 23);

  int Program = 0; // #input connected to Program
  int Preview = 0; // #input connected to Preview

void setup()
{

  //Set ConnecedLED pin to output
  pinMode (ConnectedLED, OUTPUT);
  
  // start the Ethernet connection:
  Ethernet.begin(mac, ip);



}
void readProgram()
{
  Serial.println("Reading Program");
  if (client.connected()){
    client.println("1&");
    delay(1000);
    while (client.available()>0) {
      char c = client.read();
      //Program = atoi(&c); 
      Serial.print(c);
    }
    Serial.println("");
  }
}  
void readPreview()
{
  Serial.println("Reading Preview");
  if (client.connected()){
    client.println("2&");
    delay(1000);
    while (client.available()>0) {
      char c = client.read();
      //Preview = atoi(&c); 
      Serial.print(c);
    }
    Serial.println("");  
  }
}
void telnetconnect() 
{
  // start the serial library:
  Serial.begin(9600);
  // give the Ethernet shield a second to initialize:
  delay(1000);
  Serial.println("reconnecting...");

  // if you get a connection, report back via serial:
  if (client.connect()) {
    Serial.println("connected");
    digitalWrite (ConnectedLED, HIGH);
  } 
  else {
    // if you didn't get a connection to the server:
    Serial.println("connection failed");
  }
}
void loop()
{

    readPreview();
    readProgram();
if (!client.connected())
  {
  Serial.println("not connected");  
  telnetconnect();
  }

 
  // if there are incoming bytes available 
  // from the server, read them and print them:
  
  //if (client.available()) {
  //  char c = client.read();
  //  Serial.print(c);
  //}

  // as long as there are bytes in the serial queue,
  // read them and send them out the socket if it's open:
  while (Serial.available() > 0) {
    char inChar = Serial.read();
    if (client.connected()) {
      client.print(inChar); 
    }
  }

  // if the server's disconnected, stop the client:
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    digitalWrite (ConnectedLED, LOW);
  }
     //do nothing:
    //while(true);
}

Hi all,

afterdiscovering that i was working with the wrong I/O expation shield i used the K8000.

Now I have a small test software ready that i want to share.
It is generating a random value for the Preview and Program from 1 to 8 and the corresponding outputs are switched on as it should be.

#include <Wire.h>


#define camChipL 56 // address I2C chip CAM 1 to 4
#define camChipH 57 // address I2C chip CAM5 to 8
int Program = 0;    // Input where Program is binded to
int Preview = 0;    // Input where Preview is binded to
int dd = 50;        // delay for I2C write
byte proBYTEL;      // BYTE contaning Program info for cam 1 to 4 
byte preBYTEL;      // BYTE contaning Preview info for cam 1 to 4 
byte proBYTEH;      // BYTE contaning Program info for cam 5 to 8 
byte preBYTEH;      // BYTE contaning Preview info for cam 5 to 8 
byte camBYTEH;      // BYTE containing program/preview info for cam 1 to 4
byte camBYTEL;      // BYTE containing program/preview info for cam 5 to 8


void setup(){
  Wire.begin(); // join i2c bus (address optional for master)
  Serial.begin(9600);

preBYTEL = 0;
proBYTEL = 0;
preBYTEH = 0;
proBYTEH = 0;

}


void loop(){
Program = random (1,9);
Preview = random (1,9);
 
    if (Program > 4){}
    else {}
       if (Program <1){}
         else{
           int i= 1;
           proBYTEL = i << ((Program-1)*2);  // calculate proBYTEL
           proBYTEH = 0;
           }
   if (Preview > 4){}
    else {}
       if (Preview <1){}
          else{   
           int i= 2;
           preBYTEL = i << ((Preview-1)*2);
           preBYTEH = 0;
            }
    if (Program > 8 ){}
     else {} 
       if (Program < 5){}
         else{
           int i = 1;
           proBYTEH = i << ((Program-5)*2);
           proBYTEL = 0;
           }
    if (Preview > 8){}
      else{}
         if(Preview < 5){}
          else{
            int i =2;
            preBYTEH = i << ((Preview-5)*2);
            preBYTEL = 0;
            }
camBYTEL= proBYTEL | preBYTEL;
camBYTEH= proBYTEH | preBYTEH;
Serial.print ("Program = ");
Serial.println (Program);
Serial.print ("Preview = ");
Serial.println (Preview);
//Serial.print ("proBYTEL = ");
//Serial.println (proBYTEL,DEC);
//Serial.print ("preBYTEL = ");
//Serial.println (preBYTEL,DEC);
//Serial.print ("proBYTEH = ");
//Serial.println (proBYTEH,DEC);
//Serial.print ("preBYTEH = ");
//Serial.println (preBYTEH,DEC);

//Serial.println(camBYTEL,BIN);
//Serial.println(camBYTEH,BIN);

Wire.beginTransmission(camChipL);  //write camBYTEL to camChipL
Wire.send(255-camBYTEL);
Wire.endTransmission();
delay (dd);
     
Wire.beginTransmission(camChipH);  //write camBYTEH to camChipH
Wire.send(255-camBYTEH);
Wire.endTransmission();
delay (dd);

delay (5000);
}

Kind Regards

Koen