Skip to content

Instantly share code, notes, and snippets.

@tomfanning
Created May 5, 2017 12:53
Show Gist options
  • Save tomfanning/b2f4eb9ecf9554238c3653efbbff59ae to your computer and use it in GitHub Desktop.
Save tomfanning/b2f4eb9ecf9554238c3653efbbff59ae to your computer and use it in GitHub Desktop.
Trivial crossband repeater controller
/*
* Trivial crossband repeater controller
* Yaesu FT-1500m to Baofeng with carrier detect pin brought out
*
* 1k resistor to NPN transistor base on D5 and D6
* Baofeng PTT pin to D5 transistor collector
* Yaesu data port PTT pin to D6 transistor collector
* FT-1500m data port SQL line to A0
* Baofeng CD line to A1
*
* FT-1500m speaker output pin to Baofeng mic in
* Baofeng audio out to Yaesu mic jack audio in pin (data jack audio in does not seem flat)
*/
int yaesuSqlSensorPin = A0; // select the input pin for the potentiometer
int yaesuSqlSensorValue = 0; // variable to store the value coming from the sensor
int baofengSqlSensorPin = A1; // select the input pin for the potentiometer
int baofengSqlSensorValue = 0; // variable to store the value coming from the sensor
const int yaesuSqlThreshold=200;
const int baofengSqlThreshold=50;
void setup() {
Serial.begin(9600);
pinMode(5, OUTPUT);
pinMode(6, OUTPUT);
digitalWrite(yaesuSqlSensorPin, INPUT_PULLUP);
digitalWrite(baofengSqlSensorPin, INPUT_PULLUP);
}
bool baofengPtt = false;
bool yaesuPtt = false;
void loop() {
// read the value from the sensor:
yaesuSqlSensorValue = analogRead(yaesuSqlSensorPin);
baofengSqlSensorValue = analogRead(baofengSqlSensorPin);
if (true){
if (yaesuSqlSensorValue > yaesuSqlThreshold && !baofengPtt){
Serial.println("Keying up Baofeng");
baofengPtt = true;
digitalWrite(5,true);
} else if (yaesuSqlSensorValue < yaesuSqlThreshold && baofengPtt){
Serial.println("Baofeng PTT off");
baofengPtt = false;
digitalWrite(5,false);
}
if (baofengSqlSensorValue < baofengSqlThreshold && !yaesuPtt){
Serial.println("Keying up Yaesu");
yaesuPtt = true;
digitalWrite(6,true);
} else if (baofengSqlSensorValue > baofengSqlThreshold && yaesuPtt){
Serial.println("Yaesu PTT off");
yaesuPtt = false;
digitalWrite(6,false);
}
} else {
Serial.println(baofengSqlSensorValue);
delay(200);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment