USB R/C Transmitter to Joystick Interface

The above diagram shows a typical configuration for a dual stick joystick with the 15pin Dsub connector. This was the standard connection for joysticks for many years. Now with USB you can create a virtual joystick in Windows and send actual joystick data to the computer via the USB connection instead of your computer reading the position of the analog potentiometers within the joystick.

The old analog joystick works ok but there are two disadvantages with them. First, is that your computer has to figure out the position of the potentiometer. It will do this by setting a register in the internal gameport interface which would discharge a capacitor and then time the period for that capacitor to fully charge. The charge period would vary depending on the position of the potentiometer. This would  be done with the application software (simulator) and it puts extra processing time on your application to determine the joystick position. The second disadvantage is that the accuracy of these joysticks was never the best. The position value would usually jump up or down a few counts even without the joystick being moved.

The USB joystick is a little different. When the USB Joystick is inserted in the computer's port connector it is automatically detected. It then does an enumeration with the computer it is connecting to. The computer will ask the connecting device to send its configuration so that it knows what it being connected. In this case the interface sends the information to set up as a 4 axis, 6 button joystick. Once the computer receives that information you will see in the Gaming Control section of Windows that a joystick is now present. The USB R/C Transmitter to Joystick Interface circuit reads the PPM data from your transmitter and converts the PPM data to Joystick values and sends them to the computer over the USB link. The computer no longer needs to determine the joystick position. The interface tells the computer what the position is. The accuracy of the joystick position is now determined by the interface and not the computer internal gameport interface. So now the computer does not have to waste time determining the joystick position as the interface circuit has already done that and it just sends the position data to the computer and it controls the virtual joystick. Your software will see this device as a JOYSTICK. It does not know if it is an analogue joystick or an USB joystick. The accuracy of the interface circuit is very good and you will see a very precise and stable  joystick that works very well.

 

Before we can send joystick data  we have to read the PPM signal coming from the transmitter trainer jack. So, if you want to know how this interface works the first thing you need to understand is the format of the PPM signal coming from the transmitter. The signal format is similar for the various radio manufacturers but each is slightly different.

If you are familiar with the PPM signal then go on otherwise see the PPM signal format for a full description.

One thing that I wanted was to be able to allow the use different radio types, Futaba, Hitec, Airtronics, and JR, but still use the same hardware. I did not want to build an interface for Futaba and another for JR. By using a circuit that just passes the PPM data pulses you can accomplish this.

 

 

Circuit Description

The power for the circuit comes from the computer USB port. The USB port connector, pins 1 and 4 are connected to the computers 5v supply. No on board regulator is required as the 5v supply from the computer is already regulated. Capacitor C6 are used to help reduce any noise on the 5v supply.   R1, 100k is used to hold the reset pin MCLR high. high

The PIC can operate at many frequencies but if you wish to use the USB features then it must be operated at 24Mhz. The PIC16C745 does not have an onboard oscillator. You can use an external clock, resonator or crystal to generate the clock. If using USB then it is recommended that the crystal be used for the oscillator. There is an onboard 4x PLL so using a 6Mhz crystal will create an onboard 24Mhz clock. C1, C2, and Xtal1 are used to generate the 6Mhz external, 24Mhhz internal clock.

The PPM pulses from the transmitter are presented the the circuit on the left side at term 1, 2. C1 & R2 allow only the PPM pulses to pass through to transistor Q2. R4, R5, & Q2 form a high gain common emitter amplifier. Q2 will amplify the signal and it's output will switch between 0v  and 5v. It will also invert the signal at the output.  Now when large pulses from Futaba or small pulses from JR are amplified by Q2 and the output will look the same for either signal. This signal from Q2 is now applied to the PIC16C745pin 14, which is the RC2, (Port C input/output #2). The PIC will read these pulses and time them to determine a value for each channel.

Once all the channels have been read and the Sync pulse detected then the PIC will move the channel data to the onboard USB engine output buffer. The USB engine will then send the data over the USB link when it is asked to by the computer. The first four channels consist of  Aileron, Elevator, Throttle, and Rudder. The order of these channels depend on the radio manufacturer. See the PPM explanation for details on channel order.  The  interface will determine which brand of transmitter that is being used by analyzing the PPM signal and then it will reformat the order of the channel data. The data for all the various brands is sent to the computer in the order of Elevator, Aileron, Throttle, and Rudder. By sending in that order the sticks on your transmitter will always match the joystick configuration in the Windows Gaming Control. By reformatting the data it makes changing transmitter brands very easy. All you need to do is change the connector to match that of your transmitter either by physically installing a new connector or by using an adapter cable. 

So when a different transmitter is used the interface will detect which type it is and reorder the channel data that it just read from the transmitter and send it in the order that Windows would naturally expect to receive it.

The only hardware required for the USB portion of the PIC16c745 is a 1.5k resistor tied to the D- line. This resistor is what tells the computer that a low speed device just connected to a port. Also a .22uf cap is used to filter the Vusb line. All other USB requirements are supplied onboard the PIC16C745.

This is a very brief description of the Microchip PIC16C745. For a complete understanding check the  Microchip 16C745 datasheet, which requires a PDF reader.