Project showcase
NexGen Flight Simulator: Radio Interface

NexGen Flight Simulator: Radio Interface © CC BY-NC

An Arduino-based radio interface for older radios including ARINC 410

  • 2,649 views
  • 0 comments
  • 3 respects

Components and supplies

Ardgen mega
Arduino Mega 2560 & Genuino Mega 2560
×1
C-3436A/ARN-30 Surplus Aircraft Radio Head
×1
Relay (generic)
This relay is Arduino ready
×1
Nylon Screws & Nuts 4-40
×1
Molex Right Angle Power Connector #15-24-4441
×1
11026 02
Jumper wires (generic)
×1
Wire Wrap IC Socket -16 pin
×4
Wire Wrap Female DB-25
×2
13268 01
SparkFun Snappable Protoboard
×1

Apps and online services

Ide web
Arduino IDE
Python Scripting Language

About this project

The first rule is to do No Harm to the avionics, in this case, the radio head. The head is C-3436A/ARN-30. On the Internet, I found TM 11-1520-211-35 which is the devices manual. So it's has 3 ARC connectors on the back and we could not get the pin-out. Luckily I had built an interface cable a few years ago. The Cable has three(3) ARC connectors on one end and two (2) male DB-25 females on the other. So grab the DVM and start pinning it out.

So you have your pin out so now what?

Please Note: The ARC family of connectors where used from before WWII to the start of Vietnam, they are very hard to find. 

THE ANALYSIS: OK, this radio is like most others but simpler, and not ARINC-410.  So I have to define what goes in (commands) and what comes out (information). The information side will be called Transmit and the command side Receive.

Transmit Side

  • Power Switch: Two States: On - Off
  • Frequency: 108 to 126 in unit steps, plus a Blank
  • Frequency Fractions: .00 to .90 in unit steps.
  • Volume Control: Analog output
  • Squelch Control: Analog output

Receive Side

  • Panel Lights: Two States: On - Off
  • Dial Lights: Two States: On - Off


Since the lamps are 24 volts, we will need a relay to drive them. Now I am old school so I normally wire-wrap my one-offs. Please note the Molex connector, part number 15-24-4441  is a standard power connector, normally found on your hard-drive. I also used Nylon 4-40 hardware (no shorts).

Lastly, I wrote a small python script to receive the output and put it on my screen.

If you wish to read more about my simulator please read my blog at Element14.

If you wish to read more about DIY Cockpits please see cockpitfestusa.

or Simulators Cockpit Builders List.  

Code

Python Test Script for C-3436 Radio HeadPython
This Test Script is run in a Linux Terminal Session. You must first find the USB port number "/dev/ttyACM0" with a program called lsusb.
import serial

ser = serial.Serial (
   port 	= '/dev/ttyACM0',
   baudrate 	= 115200,
   parity	= serial.PARITY_NONE,
   stopbits	= serial.STOPBITS_ONE,
   bytesize	= serial.EIGHTBITS,
   timeout	= 10
)

while True:
  print ( ser.readline())

ser.close ()
C-3436A.outlineArduino
This is the code outline, I like to outline my code as its easier to understand later
radio outine
C-3436A.h
1. define pins arrays and inilize them. Fpin[] & Hpin[] and power and panel light
2. define what the pins will be.
   pinMode(F[n], PULLUP);
   pinMode(Plight, OUTPUT);
3. define data arrays frac[] & hund[] and power and panel light.
4. define alt data arrays frac[]0 & hund[]0 and power and panel light.
5. define and inialize the two look up arrays flu[]={} and hlu[]={}
6. define 4 test variables: ftest, htest, ftest0, htest0.

-----
void() {
void init()
}
-----
init.c
  void init()
does reads on the arrays F[] & H[] and variable Pwr 
and assigns them to frac0[], hund0[] and variable Pwr0
the values for ftest0, htest0 are calulated.
-----
FORMATS:

send_message() 
START BYTE  (0-7)   == FF
hund 4 bits (8-11)  == hlu(htest)
frac 4 bits (12-15) == flu(ftest)
switches: 
power (16) = pwr
unused (17-24)

recv_message()
START BYTE (0-7) == FF
COMMANDS (0-15):
1. Send Status Message
2. Set Plamp ON
3. Set Plamp OFF

-----
void loop()
   check for input: Serial.Read(ifavilable()){ decode(); }
   read all the fractions: frac[i] = Digital.Read(H[i]);
   read all the hundreds:  hund[i] = Digital.Read(H[i]);
   calulate the values:    ftest, Htest;
   if( ftest != ftest0 or htest != htest0 or pwr != pwr0 ) { 
       send message to RSS
       swap variables and arrays. frac0[] = frac[], hund0[] = hund[], pwr0 = pwr }
   else { do nothing };
C3436A.hArduino
This is my header file. It's used is to separate the variables from the code base.
/*
 * C-3436A.h
 *
 *  C. Harrison	Aug 21, 2014	Creation
 *
 */


// we need to list the digital input pins:

// Pin defs
// please note: arrays F[] & H[] are being indexed 1-5 
int F[]= { 0, 22, 23, 24, 25, 26 };
int H[]= { 0, 30, 31, 32, 33, 34 };

int powerpin = 20;
int dial_light = 40;
// now we need the variables & arrays

int frac[6];
int hund[6];
int frac0[6];
int hund0[6];
int pwr, pwr0;
int ftest, ftest0;
int htest, htest0;
C-3436A.inoArduino
This is the program I wrote to "test" the software. This software does not have my protocols for how the Arduino will talk and listen to the Radio Sub System in NexGenin place.
/*
 * C-3436A
 *
 *  C. Harrison	Aug 30, 2014	Creation
 *
 */

#include "C3436A.h"


void setup(){
  void modes();
  Serial.begin(19200);
  Serial.println("C-3436A awake");
  void init();
}


void loop(){
 int i;
 //  check for input: 
 while( Serial.available()) {
   char data = Serial.read();
   if( data == '!') {
     char cmd = Serial.read();
     char dat = Serial.read();
     char eol = Serial.read();
     if( cmd = 1 ) {
       // panel light}
       if( dat = 0 ) {
       digitalWrite( dial_light, LOW); }
       if( dat = 1 ) {
       digitalWrite( dial_light, HIGH); }
       }}
       
 
 //  read all the data
 for( i= 1; i <  6; i++ ) { 
   frac[i] = digitalRead( F[i]);   
   hund[i] = digitalRead( H[i]); }
   pwr     = digitalRead( powerpin );
 //  calulate the values:    ftest, Htest;
 int ftest, htest, ftest0, htest0, pwr, pwr0;
 
 ftest = decode_F(calc_F());
 htest = decode_H(calc_H());
 
 if( ftest != ftest0 or htest != htest0 or pwr != pwr0 ) {
   //send message to RSS
   swap();  }
 else { 
      ; }  // Do Nothing
}}

int decode_H( int data ){
  int code[][2] = {{13,0},{9,108},{11,109},{5,110},
               {27,111},{16,112},{30,113},{2,114},
               {23,115},{8,116},{28,117},{1,118},
               {7,119},{4,120},{24,121},{20,122},
               {6,123},{18,124},{17,125},{10,126}};
               
   for( int i= 0; i < 22; i++ ) {
      if( data == code[i][0]) {
        return code[i][1]; }
}}

int decode_F( int data ){
  int code[] = {20, 5, 8, 2, 16, 4, 1, 9, 10, 18 };
  
  for( int i= 0; i < 10; i++ ) {
      if( data == code[i]) {
        return i; }
}}

int calc_F(){
  int temp = ( F[22] + (F[21]*2) + (F[20]*4) + (F[8]*8) + (F[7]*16));
  return( temp );
}

int calc_H(){
  int temp = ( H[19] + (H[18]*2) + (H[17]*4) + (H[5]*8) + (H[4]*16));
  return( temp );
}

void swap(){
  for( int i = 1; i < 6; i++ ) {
    frac0[i] = frac[i];
    hund0[i] = hund[i]; }
    ftest0   = ftest;
    htest0   = htest;
    pwr0     = pwr;
}

void modes(){

pinMode( F[1], INPUT_PULLUP);
pinMode( F[2], INPUT_PULLUP);
pinMode( F[3], INPUT_PULLUP);
pinMode( F[4], INPUT_PULLUP);
pinMode( F[5], INPUT_PULLUP);

// hundreds array
pinMode(H[1], INPUT_PULLUP);
pinMode(H[2], INPUT_PULLUP);
pinMode(H[3], INPUT_PULLUP);
pinMode(H[4], INPUT_PULLUP);
pinMode(H[5], INPUT_PULLUP);

// Now we have to assign the power switch pin

pinMode( powerpin, INPUT_PULLUP);

// Now we have to assign  the digital output pins

pinMode(dial_light, OUTPUT);

}

// we need to read the first time so while in loop the test will not fail.
// read all the pins and put then in arrays
void init(){
	int i;

for( i=1; i< 7; i++){
    frac0[i] = digitalRead(F[i]);
    hund0[i] = digitalRead(H[i]); }
    ftest0   = decode_F(calc_F());
    htest0   = decode_H(calc_H());
    pwr      = digitalRead(powerpin); }

Schematics

C-3435A Wiring Spredsheet
C-3436A.ods

Comments

Similar projects you might like

Arduino Altair 8800 Simulator

Project tutorial by David Hansel

  • 58,459 views
  • 107 comments
  • 135 respects

Arduino Traffic Light Simulator

Project tutorial by Zachary Haslam

  • 8,041 views
  • 1 comment
  • 20 respects

Simple Programmable Robotic Arm

Project showcase by Ryan Chan

  • 49,020 views
  • 63 comments
  • 145 respects

Simple FM Radio

Project tutorial by Alexander

  • 28,326 views
  • 13 comments
  • 25 respects

Android App-Based Home Automation System Using IOT

Project tutorial by Team Autoshack

  • 24,854 views
  • 17 comments
  • 75 respects

DIY Flight Instruments for Horizon and Compass

Project tutorial by Aritro Mukherjee

  • 24,294 views
  • 15 comments
  • 55 respects
Add projectSign up / Login