TallyArbiter
TallyArbiter copied to clipboard
Raspberry pi GPI to Tally Arbiter
What feature would you like to see added to TallyArbiter?
I'm trying to make a script that will send a tally-signal to Tally arbiter when a GPI on my RPi4b is triggered. Last time i did this i used TSL with salvaged code from tally arbiter, but now it won't work. Is it possible for you to have a look. When it tries to connect to Tallyarbiter I get a error: econnrefused at tcpconnectwrap.afterconnect. Might be me being a noob. Or is there another script i can use for this purpose?
var Gpio = require('onoff').Gpio; //include onoff to interact with the GPIO
var gpi0 = new Gpio(0, 'in', 'both');
var gpi1 = new Gpio(1, 'in', 'both');
var gpi2 = new Gpio(2, 'in', 'both');
var gpi3 = new Gpio(3, 'in', 'both');
var gpi4 = new Gpio(4, 'in', 'both');
var gpi5 = new Gpio(5, 'in', 'both');
var gpi6 = new Gpio(6, 'in', 'both');
var gpi7 = new Gpio(7, 'in', 'both');
var GPIO0 = 'gpi0'
var GPIO1 = 'gpi1'
var GPIO2 = 'gpi2'
var GPIO3 = 'gpi3'
var GPIO4 = 'gpi4'
var GPIO5 = 'gpi5'
var GPIO6 = 'gpi6'
var GPIO7 = 'gpi7'
function sendTSL(Name, GPI, state){
var net = require('net');
var bufUMD = Buffer.alloc(18, 0); //ignores spec and pad with 0 for better aligning on Decimator etc
bufUMD[0] = 0x80 + GPI;
bufUMD.write(Name, 2);
var bufTally = 0x30;
bufTally |=state;
bufUMD[1] = bufTally;
var client = new net.Socket();
client.connect(5544, 'localhost', function() {
console.log('Connected');
client.write(bufUMD);
console.log(bufUMD);
console.log(state);
console.log('sendt');
});
client.on('data', function(data) {
client.destroy(); // kill client after server's response
});
client.on('close', function() {
console.log('Connection closed');
});
}
gpi0.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI0', err); //output error message to console
return;
}
if (value == 1) {
sendTSL(GPIO0, 0, 0); //send TSL state off
} else{
sendTSL(GPIO0, 0, 2); //send TSL state RED
}
});
gpi1.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI1', err); //output error message to console
return;
}
if (value == 1){
sendTSL(GPIO1, 1, 0); //send TSL state OFF
}else{
sendTSL(GPIO1, 1, 2); //send TSL state RED
}
});
gpi2.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI2', err); //output error message to console
return;
}
if (value == 1) {
sendTSL(GPIO2, 2, 0); //send TSL state Off
}else{
sendTSL(GPIO2, 2, 2); //send TSL state RED
}
});
gpi3.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI3', err); //output error message to console
return;
}
if (value == 1){
sendTSL(GPIO3, 3, 0); //send TSL state RED or not
}else{
sendTSL(GPIO3, 3, 2);
}
});
gpi4.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI4', err); //output error message to console
return;
}
if (value == 1){
sendTSL(GPIO4, 4, 0); //send TSL state RED or not
}else{
sendTSL(GPIO4, 4, 2);
}
});
gpi5.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI5', err); //output error message to console
return;
}
if (value == 1){
sendTSL(GPIO5, 5, 0); //send TSL state RED or not
}else{
sendTSL(GPIO5, 5, 2);
}
});
gpi6.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI6', err); //output error message to console
return;
}
if (value == 1){
sendTSL(GPIO6, 6, 0); //send TSL state RED or not
}else{
sendTSL(GPIO6, 6, 2);
}
});
gpi7.watch(function (err, value) {
if (err) { //if an error
console.error('There was an error GPI7', err); //output error message to console
return;
}
if (value == 1){
sendTSL(GPIO7, 7, 0); //send TSL state RED or not
}else{
sendTSL(GPIO7, 7, 2);
}
});
function unexportOnClose() { //function to run when exiting program
gpi0.writeSync(0); // Turn gpi0 off
gpi0.unexport(); // Unexport GPI0 to free resources
gpi1.writeSync(0); // Turn gpi0 off
gpi1.unexport(); // Unexport GPI0 to free resources
gpi2.writeSync(0); // Turn gpi0 off
gpi2.unexport(); // Unexport GPI0 to free resources
gpi3.writeSync(0); // Turn gpi0 off
gpi3.unexport(); // Unexport GPI0 to free resources
gpi4.writeSync(0); // Turn gpi0 off
gpi4.unexport(); // Unexport GPI0 to free resources
gpi5.writeSync(0); // Turn gpi0 off
gpi5.unexport(); // Unexport GPI0 to free resources
gpi6.writeSync(0); // Turn gpi0 off
gpi6.unexport(); // Unexport GPI0 to free resources
gpi7.writeSync(0); // Turn gpi0 off
gpi7.unexport(); // Unexport GPI0 to free resources
sendTSL(GPIO0, 0, 0); //send TSL state Off
sendTSL(GPIO1, 1, 0); //send TSL state Off
sendTSL(GPIO2, 2, 0); //send TSL state Off
sendTSL(GPIO3, 3, 0); //send TSL state Off
sendTSL(GPIO4, 4, 0); //send TSL state Off
sendTSL(GPIO5, 5, 0); //send TSL state Off
sendTSL(GPIO6, 6, 0); //send TSL state Off
sendTSL(GPIO7, 7, 0); //send TSL state Off
console.log('GPIO cleaned up and TSL-states set off');
};
process.on('SIGINT', unexportOnClose); //function to run when user closes using ctrl+c
Hi @evenover, I think the easiest method is to use the OSC Source of Tally Arbiter. It will create an OSC Server and you can send messages to it with a OSC Client library.
Checkout the help of the OSC Source:
We're also working on an Incoming Webhook Source, so you could sent a HTTP Request to set the Tally State, but this is not implemented yet.
I have created a GPIO to TSL program that can read the GPIO pins and send TSL 3.1 to TA. I have not published this yet but am considering it.
Hi Joseph,
is there a chance to get the GPIO to TSL program? I have a show on september 2nd where i need to get tally data from a video matrix and it only supports gpi.
Kind regards
@Mo96M send me an email, my address is on my profile. Thanks!