Control system for Rydes at a repeater

Discussions about the Ryde "Set-top Box" Style Digital ATV Receiver. See https://wiki.batc.org.uk/Ryde_Receiver
Post Reply
g8lce
Posts: 340
Joined: Sun Dec 06, 2015 10:26 am

Control system for Rydes at a repeater

Post by g8lce » Wed Mar 24, 2021 2:53 pm

I have been putting together a control system for up to 4 Ryde RX that may be the next GB3NQ repeater system. I use an Arduino Uno and a 16 way relay board.
Control setup.png
Control setup.png (1.09 MiB) Viewed 2935 times
The Arduino looks at the received signal of the Rydes and either pulses the relay for that Ryde or just switches it. If more Rydes receive a signal the Quad split relay is selected. This should allow the repeater output to show two or more inputs in a 'zoom' call type of way allowing video calling. (also can interrupt a long one way QSO.) The Arduino also controls the power and shut down of the Rydes.

The Python code works but may not be the best programming.
The code so far:
****************************************************************************************************
/* This code is to control up to 4 BATC Ryde receivers and output controls for a quad split to display one DATV signal or up to 4 DATV signals. It also looks after the switching of power to the Rydes.
The code was written by Martin Perrett G8LCE and is for experimentation.
*/

int RelayControl1 = 8; // Digital Arduino Pin used to select video 1
int RelayControl2 = 9; // Digital Arduino Pin used to select video 2
int RelayControl3 = 10; // Digital Arduino Pin used to select video 3
int RelayControl4 = 11; // Digital Arduino Pin used to select video 4
int RelayControl5 = 12; // Digital Arduino Pin used to select quad video
int RelayControl6 = A2; // Digital Arduino Pin used to power RPI
int RelayControl7 = A3; // Digital Arduino Pin used to send hardware shut down to RPI
int RelayControl8 = A4; // Power to Arduino so it switches itself off!
int RelayControl9 = A5; // Received signal on one or more RX

int RX1Pin = 3; //RX1 received signal connected to digital pin 3
int RX2Pin = 4; //RX2 received signal connected to digital pin 4
int RX3Pin = 5; //RX3 received signal connected to digital pin 5
int RX4Pin = 6; //RX4 received signal connected to digital pin 6
int OFFPin = 7; //OFF signal to shut down RPi pin 7


const int WaitToPowerUp = 10000; // 30 seconds
const int WaitToSettleDown = 10000; // 30 seconds
const int WaitForRPiShutdown = 10000; // 30 seconds
const int WaitForArduinoShutdown = 10000; // 30 seconds
const int PulseWidth = 1000; // 1 seconds

int A = 0; // switch state RX1
int B = 0; // switch state RX2
int C = 0; // switch state RX3
int D = 0; // switch state RX4
int Q = 0; // switch state Quad Split
int AA = 0; // switch state RX1 for pulse
int BB = 0; // switch state RX2 for pulse
int CC = 0; // switch state RX3 for pulse
int DD = 0; // switch state RX4 for pulse
int QQ = 0; // switch state Quad Split for pulse


void setup()
{

pinMode(RX1Pin, INPUT);
pinMode(RX2Pin, INPUT);
pinMode(RX3Pin, INPUT);
pinMode(RX4Pin, INPUT);
pinMode(OFFPin, INPUT);
pinMode(A2, OUTPUT); //
pinMode(A3, OUTPUT); //
pinMode(A4, OUTPUT); //
pinMode(A5, OUTPUT); // Digital Arduino Pin used to send hardware shut down to RPI
pinMode(RelayControl1, OUTPUT);
pinMode(RelayControl2, OUTPUT);
pinMode(RelayControl3, OUTPUT);
pinMode(RelayControl4, OUTPUT);
pinMode(RelayControl5, OUTPUT);
pinMode(RelayControl6, OUTPUT);
pinMode(RelayControl7, OUTPUT);
pinMode(RelayControl8, OUTPUT);
pinMode(RelayControl9, OUTPUT);

digitalWrite(RelayControl1, HIGH); // Relay off
digitalWrite(RelayControl2, HIGH); // Relay off
digitalWrite(RelayControl3, HIGH); // Relay off
digitalWrite(RelayControl4, HIGH); // Relay off
digitalWrite(RelayControl5, HIGH); // Relay off
digitalWrite(RelayControl6, HIGH); // Relay off
digitalWrite(RelayControl7, HIGH); // Relay off
digitalWrite(RelayControl8, LOW); // Auduino power stays on!
digitalWrite(RelayControl9, HIGH); // Relay off
delay(WaitToPowerUp);// Wait 50 seconds before RPi powered
digitalWrite(RelayControl6, LOW); // turn RPi on
delay(WaitToSettleDown);// Wait 50 seconds for RPi to come on


}

void loop() {

int rx1State = digitalRead(RX1Pin); // read new state rx1
int rx2State = digitalRead(RX2Pin); // read new state rx2
int rx3State = digitalRead(RX3Pin); // read new state rx3
int rx4State = digitalRead(RX4Pin); // read new state rx4
int OFFState = digitalRead(OFFPin); // read new state OFF


if (rx1State == HIGH ) {
AA = 0;
A = 0;
}
else {
A = 1;
}

if (rx2State == HIGH ) {
BB = 0;
B = 0;
}
else {
B = 1;
}
if (rx3State == HIGH ) {
CC = 0;
}
else {
C = 1;
}
if (rx4State == HIGH ) {
DD = 0;
}
else {
D = 1;
}
if ((A + B + C + D) <= 1 ) {
QQ = 0;
}

if ((A + B + C + D) >= 1) {
digitalWrite(RelayControl9, LOW); // turn on received signal
}

if (((A + B + C + D) >= 2) and ( QQ == 0)) {
digitalWrite(RelayControl5, LOW); // turn on Quad split out
delay(PulseWidth);
digitalWrite(RelayControl5, HIGH); // turn off Quad split out
QQ = 1;

}

if (((A + B + C + D) <= 1) and ( AA == 0 ) and ( A == 1 )) { // RX1 receiving
digitalWrite(RelayControl1, LOW); // turn on rx1 out
delay(PulseWidth);
digitalWrite(RelayControl1, HIGH); // turn off rx1 out
AA = 1;
}

if (((A + B + C + D) <= 1) and ( BB == 0) and ( B == 1 )) { // RX2 receiving
digitalWrite(RelayControl2, LOW); // turn on rx2 out
delay(PulseWidth);
digitalWrite(RelayControl2, HIGH); // turn off rx2 out
BB = 1;
}

if (((A + B + C + D) <= 1) and ( CC == 0 ) and ( C == 1 )) { // RX3 receiving
digitalWrite(RelayControl3, LOW); // turn on rx3 out
delay(PulseWidth);
digitalWrite(RelayControl3, HIGH); // turn off rx3 out
CC = 1;
}

if (((A + B + C + D) <= 1) and ( DD == 0) and ( D == 1 )) { // RX4 receiving
digitalWrite(RelayControl4, LOW); // turn on rx4 out
delay(PulseWidth);
digitalWrite(RelayControl4, HIGH); // turn off rx4 out
DD = 1;
}



if (OFFState == LOW) { // RPi shut down received
digitalWrite(RelayControl7, LOW); // send hardware shut down to RPI
delay(PulseWidth);
digitalWrite(RelayControl7, HIGH);
delay(WaitForRPiShutdown);
digitalWrite(RelayControl6, HIGH); // Power OFF RPi after delay
delay(WaitForArduinoShutdown);
digitalWrite(RelayControl8, HIGH); // Arduino shuts itself off!


}

else {
digitalWrite(RelayControl1, HIGH); // turn off
digitalWrite(RelayControl2, HIGH); // turn off
digitalWrite(RelayControl3, HIGH); // turn off
digitalWrite(RelayControl4, HIGH); // turn off
digitalWrite(RelayControl5, HIGH); // turn off

digitalWrite(RelayControl6, LOW); // turn off
digitalWrite(RelayControl8, LOW); // turn off
digitalWrite(RelayControl9, HIGH); // Relay off
A = 0;
B = 0;
C = 0;
D = 0;
}
}
**************************************************************************************************

When the power is switched on to the Arduino it will power up the RPis and when the power is removed from the Arduino it will take its power from one of the RPis via diodes until it switches that off. The delays are set at 10 seconds at the moment and 30 seconds would be in the final edit.

Martin G8LCE

g8lce
Posts: 340
Joined: Sun Dec 06, 2015 10:26 am

Re: Control system for Rydes at a repeater

Post by g8lce » Thu May 06, 2021 7:30 am

Prototype controller now built and works with upto 4 Rydes. This is only SD at the moment but could be used to switch a HDMI quad split for HD.

https://youtu.be/CG4OmPnsRMs

Martin G8LCE

g8lce
Posts: 340
Joined: Sun Dec 06, 2015 10:26 am

Re: Control system for Rydes at a repeater

Post by g8lce » Thu May 06, 2021 9:30 am

Under the lid of the prototype
Inside the box low res.jpg
Inside the box low res.jpg (1.37 MiB) Viewed 2811 times


Yes it is a lot of wires!

Martin G8LCE

g8lce
Posts: 340
Joined: Sun Dec 06, 2015 10:26 am

Re: Control system for Rydes at a repeater

Post by g8lce » Thu May 06, 2021 9:32 am

This is the Arduino code for the non pulsed version:

*******************************************************************************************************
/* This code is to control up to 4 BATC Ryde receivers and output controls for a quad split to display one DATV signal or up to 4 DATV signals. It also looks after the switching of power to the Rydes.
The code was written by Martin Perrett G8LCE and is for experimentation.
*/

int RelayControl1 = 8; // Digital Arduino Pin used to select video 1
int RelayControl2 = 9; // Digital Arduino Pin used to select video 2
int RelayControl3 = 10; // Digital Arduino Pin used to select video 3
int RelayControl4 = 11; // Digital Arduino Pin used to select video 4
int RelayControl5 = 12; // Digital Arduino Pin used to select quad video
int RelayControl6 = A2; // Received signal on one or more RX
int RelayControl7 = A3; // Digital Arduino Pin used to send hardware shut down to RPI
int RelayControl8 = A4; // Power to Arduino so it switches itself off!
int RelayControl9 = A5; // Digital Arduino Pin used to power RPI

int RX1Pin = 3; //RX1 received signal connected to digital pin 3
int RX2Pin = 4; //RX2 received signal connected to digital pin 4
int RX3Pin = 5; //RX3 received signal connected to digital pin 5
int RX4Pin = 6; //RX4 received signal connected to digital pin 6
int OFFPin = 7; //OFF signal to shut down RPi pin 7


const int WaitToPowerUp = 30000; // 30 seconds
const int WaitToSettleDown = 30000; // 30 seconds
const int WaitForRPiShutdown = 30000; // 30 seconds
const int WaitForArduinoShutdown = 30000; // 30 seconds
const int PulseWidth = 1000; // 1 seconds
const int RX_StopDelay = 4000; // 4 seconds to stop any linear power bounce!

int A = 0; // switch state RX1
int B = 0; // switch state RX2
int C = 0; // switch state RX3
int D = 0; // switch state RX4
int Q = 0; // switch state Quad Split
int AA = 0; // switch state RX1 for pulse
int BB = 0; // switch state RX2 for pulse
int CC = 0; // switch state RX3 for pulse
int DD = 0; // switch state RX4 for pulse
int QQ = 0; // switch state Quad Split for pulse


void setup()
{

pinMode(RX1Pin, INPUT);
pinMode(RX2Pin, INPUT);
pinMode(RX3Pin, INPUT);
pinMode(RX4Pin, INPUT);
pinMode(OFFPin, INPUT);
pinMode(A2, OUTPUT); //
pinMode(A3, OUTPUT); //
pinMode(A4, OUTPUT); //
pinMode(A5, OUTPUT); // Digital Arduino Pin used to send hardware shut down to RPI
pinMode(RelayControl1, OUTPUT);
pinMode(RelayControl2, OUTPUT);
pinMode(RelayControl3, OUTPUT);
pinMode(RelayControl4, OUTPUT);
pinMode(RelayControl5, OUTPUT);
pinMode(RelayControl6, OUTPUT);
pinMode(RelayControl7, OUTPUT);
pinMode(RelayControl8, OUTPUT);
pinMode(RelayControl9, OUTPUT);

digitalWrite(RelayControl1, HIGH); // Relay off
digitalWrite(RelayControl2, HIGH); // Relay off
digitalWrite(RelayControl3, HIGH); // Relay off
digitalWrite(RelayControl4, HIGH); // Relay off
digitalWrite(RelayControl5, HIGH); // Relay off
digitalWrite(RelayControl6, HIGH); // Relay off
digitalWrite(RelayControl7, HIGH); // Relay off
digitalWrite(RelayControl8, LOW); // Auduino power stays on!
digitalWrite(RelayControl9, HIGH); // Relay off
delay(WaitToPowerUp);// Wait 50 seconds before RPi powered
digitalWrite(RelayControl9, LOW); // turn RPi on
delay(WaitToSettleDown);// Wait 50 seconds for RPi to come on


}

void loop() {

int rx1State = digitalRead(RX1Pin); // read new state rx1
int rx2State = digitalRead(RX2Pin); // read new state rx2
int rx3State = digitalRead(RX3Pin); // read new state rx3
int rx4State = digitalRead(RX4Pin); // read new state rx4
int OFFState = digitalRead(OFFPin); // read new state OFF


if (rx1State == LOW) {
AA = 0;
A = 0;
}
else {
A = 1;
}

if (rx2State == LOW ) {
BB = 0;
B = 0;
}
else {
B = 1;
}
if (rx3State == LOW ) {
CC = 0;
}
else {
C = 1;
}
if (rx4State == LOW ) {
DD = 0;
}
else {
D = 1;
}
if ((A + B + C + D) <= 1 ) {
QQ = 0;
}

if ((A + B + C + D) >= 1) {
digitalWrite(RelayControl6, LOW); // turn on received signal
}

if (((A + B + C + D) >= 2) and ( QQ == 0)) {
digitalWrite(RelayControl5, LOW); // turn on Quad split out


}

if (((A + B + C + D) <= 1) and ( AA == 0 ) and ( A == 1 )) { // RX1 receiving
digitalWrite(RelayControl1, LOW); // turn on rx1 out

}

if (((A + B + C + D) <= 1) and ( BB == 0) and ( B == 1 )) { // RX2 receiving
digitalWrite(RelayControl2, LOW); // turn on rx2 out

}

if (((A + B + C + D) <= 1) and ( CC == 0 ) and ( C == 1 )) { // RX3 receiving
digitalWrite(RelayControl3, LOW); // turn on rx3 out

}

if (((A + B + C + D) <= 1) and ( DD == 0) and ( D == 1 )) { // RX4 receiving
digitalWrite(RelayControl4, LOW); // turn on rx4 out

}



if (OFFState == LOW) { // RPi shut down received
digitalWrite(RelayControl7, LOW); // send hardware shut down to RPI
delay(PulseWidth);
digitalWrite(RelayControl7, HIGH);
delay(WaitForRPiShutdown);
digitalWrite(RelayControl9, HIGH); // Power OFF RPi after delay
delay(WaitForArduinoShutdown);
digitalWrite(RelayControl8, HIGH); // Arduino shuts itself off!


}

else {
delay(RX_StopDelay); // To stop any pulsed RX lost signals
digitalWrite(RelayControl1, HIGH); // turn off
digitalWrite(RelayControl2, HIGH); // turn off
digitalWrite(RelayControl3, HIGH); // turn off
digitalWrite(RelayControl4, HIGH); // turn off
digitalWrite(RelayControl5, HIGH); // turn off

digitalWrite(RelayControl9, LOW); // turn off
digitalWrite(RelayControl8, LOW); // turn off
digitalWrite(RelayControl6, HIGH); // Relay off
A = 0;
B = 0;
C = 0;
D = 0;
}
}
*******************************************************************************************************************************

Martin G8LCE

g8lce
Posts: 340
Joined: Sun Dec 06, 2015 10:26 am

Re: Control system for Rydes at a repeater

Post by g8lce » Sun May 16, 2021 12:03 pm

I have now tweeked the delays a little and removed a few lines:

****************************************************************************************

/* This code is to control up to 4 BATC Ryde receivers and output controls for a quad split to display one DATV signal or up to 4 DATV signals. It also looks after the switching of power to the Rydes.
The code was written by Martin Perrett G8LCE and is for experimentation.
*/

int RelayControl1 = 8; // Digital Arduino Pin used to select video 1
int RelayControl2 = 9; // Digital Arduino Pin used to select video 2
int RelayControl3 = 10; // Digital Arduino Pin used to select video 3
int RelayControl4 = 11; // Digital Arduino Pin used to select video 4
int RelayControl5 = 12; // Digital Arduino Pin used to select quad video
int RelayControl6 = A2; // Received signal on one or more RX
int RelayControl7 = A3; // Digital Arduino Pin used to send hardware shut down to RPI
int RelayControl8 = A4; // Power to Arduino so it switches itself off!
int RelayControl9 = A5; // Digital Arduino Pin used to power RPI

int RX1Pin = 3; //RX1 received signal connected to digital pin 3
int RX2Pin = 4; //RX2 received signal connected to digital pin 4
int RX3Pin = 5; //RX3 received signal connected to digital pin 5
int RX4Pin = 6; //RX4 received signal connected to digital pin 6
int OFFPin = 7; //OFF signal to shut down RPi pin 7


const int WaitToPowerUp = 10000; // 10 seconds
const int WaitToSettleDown = 20000; // 20 seconds Used twice foe 40 seconds
const int WaitForRPiShutdown = 15000; // 15 seconds
const int WaitForArduinoShutdown = 10000; // 10 seconds
const int RX_StopDelay = 4000; // 4 seconds to stop any linear power bounce!

int A = 0; // switch state RX1
int B = 0; // switch state RX2
int C = 0; // switch state RX3
int D = 0; // switch state RX4
int Q = 0; // switch state Quad Split
int AA = 0; // switch state RX1 for pulse
int BB = 0; // switch state RX2 for pulse
int CC = 0; // switch state RX3 for pulse
int DD = 0; // switch state RX4 for pulse
int QQ = 0; // switch state Quad Split for pulse


void setup()
{

pinMode(RX1Pin, INPUT);
pinMode(RX2Pin, INPUT);
pinMode(RX3Pin, INPUT);
pinMode(RX4Pin, INPUT);
pinMode(OFFPin, INPUT);
pinMode(A2, OUTPUT); //
pinMode(A3, OUTPUT); //
pinMode(A4, OUTPUT); //
pinMode(A5, OUTPUT); // Digital Arduino Pin used to send hardware shut down to RPI
pinMode(RelayControl1, OUTPUT);
pinMode(RelayControl2, OUTPUT);
pinMode(RelayControl3, OUTPUT);
pinMode(RelayControl4, OUTPUT);
pinMode(RelayControl5, OUTPUT);
pinMode(RelayControl6, OUTPUT);
pinMode(RelayControl7, OUTPUT);
pinMode(RelayControl8, OUTPUT);
pinMode(RelayControl9, OUTPUT);

digitalWrite(RelayControl1, HIGH); // Relay off
digitalWrite(RelayControl2, HIGH); // Relay off
digitalWrite(RelayControl3, HIGH); // Relay off
digitalWrite(RelayControl4, HIGH); // Relay off
digitalWrite(RelayControl5, HIGH); // Relay off
digitalWrite(RelayControl6, HIGH); // Relay off
digitalWrite(RelayControl7, HIGH); // Relay off
digitalWrite(RelayControl8, LOW); // Auduino power stays on!
digitalWrite(RelayControl9, HIGH); // Relay off
delay(WaitToPowerUp);// Wait 50 seconds before RPi powered
digitalWrite(RelayControl9, LOW); // turn RPi on
delay(WaitToSettleDown);// Wait 20 seconds for RPi to come on
delay(WaitToSettleDown);// Wait another 20 seconds for RPi to come on

}

void loop() {

int rx1State = digitalRead(RX1Pin); // read new state rx1
int rx2State = digitalRead(RX2Pin); // read new state rx2
int rx3State = digitalRead(RX3Pin); // read new state rx3
int rx4State = digitalRead(RX4Pin); // read new state rx4
int OFFState = digitalRead(OFFPin); // read new state OFF


if (rx1State == LOW) {
AA = 0;
A = 0;
}
else {
A = 1;
}

if (rx2State == LOW ) {
BB = 0;
B = 0;
}
else {
B = 1;
}
if (rx3State == LOW ) {
CC = 0;
}
else {
C = 1;
}
if (rx4State == LOW ) {
DD = 0;
}
else {
D = 1;
}
if ((A + B + C + D) <= 1 ) {
QQ = 0;
}

if ((A + B + C + D) >= 1) {
digitalWrite(RelayControl6, LOW); // turn on received signal
}

if (((A + B + C + D) >= 2) and ( QQ == 0)) {
digitalWrite(RelayControl5, LOW); // turn on Quad split out


}

if (((A + B + C + D) <= 1) and ( AA == 0 ) and ( A == 1 )) { // RX1 receiving
digitalWrite(RelayControl1, LOW); // turn on rx1 out

}

if (((A + B + C + D) <= 1) and ( BB == 0) and ( B == 1 )) { // RX2 receiving
digitalWrite(RelayControl2, LOW); // turn on rx2 out

}

if (((A + B + C + D) <= 1) and ( CC == 0 ) and ( C == 1 )) { // RX3 receiving
digitalWrite(RelayControl3, LOW); // turn on rx3 out

}

if (((A + B + C + D) <= 1) and ( DD == 0) and ( D == 1 )) { // RX4 receiving
digitalWrite(RelayControl4, LOW); // turn on rx4 out

}



if (OFFState == LOW) { // RPi shut down received
digitalWrite(RelayControl7, LOW); // send hardware shut down to RPI

delay(WaitForRPiShutdown);
digitalWrite(RelayControl9, HIGH); // Power OFF RPi after delay
delay(WaitForArduinoShutdown);
digitalWrite(RelayControl8, HIGH); // Arduino shuts itself off!


}

else {
delay(RX_StopDelay); // To stop any pulsed RX lost signals
digitalWrite(RelayControl1, HIGH); // turn off
digitalWrite(RelayControl2, HIGH); // turn off
digitalWrite(RelayControl3, HIGH); // turn off
digitalWrite(RelayControl4, HIGH); // turn off
digitalWrite(RelayControl5, HIGH); // turn off

digitalWrite(RelayControl9, LOW); // turn off
digitalWrite(RelayControl8, LOW); // turn off
digitalWrite(RelayControl6, HIGH); // Relay off
A = 0;
B = 0;
C = 0;
D = 0;
}
}

******************************************************************************************************************
This stops the received signal relay firing while the RPi is booting and other streamlining...

Martin G8LCE

Post Reply

Return to “The Ryde Digital ATV Receiver”