Tuesday, April 20, 2010

Avionics Bending: VHF NAV Radio


Tonight, I fished the avionics bend for the first of the VHF NAV radio heads that I will use for the Lockheed L-1011 project. Yes, the head is one that is not typical for the L-1011, since the two NAV radios are to the right and left of the autopilot on the glare shield. However, these units are in such great shape that I could not resist.

As you can see from the image below, I used the same board that I designed earlier and used on the three (3) VHF COMM heads. If you want to see the details of the avionics bend, check out the postings I did earlier this month, there I show step by step how I arrived at the modified flight hardware.




Currently, the light plates still use incandescent bulbs, however, once I start the plate restorations, I will rework all instruments to LED lighting.

Thursday, April 15, 2010

Avionics Bending: Fuel System Panel (Prototype)


Today, I developed the prototype for a 8pin switch connector that I will use all throughout the Lockheed L-1011 project. Please forgive the rough appearance of the Fuel System panel, but I have not re-worked the paint on the light plate (we will do that at a later time in the project).

The image below shows the non-I2C version of the prototype. Here, the ATmega32U4 process drives a Darlington array directly. The IC to the left is a 10K Resistor array that I use as pull-ups for the switch inputs.


The image below shows the computer controlling two of the Fuel Panel switched. The right hand side switch for the "TANK 3 PUMPS" has a LOW indicator field illuminated (LED1 + LED3) and the left switch for the "TANK 2R PUMPS" has a FLOW BAR illuminated (LED2 + LED4). All switches have been re-tooled to use the LED's that we started building for the project.


I will post the schematic and the board layout in detail once I get ready to have the generic 16-Switch I/O Boards made.

Tuesday, April 13, 2010

Avionics Bending - Prep Part 2: Fuel System Panel


Still on the Fuel System panel for the Lockheed L-1011 project. In this posting, we will attach an 8pin wire-to-board connector to each switch. There are three different types of switches:

  1. Switches with two horizontal fields
  2. Switches with two vertical fields
  3. Switches with one single field

The Fuel System panel features all 3 of the above.



Here is the pin-out for a switch with two horizontal fields:

Connector Pin 1 ---> Switch Cable 1 (LED 1) Top Field Left
Connector Pin 2 ---> Switch Cable 2 (LED 2) Top Field Right
Connector Pin 3 ---> Switch Cable 3 (LED 3) Bottom Field Left
Connector Pin 4 ---> Switch Cable 4 (LED 4) Bottom Field Right
Connector Pin 5 ---> Switch Cable C (Command Anode)
Connector Pin 6 ---> Switch Cable 10 (Switch Unlatched)
Connector Pin 7 ---> Switch Cable 11 (Switch Latched)
Connector Pin 8 ---> Switch Cable 9 (GND)

Now that all the cables have a connector and the cables are tied together, the madness from the last posting is gone. This is a step that every of the L-1011 panels will go through.

Sunday, April 11, 2010

Avionics Bending - Prep Part 1: Fuel System Panel



In this posting i start the preparation work for the Fuel System Panel of the Lockheed L-1011 project. The first step is to break down the original cabling, remove the pin boards that Lockheed used for the switch connections and attach a 8 pin wire-to-board connector to each switch.

The next two images show the original cabling for the L-1011 Fuel System panel.

1. Back View.


2. Bottom View


In the next image I pointed to the pin boards. Each switch is soldered to a ping with a number of different connections. The pin boards are not really useful for my project, so remove them.


In order to preserve as much of the original hookup wire, I cut the cables right at the point where they had been soldered to a pin on the small boards.


Once all cables have been cut, I roll them up and tie them together for each switch. Looks pretty mad, but in the next preparation step we will clean that up and attach the 8pin wire-to-board connectors.

Friday, April 9, 2010

Original Flight Hardware: Heading/Pitch Mode Panel


I finally added the last panel for the autopilot of the Lockheed L-1011. The panel that completed my set is the HEADING/PITCH MODE panel. It's actually a really neat device, it has a vertical speed dial that is synchronized to the vertical speed of the aircraft and can also be overridden with the dial to the right of it. The idea is that in control wheel steering the pilot would pitch the aircraft to the correct vertical speed and then engage the autopilot. The panel also has the heading input for the automatic flight system.

Below is a picture of the complete autopilot of the Lockheed L-1011. This one is completely analog, the -500 models also had a digital version.


The other switch elements on the panel are:

  • VS ... Vertical Speed (Hold)
  • ALT ... Altitude (Arm / Hold)
  • IAS ... Indicated Airspeed (Arm / Hold)
  • MACH ... Mach Speed (Arm/Hold)
  • HDG ... Heading (Arm/Hold0

The various modes will be indicated on the AFCS Mode Indicators.


Panel Location

Wednesday, April 7, 2010

Avionics Bending - x-Plane Plugin: VHF COMM Raido


In this posting, we will connect the now modified VHF COMM Radio to the X-Plan software. This will close out this avionics bending project for my Lockheed L-1011 project. In the last posting we looked at the firmware code that we loaded on the AT90USB on on the backside of the original flight hardware.

A device driver that I wrote receives the USB data on the computer and puts it into a shared memory segment. I am not showing that code today, but if you are interested to see it, you can drop me a line and I e-mail it to you.

The image below is an output of the USB device driver (it does that in debug mode only).


My X-Plane plug-in does not directly interface with the USB software, it takes a good amount of processing and I don't want to slow down the simulator over time by loading it up with compute intensive attachments, hence, the X-Plane software simple reads the shared memory segment and inserts the code in the the simulator using an XREF. Below, you can see a screen shot that shows the frequency that we selected on the original flight hardware ... except for now it is shown on the COMM radio in X-Plane.



Here is the X-Plane plug-in code that does the magic:

/*
* RadioControl.c
* L1011_SimWare
*
* Created by Curd Zechmeister on 3/29/10.
* Copyright 2010 Area145 Corporation. All rights reserved.
*
*/

#include
#include
#include
#include
#include
#include
#include "XPLMUtilities.h"
#include "XPLMProcessing.h"
#include "XPLMDataAccess.h"

#define ECHOMAX 96

/*
* Simulator Dataword
*/
struct xplnDataWord {

int digit1;
int digit2;
int digit3;
int digit4;
int digit5;

} xplnDataInput, *xplnDataInputPtr;

/*
* X-Plane DataRefs for the L1011 Overhead Panel
*/
/* APU Control */
XPLMDataRef gCockpitRadios;


/* ********************************************************************************************
* * CALLBACK REGISTRATION
* ********************************************************************************************/

float MyFlightLoopCallback(
float inElapsedSinceLastCall,
float inElapsedTimeSinceLastFlightLoop,
int inCounter,
void * inRefcon);

/* ********************************************************************************************
* * PLUGIN STARTUP
* ********************************************************************************************/

PLUGIN_API int XPluginStart(
char * outName,
char * outSig,
char * outDesc)
{



strcpy(outName, "L1011 COM Radio Controller");
strcpy(outSig, "l1011.vhf.com1");
strcpy(outDesc, "Control the Lockheed L1011 Fight Engineer Panels");

/* Engine Start PanelData Refs */
gCockpitRadios = XPLMFindDataRef("sim/cockpit2/radios/actuators/com1_frequency_hz");

/* Register our callback for once a second. Positive intervals
* are in seconds, negative are the negative of sim frames. Zero
* registers but does not schedule a callback for time. */
XPLMRegisterFlightLoopCallback(
MyFlightLoopCallback, /* Callback */
0.3, /* Interval */
NULL); /* refcon not used. */


/* Connect to the shared memory segemtn */
/* Variables */
int iSegmentID;

// Create the shared memory segment
iSegmentID = shmget( 1234, sizeof(xplnDataInput), 0666 | IPC_CREAT );

// attach to the shared memory segment
xplnDataInputPtr = shmat( iSegmentID, 0, 0 );


return 1;
}

/* ********************************************************************************************
* * PLUGIN PAUSE/STOP
* ********************************************************************************************/

PLUGIN_API void XPluginStop(void)
{
/* Unregister the callback */
XPLMUnregisterFlightLoopCallback(MyFlightLoopCallback, NULL);

}

/* ********************************************************************************************
* * PLUGIN DISABLE
* ********************************************************************************************/

PLUGIN_API void XPluginDisable(void)
{

}

/* ********************************************************************************************
* * PLUGIN ENABLE
* ********************************************************************************************/

PLUGIN_API int XPluginEnable(void)
{
return 1;
}

/* ********************************************************************************************
* * PLUGIN RECEIVE MESSAGE
* ********************************************************************************************/

PLUGIN_API void XPluginReceiveMessage(
XPLMPluginID inFromWho,
long inMessage,
void * inParam)
{
}

/* ********************************************************************************************
* * CALLBACK LOOP
* ********************************************************************************************/

float MyFlightLoopCallback(
float inElapsedSinceLastCall,
float inElapsedTimeSinceLastFlightLoop,
int inCounter,
void * inRefcon)
{

int comFrequency;
comFrequency = 0;


/* ********************************************************
* * L1011 COM Panel -- Data Input
* ********************************************************/

comFrequency = ( xplnDataInputPtr->digit1 * 10000 +
xplnDataInputPtr->digit2 * 1000 +
xplnDataInputPtr->digit3 * 100 +
xplnDataInputPtr->digit4 * 10 +
xplnDataInputPtr->digit5 );

XPLMSetDatai( gCockpitRadios, comFrequency );


/* ********************************************************
* * L1011 COM Panel -- Data Output
* ********************************************************/




/* Return 1.0 to indicate that we want to be called again in 1 second. */
return 1.0;
}

Tuesday, April 6, 2010

Avionics Bending - Firmware: VHF COMM Radio

Now that we have completed the hardware modification, I will show you the firmware code that reads the analog radio head dials an translates them into digital information that will be sent to the X-Plane software on the computer. We are getting closer to integrating the radio head into my Lockheed L-1011 project.

Here is what the piece of code below does:

  1. it initializes the hardware
  2. it establishes a USB connection
  3. in an endless loop ... the code decodes the drums and sends the data via USB to the computer

The drums are encoded as follows:


#define digZero 0b00001011 // 0x0b
#define digOne 0b00000011 // 0x03
#define digTwo 0b00000101 // 0x05
#define digThree 0b00001001 // 0x09
#define digFour 0b00001010 // 0x0a
#define digFive 0b00001100 // 0x0c
#define digSix 0b00001101 // 0x0d
#define digSeven 0b00001110 // 0x0e
#define digEight 0b00000110 // 0x06
#define digNine 0b00000111 // 0x07


So below is the code. See the screen shots below for the test output. Tomorrow, we will connect the radio head to X-Plane.


/* *****************************************
*
* The L-1011 Project
*
* Radio Head Firmware
*
* Hardware: Teensy++ AT90USB1286
*
* Author: Curd Zechmeister
*
* Function : Read the radio head input and
* send it via USB to the
* computer.
*
* Revision History
*
* 2010-03-27 Initial Creation
* 2010
*
*******************************************/

#include

#include

#include

#include "usb_rawhid.h"
#include "print.h"
#include "VHFCOM.h"

/* ****************************************
* * Constant Definitons *
* ****************************************/
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#define BUSY_LED_ON (PORTD = _BV(PD6))
#define BUSY_LED_OFF (PORTD = !_BV(PD6));

/* ****************************************
* * Prototyping *
* ****************************************/
int teensyInit();
int USBlink();
uint8_t decodeNybbleFront(unsigned int region, unsigned char nybble);
uint8_t decodeNybbleBack(unsigned int region, unsigned char nybble);

/* ****************************************
* * Global Variable Definitons *
* ****************************************/
uint8_t usbBuffer[64];

/* ****************************************
* ****************************************
* * Main Program Logic *
* ****************************************
* ****************************************/
int main() {

// Variables
unsigned char val1; // Read input value 1
unsigned char val2; // Read input value 2
unsigned char saveVal1; // Save input value 1
unsigned char saveVal2; // Save input value 2
uint8_t i; // Loop counter

// Vaiable init
val1 = 0x00;
val2 = 0x00;
saveVal1 = 0xff;
saveVal2 = 0xff;
i = 0;

// Initialize the Device
teensyInit();

// Initizlize USB Connection
USBlink();

// This is a VHF COM Radio
usbBuffer[0] = COMRADIO; // Device is a VHF communications radio
usbBuffer[1] = COM1; // Device is COM Radio 1

// Input Loop
while( 1 ) {

// Read the 2 input bytes
val1 = PINA;
val2 = PINB;

// Determine if processing necessary
if ( val1 != saveVal1 || val2 != saveVal2 ) {

// Clear the buffer
for (i=2; i<64; saveval1 =" val1;" saveval2 =" val2;" porta =" 0x00;" ddra =" 0x00;" portb =" 0x00;" ddrb =" 0x00;" portc =" 0x00;" ddrc =" 0x00;" ddrd =" 0xFF;" region ="=" nybanalysis =" (nybble" nybanalysis =" (nybble">>4);
nybAnalysis &= 0b00001111;

}

switch( nybAnalysis ) {

case digOne:
return(0x01);
break;
case digTwo:
return(0x02);
break;
case digThree:
return(0x03);
break;
case digFour:
return(0x04);
break;
case digFive:
return(0x05);
break;
case digSix:
return(0x06);
break;
case digSeven:
return(0x07);
break;
case digEight:
return(0x08);
break;
case digNine:
return(0x09);
break;
default:
return(0x00);


}

}


/*
* Nybble Decoder for left hand side of decimal point
*/
uint8_t decodeNybbleFront(unsigned int region, unsigned char nybble) {

unsigned char nybAnalysis;

if ( region == 0 ) {

nybAnalysis = (nybble & 0b00001111);

} else {

nybAnalysis = (nybble>>4);
nybAnalysis &= 0b00001111;

}


switch( nybAnalysis ) {

case digOne:
return(0x01);
break;
case digTwo:
return(0x02);
break;
case digThree:
return(0x03);
break;
case digFour:
return(0x04);
break;
case digFive:
return(0x05);
break;
case digSix:
return(0x06);
break;
case digSeven:
return(0x07);
break;
case digEight:
return(0x08);
break;
case digNine:
return(0x09);
break;
default:
return(0x00);


}

}

// END

Monday, April 5, 2010

Avionics Bending - Flight Hardware Final Prep Part 3: VHF COMM Radio


This is the third and final posting as part of the preparation work of the original flight hardware. Today, we will attach the remaining cables needed for instrument illumination, drill holes in the back plate and attache the PCB to the backside of the instrument. This will complete the hardware modification for the VHF COMM radio head used in my Lockheed L-1011 project.

Step 1: The image on top of the page shows the final cables attached to the respective elements of the original flight hardware and the image directly below shows all the cables cleaned up and tied together inside the radio head.

Step 2: Next, I will remove the back plate (the one that held the original connector) and get it ready for drilling. The holes are needed for the nylon stand-offs with which i will mount the PCB securely to the instrument.


The image below shows the marking for the drilling in black.


Step 3: Now that the plate has been drilled, we can get ready to attach the nylon standoffs. I use nylon, because the mounting holes are not 100% exact and the nylon standoffs can bend a little.


Step 4: Mount the nylon standoffs to the back plate of the VHF COMM radio head.





Step 5: Finally we will attach the connectors to the PCB and mount the PCB to the backside of the radio head.


Below are a few images of the final instrument. Over the next few postings we will look at the C code that will attach the now modified VHF COMM radio head to the X-Plane software platform.


Sunday, April 4, 2010

Avionics Bending - Flight Hardware Prep Part 2: VHF COMM Radio


This posting, is the 2nd part of the preparation work of the original flight hardware for the VHF COMM radio of the Lockheed L-1011 project. In this posting, we will connect the the diode board to a set of connectors that will later interface with the board. The picture above, is where we left of the last time, except for that I have labeled the diodes according to a specific cabling scheme. Click on the image to see the numbers.

Step 1: In the image below you will see that I have prepared two 8 position connectors with roughly 4" cables. I assume you know how to crimp the connector, so I am not showing the steps here. Each of the connectors represents 8bits ... or one byte.


To connect the VHF COMM radio, I need 16bit ... or two bytes. Therefore, we will solder two 8bit connectors into place.


Step 2: Solder the two 8bit connectors into the correct sequence on the diode board.




Step 3: Once all the cables are in place, I will remove the excess leads.


Step 4: Cable Tie the two 8bit connectors and the original cables back together to clean up the cable mess.



Step 5: Mount the diode board back into it's original position in the enclosure.


The image below shows the finished prep work for today's posting. All the cables that will interface with the I/O board will be fed through the opening left behind from the original connector.

Saturday, April 3, 2010

Avionics Bending - Flight Hardware Prep Part 1: VHF COMM Radio


In this posting we will start the preparation work of the original flight hardware. The VHF COMM radio head that I picked for the Lockheed L-1011 project has two drum digits and a diode board that allows selection between the active and the passive frequency. The IO interface needs to connect to several elements in the original flight hardware:

  • frequency toggle switch
  • diode board for the drum encoded frequencies
  • Instrument illumination
  • light plate illumination



Step 1: We will remove the original connector from the housing. The IO board will sit right behind the connector and we will feed the necessary cables through the opening left behind by the connector.




Step 2: Open the cable ties and remove the diode plate so that we can remove the cables that originally ran between the board and the connector. These cables will be replaced with cables to the I/O board.





Step 3: Remove the original cables.




Step 4: Re-drill the connectors ... here is the finished cleanup work for today.