Skip to content

Instantly share code, notes, and snippets.

@imorrish
Created July 8, 2019 23:11
Show Gist options
  • Save imorrish/4a1e91882d1429864a82061467100890 to your computer and use it in GitHub Desktop.
Save imorrish/4a1e91882d1429864a82061467100890 to your computer and use it in GitHub Desktop.
Blackmagic Design Camera Tally using SDI Shield and Arduino GPIO
/*
SDI Tally interface based
Turns tally of the cameras on and off based on pins pulled low.
This interface is programed for Potential free outputs on a video mixer.
This means that if the tally output of the video mixer is active it will make a connection to ground.
By configuring the inputs with pull-up they are active 5V high and when pulled low to GND it will send that ports tally to the SDI output.
Written by Daniel Wittenaar for free use.
Use code and arduino's with care!! I'm not responsable for any damage caused by using this code!!
When you don't know how electronics work always ask advice from an expert!
I have put a delay(250); in the code. This is for debugging purposes. When done with serial debugging remove or // the delay to have a more responsive interface.
This example code is in the public domain.
You may re-distribute and share this code. But you need to leave this info unchanged and included with the code.
*/
#include <BMDSDIControl.h> // need to include the library
#include <Wire.h> // Included because i had error with the original BMD Lib saying Wire.h did not exist
int PGM1 = 2;
int PRV1 = 3;
int PGM2 = 4;
int PRV2 = 5;
int PGM3 = 6;
int PRV3 = 7;
int PGM4 = 8;
int PRV4 = 9;
BMD_SDITallyControl_I2C sdiTallyControl(0x6E); // define the Tally object using I2C using the default shield address
// the setup function runs once when you press reset or power the board
void setup()
{
Serial.begin(115200);
sdiTallyControl.begin(); // initialize tally control
sdiTallyControl.setOverride(true); // enable tally override
pinMode(PGM1, INPUT_PULLUP);
pinMode(PGM2, INPUT_PULLUP);
pinMode(PGM3, INPUT_PULLUP);
pinMode(PGM4, INPUT_PULLUP);
pinMode(PRV1, INPUT_PULLUP);
pinMode(PRV2, INPUT_PULLUP);
pinMode(PRV3, INPUT_PULLUP);
pinMode(PRV4, INPUT_PULLUP);
}
// the loop function runs over and over again forever
void loop()
{
if(digitalRead(PGM1) == LOW){ Serial.println("PGM1"); }
if(digitalRead(PGM2) == LOW){ Serial.println("PGM2"); }
if(digitalRead(PGM3) == LOW){ Serial.println("PGM3"); }
if(digitalRead(PGM4) == LOW){ Serial.println("PGM4"); }
if(digitalRead(PRV1) == LOW){ Serial.println("PRV1"); }
if(digitalRead(PRV2) == LOW){ Serial.println("PRV2"); }
if(digitalRead(PRV3) == LOW){ Serial.println("PRV3"); }
if(digitalRead(PRV4) == LOW){ Serial.println("PRV4"); }
Serial.println(); // Print New Line
// Use this delay only when you use the Serial Terminal for debug!!
delay(250);
// turn tally ON // Camera Number // Program Tally // Preview Tally
sdiTallyControl.setCameraTally( 1, ( !digitalRead(PGM1)) , ( !digitalRead(PRV1)) );
sdiTallyControl.setCameraTally( 2, ( !digitalRead(PGM2)) , ( !digitalRead(PRV2)) );
sdiTallyControl.setCameraTally( 3, ( !digitalRead(PGM3)) , ( !digitalRead(PRV3)) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment