In memoriam Prof. Dr. Suthi Aksornkitti, † 19.12.2021
✈ The building Blocks • Functional Description
The mastermind of this design is of course the Arduino Nano Every.
When used in "local" mode, there is not much to do for it, as it is mainly used for
the communication to a remote host.
The TTL inputs are optocoupled by an HCPL-2400 (high speed opto-couplers) to avoid ground-loops.
It is build out of an 820 nm AlGaAs light emitting diode with a high speed photodetector.
The status of the switches can be polled whilst in "local" mode.
View inside
✈ The Switch : PE4250 from Peregrine Semiconductor
The Switch "Module"
"The PE4250 is a HaRP™-enhanced Reflective SPDT (single
pole double throw) RF Switch for use in general switching
applications and mobile infrastructure. This device offers a
flexible supply voltage of 3.3 / 5 V, single-pin or complementary
pin control inputs, and 4000 V ESD tolerance." Says the datasheet.
As the values in the datasheet are usually slightly more optimistic than those on a final pcb, we measured the switch as a whole unit,
as it is used in later life.
✈ Downloads
✈ Arduino Sketch - The Code
Double click on code to select ...
/* //////////////////////////////////////////////////////////////////
ARDUINO/Genuino Project "SWITCHMOD-RF", an RF SWITCH
https://www.changpuak.ch/electronics/Arduino-Switchmod-RF.php
Software Version 1.0 - 20.04.2022 by ALEXANDER SSE FRANK,
The Serial Parser was written by Christian Monstein, used in
"Easy_Diseqc V1.2", Monstein ETH Zurich, 20.06.2018
////////////////////////////////////////////////////////////////// */
bool LOCAL = true ;
const int TTL_A = 6 ;
const int TTL_B = 5 ;
const int ENB_TTL_A = 3 ;
const int ENB_TTL_B = 2 ;
const int FORCE_A = 9 ;
const int FORCE_B = 8 ;
int StatusA = 1 ;
int StatusB = 1 ;
// /////////////////////////////////////////////////////////////
// REMOTE SUPPORT
// /////////////////////////////////////////////////////////////
char Device[]="Switchmod (RF) V1.01" ;
char Unique[]="2022-04-02-009" ;
char Remark[]="Enter 'HELP' if you feel lost.";
char tempbuf[80] ; // keeps the command temporary until CRLF
String buffer ;
void SWITCH_A_1()
{
// SWITCH A IS THE TOP ONE
// PORT 1 - COMMON : RED LED
digitalWrite(FORCE_A, LOW) ;
StatusA = 1 ;
}
void SWITCH_B_1()
{
// SWITCH B IS THE BOTTOM ONE
// PORT 1 - COMMON : RED LED
digitalWrite(FORCE_B, LOW) ;
StatusB = 1 ;
}
void SWITCH_A_2()
{
// SWITCH A IS THE TOP ONE
// PORT 2 - COMMON : GREEN LED
digitalWrite(FORCE_A, HIGH) ;
StatusA = 2 ;
}
void SWITCH_B_2()
{
// SWITCH B IS THE BOTTOM ONE
// PORT 2 - COMMON : GREEN LED
digitalWrite(FORCE_B, HIGH) ;
StatusB = 2 ;
}
// /////////////////////////////////////////////////////////////
// LOCAL SUPPORT
// /////////////////////////////////////////////////////////////
void SET_PATH()
{
if(LOCAL)
{
digitalWrite(ENB_TTL_A, HIGH) ;
digitalWrite(ENB_TTL_B, HIGH) ;
}
else
{
digitalWrite(ENB_TTL_A, LOW) ;
digitalWrite(ENB_TTL_B, LOW) ;
}
}
// /////////////////////////////////////////////////////////////
// S E T U P
// /////////////////////////////////////////////////////////////
void setup()
{
delay(4999) ;
Serial.begin(115200) ;
pinMode(TTL_A, INPUT) ; // JUST FOR MONITORING
pinMode(TTL_B, INPUT) ; // JUST FOR MONITORING
pinMode(ENB_TTL_A, OUTPUT) ; // LOCAL
pinMode(ENB_TTL_B, OUTPUT) ; // LOCAL
pinMode(FORCE_A, OUTPUT) ; // REMOTE
pinMode(FORCE_B, OUTPUT) ; // REMOTE
// SWITCH TO LOCAL
LOCAL = true ;
SET_PATH() ;
// BRING SWITCHES IN DEFINED POSITION
SWITCH_A_2() ;
SWITCH_B_2() ;
delay(1999) ;
// AS WE ARE LOCAL, "THE FORCE" MUST NOT INTERFER
SWITCH_A_1() ;
SWITCH_B_1() ;
}
// /////////////////////////////////////////////////////////////
// M A I N L O O P
// /////////////////////////////////////////////////////////////
void loop()
{
// LISTEN TO THE SERIAL PORT
while (Serial.available() > 0)
{
int tmp;
char st[20];
char rx = Serial.read() ; // read a single charecter
buffer += rx; //add character to the string buffer
if ((rx == '\n') || (rx == '\r'))
{
buffer.toCharArray(tempbuf, 40);
// ///////////////////////////////////////////////////////
if (buffer.startsWith("REMOTE"))
// ///////////////////////////////////////////////////////
{
LOCAL = false ;
SET_PATH() ;
Serial.println("SWITCHED TO REMOTE.");
}
else
// ///////////////////////////////////////////////////////
if (buffer.startsWith("LOCAL"))
// ///////////////////////////////////////////////////////
{
LOCAL = true ;
// AS WE ARE LOCAL, "THE FORCE" MUST NOT INTERFER
SWITCH_A_1() ;
SWITCH_B_1() ;
SET_PATH() ;
Serial.println("SWITCHED TO LOCAL.");
}
else
// ///////////////////////////////////////////////////////
if (buffer.startsWith("IDN?"))
// ///////////////////////////////////////////////////////
{
Serial.println("> IDN?");
Serial.print("Device : "); Serial.println(Device);
Serial.print("Unique : "); Serial.println(Unique);
Serial.print("Remark : "); Serial.println(Remark);
}
else
// ///////////////////////////////////////////////////////
if (buffer.startsWith("SWITCH:A:1"))
// ///////////////////////////////////////////////////////
{
if(LOCAL)
{
Serial.println("MUST SWITCH TO REMOTE FIRST.") ;
}
else
{
SWITCH_A_1() ;
Serial.println("SWITCH A : RFC - RF1") ;
}
}
else
// ///////////////////////////////////////////////////////
if (buffer.startsWith("SWITCH:A:2"))
// ///////////////////////////////////////////////////////
{
if(LOCAL)
{
Serial.println("MUST SWITCH TO REMOTE FIRST.") ;
}
else
{
SWITCH_A_2() ;
Serial.println("SWITCH A : RFC - RF2") ;
}
}
else
// ///////////////////////////////////////////////////////
if (buffer.startsWith("SWITCH:B:1"))
// ///////////////////////////////////////////////////////
{
if(LOCAL)
{
Serial.println("MUST SWITCH TO REMOTE FIRST.") ;
}
else
{
SWITCH_B_1() ;
Serial.println("SWITCH B : RFC - RF1") ;
}
}
else
// ///////////////////////////////////////////////////////
if (buffer.startsWith("SWITCH:B:2"))
// ///////////////////////////////////////////////////////
{
if(LOCAL)
{
Serial.println("MUST SWITCH TO REMOTE FIRST.") ;
}
else
{
SWITCH_B_2() ;
Serial.println("SWITCH B : RFC - RF2") ;
}
}
else
// ///////////////////////////////////////////////////////
if (buffer.startsWith("HELP"))
// ///////////////////////////////////////////////////////
{
Serial.println("> HELP");
Serial.println("********* LIST OF COMMANDS *********");
Serial.println("Command to switch to Remote : REMOTE");
Serial.println("Command to switch to Local : LOCAL");
Serial.print ("Current State is : ") ;
if(LOCAL) Serial.println("LOCAL") ;
else Serial.println("REMOTE") ;
Serial.println("Command to switch on RFC-RF1 : SWITCH:A:1");
Serial.println("Command to switch on RFC-RF1 : SWITCH:B:1");
Serial.println("Command to switch on RFC-RF2 : SWITCH:A:2");
Serial.println("Command to switch on RFC-RF2 : SWITCH:B:2");
Serial.print("Status Switch A : ");
if(StatusA == 1) Serial.println("RFC - RF1") ;
if(StatusA == 2) Serial.println("RFC - RF2") ;
Serial.print("Status Switch B : ");
if(StatusB == 1) Serial.println("RFC - RF1") ;
if(StatusB == 2) Serial.println("RFC - RF2") ;
}
buffer = ""; // erase buffer for next command
}
}
}
// /////////////////////////////////////////////////////////////
// END OF FILE.
// /////////////////////////////////////////////////////////////
✈ TTL Operations
The Switchmod - when switched on, (or when set via remote programming to local), will
pass the signals at the ttl inputs directly from an optocoupler to the switch. In case
of doubt, a power-cycle (aka Reset) always brings it back to local operation.
The delay (on/off, off/on) is approx. 100 µs. (Depends on values assembled.)
✈ Remote Operations
✈ Share your thoughts
The webmaster does not read these comments regularely. Urgent questions should be send via email.
Ads or links to completely uncorrelated things will be removed.
Your Browser says that you allow tracking. Mayst we suggest that you check that DNT thing ?