Medina project (Remote control system)
Thanks for the help I have gotten in my other threads. This is a presentation of my project, which i code named Medina. I will post pictures of the hardware and upload comlete source code when I am finished with this project.
Project goal: Develop a complete battery powered remote system, that can be remotely operated with a amateur radio using standard DTMF tones, or a 433MHz remote. The range for the amateur receiver will be several miles.
The receiver system uses a Wood and Douglas SR500 audio radio receiver a DTMF decoder, a Javelin Stamp and a Quasar QFM-RX1 433MHz receiver. The system has 2 140V AC Relay outputs as well as 4 TTL level outputs. The main board contains three voltage regulators of 3.3 5 and 11Vdc. The system is going to be run by a 9V battery.
Here are the circuit of the main board:
I will update the thread when I have more info.
Project goal: Develop a complete battery powered remote system, that can be remotely operated with a amateur radio using standard DTMF tones, or a 433MHz remote. The range for the amateur receiver will be several miles.
The receiver system uses a Wood and Douglas SR500 audio radio receiver a DTMF decoder, a Javelin Stamp and a Quasar QFM-RX1 433MHz receiver. The system has 2 140V AC Relay outputs as well as 4 TTL level outputs. The main board contains three voltage regulators of 3.3 5 and 11Vdc. The system is going to be run by a 9V battery.
Here are the circuit of the main board:
I will update the thread when I have more info.


Comments
import stamp.core.*; /* Medina RXC Board version: 6.1 Author: searchnaive@gmail.com (C) 2006 - 2008 */ public class RXC{ /* C O N S T A N T S A N D V A R I A B L E S */ // WD SR500 TELEMETRY MODULE final static int wdSigPin = CPU.pin9; // WD S-meter read out pin final static int wdSqlPin = CPU.pin8; // WD Squelsh flag pin final static int wdChAPin = CPU.pin6; // WD Channel select bit A(1) final static int wdChBPin = CPU.pin5; // WD Channel select bit B(2) final static int wdChCPin = CPU.pin4; // WD Channel select bit C(3) static int wdChannel = 1000; // WD Active channel (1000=none selected) final static int wdRSPin = CPU.pin3; // WD RS232 programming pin static Uart wdRxUart = new Uart (Uart.dirReceive, // WD RS232 rxUart wdRSPin, Uart.dontInvert, Uart.speed9600, Uart.stop1); // MT 3270 DTMF DECODER final static int mtSerialPin = CPU.pin2; // MT serial shift in pin final static int mtAckPin = CPU.pin1; // MT Ack pin final static int mtEstPin = CPU.pin0; // MT Est pin final static int mtMaxX = 4; // Number of bits in MT binary code // Timing final static int mtAckResponseDelay = 10; // Delay between Ack pulse and serial read out final static int mtAckEndDelay = 10; // Delay after end of Ack pulse final static int mtSerialPulseDelay = 6000; // Delay between each serial bit pulse // QFM-RX1 RADIO RECEIVER final static int qfmPowerPin = CPU.pin10; // QFM on/off circuit static boolean qfmIsOn = false; // QFM turned on flag final static int qfmSerialPin = CPU.pin7; // QFM serial read out pin // G6S2 RELAYS final static int relAPin = CPU.pin15; // Relay A coil pin final static int relBPin = CPU.pin14; // Relay B coil pin // BUFFERS static boolean mtBit1 = false; // MT binary code buffer for bit 1 static boolean mtBit2 = false; // MT binary code buffer for bit 2 static boolean mtBit3 = false; // MT binary code buffer for bit 3 static boolean mtBit4 = false; // MT binary code buffer for bit 4 static String binBuf = new String(); // Binary 4 bit buffer static String menBuf = new String(); // Menu buffer // MENU SYSTEM static int menuItem = 0; // Number of selected menu static boolean menuItemStored = false; // Menu is selected flag static boolean autOk = false; // Authentication is ok flag static boolean reqAut = false; // Password has been requested flag static int operationMode = 3; /* Operation mode: 3 Developer, no aut required 1 Locked, aut required 2 Unlocked, aut nok required */ // OTHER CONSTANTS static boolean doMainWhile = true; // Make false to terminate program /* MAIN */ public static void main(){ init(); // Run initialization before continuing with the program while (doMainWhile == true){ /* Check for available binary code in MT */ if (CPU.readPin(mtEstPin) == true){ // If MT has data buffered mtReadSerial(); // Read binary code from MT mtConvertBuf(); // Convert binary code to ASCI menuSystem(); // Run menu system } // END if } // END while doMain System.out.println("Program terminated."); } // END main /* I N I T I A L I Z A T I O N */ static void init(){ qfmTurnOff(); wdChannel = 0; // Select new channel wdSelectChannel(); // Switch to selected channel System.out.println("Ready."); } // END init /* S O F T R E S E T */ static void softReset(){ autOk=false; // Reset autOk reqAut=false; // Reset reqAut menuItem=0; // Set menu item to 0 menuItemStored=false; // Reset menuItemStored binBuf=""; // Empty binBuf System.out.println("softReset: Done"); } /* H A R D R E S E T */ static void hardReset(){ autOk=false; // Reset autOk reqAut=false; // Reset reqAut menuItem=0; // Set menu item to 0 menuItemStored=false; // Reset menuItemStored binBuf=""; // Empty binBuf menBuf=""; // Empty menBuf System.out.println("softReset: Done"); } /* Q F M T U R N P O W E R O N / O F F */ // TURN OFF static void qfmTurnOff(){ CPU.writePin(qfmPowerPin, false); // Turn off QFM power qfmIsOn = false; // Set qfmIsOn flag to false(Off) System.out.println("QFM power is off."); } // END qfmTurnOff // TURN ON static void qfmTurnOn(){ CPU.writePin(qfmPowerPin, true); // Turn on QFM power qfmIsOn=true; // Set qfmIsOn flag to true(On) System.out.println("QFM power is on."); } // END qfmTurnOn /* S E L E C T C H A N N E L */ /* This method changes the active channel on the WD SR500 telemetry module. There are 8 channels (0-7) available for selection using the WD paralell channel select system. The method sends a 3-bit binary code using three pins, wdChAPin, wdChBPin and wdChCPin. The method switches to the channel selected by the wdChannel integer set elsewhere in the program. */ static void wdSelectChannel(){ switch (wdChannel){ case 0: CPU.writePin(wdChCPin, true); // Switch to channel 0 CPU.writePin(wdChBPin, true); CPU.writePin(wdChAPin, true); System.out.println("Active channel: 0"); break; case 1: CPU.writePin(wdChCPin, true); // Switch to channel 1 CPU.writePin(wdChBPin, true); CPU.writePin(wdChAPin, false); System.out.println("Active channel: 1"); break; case 2: CPU.writePin(wdChCPin, true); // Switch to channel 2 CPU.writePin(wdChBPin, false); CPU.writePin(wdChAPin, true); System.out.println("Active channel: 2"); break; case 3: CPU.writePin(wdChCPin, true); // Switch to channel 3 CPU.writePin(wdChBPin, false); CPU.writePin(wdChAPin, false); System.out.println("Active channel: 3"); break; case 4: CPU.writePin(wdChCPin, false); // Switch to channel 4 CPU.writePin(wdChBPin, true); CPU.writePin(wdChAPin, true); System.out.println("Active channel: 4"); break; case 5: CPU.writePin(wdChCPin, false); // Switch to channel 5 CPU.writePin(wdChBPin, true); CPU.writePin(wdChAPin, false); System.out.println("Active channel: 5"); break; case 6: CPU.writePin(wdChCPin, false); // Switch to channel 6 CPU.writePin(wdChBPin, false); CPU.writePin(wdChAPin, true); System.out.println("Active channel: 6"); break; case 7: CPU.writePin(wdChCPin, false); // Switch to channel 7 CPU.writePin(wdChBPin, false); CPU.writePin(wdChAPin, false); System.out.println("Active channel: 7"); break; default: System.out.println("wdSelectChannel: Error, switch mismatch."); CPU.writePin(wdChCPin, true); // Switch to channel 0 CPU.writePin(wdChBPin, true); CPU.writePin(wdChAPin, true); System.out.println("Default channel 0, selected."); } // END switch } // END wdSelectChannel /* R E A D B I N A R Y C O D E F R O M M T S E R I A L O U T */ /* This method reads a 4-bit binary code from the MT3270 DTMF decoder. The method sends an Ack to the MT chip, waits for the chip to output the first bit, and reads the bit from the MT serial output pin. If the serial reads a 1 or a 0, it appends it to the binBuf and repeats the process 4 times, to read the whole binary code. The binBuf then contains four characters, that the convertBuf method can translate into an ASCI-character. The MT chip is capacitive coupled to the WD telemetry modules audio output. */ static void mtReadSerial(){ for (int x = 0; x < mtMaxX; x++){ // START SHIFT IN SEQUENCE CPU.writePin(mtAckPin, true); // Start Ack pulse CPU.delay(mtAckResponseDelay); // Ack response delay if (CPU.readPin(mtSerialPin) == true){ // Read from mt serial pin binBuf=binBuf+"1"; // Append a "1" to binBuf } else { binBuf=binBuf+"0"; // Append a "0" to binBuf } // END if CPU.writePin(mtAckPin, false); // End Ack pulse CPU.delay(mtAckEndDelay); // Ack end delay } // END for CPU.delay(mtSerialPulseDelay); // Delay before accepting new input } // END mtReadSerial /* C O N V E R T 4 - B I T B I N A R Y B U F F E R */ static void mtConvertBuf(){ if (binBuf.equals("1000")){ // digit 1 menBuf=menBuf+"1"; System.out.println("DTMF digit 1"); }else if (binBuf.equals("0100")){ // digit 2 menBuf=menBuf+"2"; System.out.println("DTMF digit 2"); }else if (binBuf.equals("1100")){ // digit 3 menBuf=menBuf+"3"; System.out.println("DTMF digit 3"); }else if (binBuf.equals("0010")){ // digit 4 menBuf=menBuf+"4"; System.out.println("DTMF digit 4"); }else if (binBuf.equals("1010")){ // digit 5 menBuf=menBuf+"5"; System.out.println("DTMF digit 5"); }else if (binBuf.equals("0110")){ // digit 6 menBuf=menBuf+"6"; System.out.println("DTMF digit 6"); }else if (binBuf.equals("1110")){ // digit 7 menBuf=menBuf+"7"; System.out.println("DTMF digit 7"); }else if (binBuf.equals("0001")){ // digit 8 menBuf=menBuf+"8"; System.out.println("DTMF digit 8"); }else if (binBuf.equals("1001")){ // digit 9 menBuf=menBuf+"9"; System.out.println("DTMF digit 9"); }else if (binBuf.equals("0101")){ // digit 0 menBuf=menBuf+"0"; System.out.println("DTMF digit 0"); }else if (binBuf.equals("1101")){ // digit * menBuf=menBuf+"*"; System.out.println("DTMF digit *"); }else if (binBuf.equals("0011")){ // digit # menBuf=menBuf+"#"; System.out.println("DTMF digit #"); }else if (binBuf.equals("1011")){ // digit A menBuf=menBuf+"A"; System.out.println("DTMF digit A"); }else if (binBuf.equals("0111")){ // digit B menBuf=menBuf+"B"; System.out.println("DTMF digit B"); }else if (binBuf.equals("1111")){ // digit C menBuf=menBuf+"C"; System.out.println("DTMF digit C"); System.out.println("convertBuf: Clear menuBuf"); softReset(); }else if (binBuf.equals("0000")){ // digit D menBuf=menBuf+"D"; System.out.println("DTMF digit D"); }else{System.out.println("convertBuf: Error 1 - mismatch");} binBuf=""; // Clear buffer to make ready for reception of new DTMF tones } // END mtConvertBuf /* M E N U S Y S T E M */ static void menuSystem(){ } // END menuSystem } // END public class