Archived

This topic is now archived and is closed to further replies.

USB+Fanatec interface for Logitech G25 Pedals+Shifter Proto

49 posts in this topic

Making some progress today. I've added a couple of jumper blocks to select which ports the

ADC sample and the another to select between USB power and Fanatec power.

I decided to add a second PS/2 port so there is an IN and OUT and keep the fanatec part

of the circuit seperate from the Logitech DB9 ports. I've hooked up the ADC via a couple

of 330 Ohm resistors and the ADC data I'm getting is looking ok. I'll be adding some sense

pins so the firmware knows what mode the circuit is in automatically. I've tested the

Logitech pedals via the PS2 ports and the fanatec sequential & H shift via the PS2

and the LCD is working it just needs some tweaking to sort gear detection and pedal

ranges. I'll test the Logitech shifter via the PS2 port later tomorrow and see how well it

works. The physical geometry is different so not too sure how its going to work, not

so easy to map reverse gear.

Share this post


Link to post
Share on other sites

Heres a picture of what its looking like now. Pretty close to the final layout.

The two DB9 ports in the top right corner are used when you want Logitech

pedals and shifter going to USB on the PC. The two lower PS2 ports are in a

pass through configuration so one side goes to the Fanatec wheel the other

goes to either fanatec shifter/pedals or Logitech shifter/pedals or even

a generic set. I've yet to test how well the Logitech shifter will work in this

configuration. In either setup the LCD will display gear selection and

percentage each pedal is pressed. I'll enable a couple of buttons so you can

interact with a menu for tuning thresholds etc. as mentioned previously.

Its possible to connect up an extra 3x displays externally and a bunch of buttons

on the bus the LCD is currently connected. The PIC18F chip is nearly fully maxed out ;)

I have pedal ports on the DB9 and the PS2 wired to take both the standard

potentiometer based pedals as well as the fanatec digital based clubsport

pedals, just need to sort firmware to autodetect and manage the protocol.

The central jumper block configures wether the ADC samples the DB9 ports

or the PS2 ports and the lower one selects between USB power or PS2 port

power. Later on I can swap the jumper blocks for digital switches so it

automatically configures itself by sensing where the power is coming from.

I'm just kind of blogging away here as I work on this project is anyone liking

what they see ? I found the threshold tuning makes the shifter perform

better,as you can lock the gears in faster. Alot of fun driving a sim with

hardware that you created yourself especially when you know it gives you

a performance advantage over your competitors. I found it advantageous to see the

pedal position visually when working on high performance cornering as

well as feeling the pressures.

7648423802_b2353d6824.jpg

Cheers

Share this post


Link to post
Share on other sites

Made a little progress this afternoon. I have all the power detection signals

sorted so the circuit can sense when USB or PS2 is plugged in.

Also added some code to init the onboard eusart, planning to add a feature

where you can dump all telemetry to a external serial device.

I wired up some DB9 to PS2 plugs for the Logitech pedals and shifter to test them

on the PS2 passthrough ports. Pedals are ok as expected but the geometry of the

logitech shifter produces a range of signals that the Fanatec wheel is unable

to calibrate so that needs some work to sort. I updated my lcd button board

code and modded the circuit to activate one of the buttons, two more to go

then I start on the menu system. After that I'll be looking at the protocol

for the clubsport pedals. I tested out the logic tool on my PICkit2 both the analyser

and logic modes which worked quite well, the analyser should allow me to

capture the clubsport pedal protocol to figure out the i2c addressing and

data layout. Then I write some code to detect if the clubsport pedals

are plugged in. Theres only one io pin free on the PIC18F2550 and onboard memory

is 70% utilised. This chip can't do everything I had planned for it.

Cheers

Share this post


Link to post
Share on other sites

I have all the buttons decoding on my LCD now and a menu system working.

So it basically has two modes of operation which are "Telemetry Mode" and "Menu Mode".

The three buttons (sw3,sw2,sw1) across the top of the LCD are as follows

sw3 = mode select ( green LED lights up when in telemetry mode)

sw2 = menu select (this also forces an ADC pedal recalibrate when in telemetry mode)

sw1 = next item (scroll the menu items)

sw1 and sw2 will also be used to set values once the sub menu is selected.

Telemetry mode displays gears and pedal data in various forms as well as some of the

button data.

Menu mode allows selection of various sub menus to configure things like the

pedal and gear thresholds, turn on filtering , emulation of various pedal types,

activate external dials or serial port. Fair amount of work ahead to implement

all the menu features.

Share this post


Link to post
Share on other sites

I think its interesting to note that during testing of the circuit using G25

pedals I noticed that the my gas pedal can lose up to 5% of its top end

due to issues with the pots or mechanical variations. (ie you go slower but not notice)

I can force a recalibrate which does help sometimes but if things dont sit right eventually the

auto calibration process which is operating all the time hits a high value

which next pedal press you dont always get back to. So you end up operating

at 95% full throttle, which is something you likely would'nt notice in most

sims. So I've decided to introduce another threshold set for maximum pedal positions.

The same thing could be achieved physically by fitting a mechanical stop

mechanism to each pedal so it does'nt go full travel and hit the zero ohms position on the pot.

These pedal sets are susceptible to thermal variations in the potentiometers which again

will have an effect on the max an min values readings taken by the ADC, this is why I

added a recalibrate button. I remember watching one of the ISR videos where some guy

had pedal problems during a long race. The reason being I suspect is the pedals heated

up due to ambient temperature increases or the internal frictional heating inside the pot

due to all the movement of the pedals. The increasing heat also increases the resistance

of the potentiometers. If he was using my circuit he could have pressed

a button and cleared the problem ;) A secondary mod to help stop the thermal drift is apply

some cooling to the pots.

So all you guys who are using standard pedal sets with potentiometers. You might

be lagging and not even know it. Thats why you need numerical and visual readouts

on your pedal inputs. Once I get some big LED dials setup i'll present a final video

and show some of the menu features I've implemented. Development will likely

slow down next week as I think I'm about to be offered a contract job for the next

few months.

This problem would'nt effect clubsport pedals with magnetic discplacement sensors.

Share this post


Link to post
Share on other sites

I've added max pedal position thresholds so it hits 100% just before the pedal

reaches its end of travel. This now completely sorts the performance problems

when the pedal is in its minumum and maximum positions. It gaurantees that

when the pedal is not pressed you get a 0% reading or when its fully pressed you

get 100%. You sacrifice a little resolution on the pedal to make it more reliable.

I've actually noticed that sometimes with the old G25 shifter connected to the

Logitech wheel you might hold pressure on the stick pushing it into say 1st gear but it

stays in neutral until you release the stick. I think this is caused by large

variation of values sampled by the ADC exceeding the threshold values that

Logitech chose to determine when the gear is actually selected. All the problems

that occur with pedals also effect the potentiometer type shifters.

Cheers

Share this post


Link to post
Share on other sites

I was testing things last night on my PC using Dirt2 and noticed it was

quite sensitive to pedal inputs on the accelerator. So even a quarter

throttle and the engine is flat out. Which made me realize that I could

implement alternative transfer mappings for the pedal inputs and not just

use a linear one. Tuning the sensitivity of the pedal I think might

be worthwhile and could help promote smoother driving.

I've ordered just about all the components I need to build some nice

LED dials just waiting to hear back on some display driver chips.

I thought I might have a go at putting a multi-view style video together

showing me driving with a pedal view once its all completed.

Has anyone had any experience doing that and can recommend some

video software ?

Cheers

Share this post


Link to post
Share on other sites

I've hit the limit with this circuit, the 18F2550 chip just does'nt have enough

capacity to implement all the features I want. I'll try re-installing the C18

compiler and do a build within the 60 day full feature period and see if it

optimizes the code better. Failing that its start again with a better chip.

This is my test rig for interfacing devices to the fanatec wheel

with the PS2 pass through working.

The logitech pedals work ok and the LCD shows pedal percentages.

The fanatec shifter is working but the code needs tweaking to display

the correct gear.

7744522122_6c83e64e2b.jpg

The is the test setup for the Logitech pedals and shifter connected via

USB to PC. Its fully functional with the gears and pedal percentages

being dispayed on LCD. The menu buttons at the top all work and

I have a basic menu setup which I can traverse but not implemented

the underlying features yet due to the memory limitations mentioned

previously. The thresholds and deadzones are currently hardcoded in

the firmware and working well but the idea is you can tune them with

the menu. The green LED indicates "Telemetry Mode" and one nice

feature implemented is if you press the middle button it resets the

pedal calibration process. Which will fix issues resulting from

environmental or mechanical changes.

7744523412_f4810ccbf6.jpg

I'm still waiting for all the components to arrive to build the full dial set.

In the mean time I'll start building a new prototype with more capacity.

Cheers

Share this post


Link to post
Share on other sites

I've just started tacking together the second version of this interface

with some of the features I could'nt implement in the first one.

I'm not setup to etch boards yet so I'm just rapid prototyping use DIP

components where I can and SMD adapter boards for the surface mount

type as they are easier for me to handle.

Share this post


Link to post
Share on other sites

MrB would be interested to see that the USB data values for the ClubSport pedals

range from 0000 to 03FF hex which is four times the range of the older Logitech pedals .

So the ClubSport pedals are operating with full 10bit resolution when plugged in via USB.

Share this post


Link to post
Share on other sites

I just finished adding some code to the version1 board firmware which sends all

pedal/gear telemetry to the onboard USART port of the 18F2550. Its working

ok at 38400 baud and I can see all the data in my PICKit2 USART terminal. I'll crank

it out to 115200 baud later on and make a test gauge to make sure its stable.

I might investigate adding a read feature so you can send alternate telemetry

to the LCD display and select to view it from the menu.

I really need a decent multichannel digital logic analyser to figure these CSP

properly. The PICKit2 analyser is just not good enough. I purchased a miniprog 3

programmer a while ago and decided to hook it up to the old Fanatec V1 button board

to see if it would read the firmware. It appears to connect ok but looks like

the engineers turned on code protection as it does'nt return any valid code.

So I decided to erase and reflash it just to test the programmer as I have another

V1 board. It has the same MCU as the V1 clubsport pedals a Cypress CY8C24794.

The reflash worked ok :)

Share this post


Link to post
Share on other sites

Specs for the clubsport V1 pedals PS2 serial & USB port communication are as follows.

PS2

pin1 - RX/Axis1

pin2 - TX/Axis2

pin3 - GND

pin4 - 5V

pin5 - Axis3

pin6 - NC

Serial port config

This TTL level serial, you need a MAX232 transceiver to

hookup the pedals to a standard DB9 serial port

8 bits

no parity

1 stop bit

237500 Baud (230400 Baud might work )

Serial protocol - pedals

FF | FF | FF | 80

Acel | Brake | Clutch | HBrake

Request pedal data

A0 | XX | E0 | 80

XX=C0 brake motor off

XX=BF brake motor on

-----------------------------------------------------------------

USB protocol

FF 03 | FF 03 | FF 03 | FF C0

Acel | Brake |Clutch | HBrake

USB protocol - brake vibration motor

F8 09 01 04 00 XX 00

XX=0 motor off

XX=255 motor on (values in between vary the speed)

-----------------------------------------------------------------

The baud rate is close to 230400 but its not quite

right. The best I can figure out is its 237500 based on

the clock rate of the dsPIC33.

dsPIC33 input freq is FIN=12 Mhz

FOSC=FIN * M/ (N1*N2)

=12000000 * 38/(3x2) (M=38, N1=3,N2=2)

=76000000

Fcy= FOSC/2=80/2=38Mhz

BAUD= Fcy/(16*(BRG+1)) (I know for sure that our BRG=0x9)

= 38000000/160

= 237500

I've tested this out by sending the vibration serial command

and have observed that the motor twitches on. The data

stream is 8 bits per pedal but its not a raw range it looks

like an encoded sequence, most likely its carrying the

10 bits of information like in the USB protocol. If I figure

out the coding scheme I'll update this post.

Cheers

Share this post


Link to post
Share on other sites

Just an update for you all. I've completed building the chassis and PCB mount for my

gauge set. Here's a few pictures for you. Each gauge will consist of three 5x7 dot led

characters with different colors in each gauge plus a single tri-color bar. I have

some aluminium face plates to fit over the LEDs on each gauge and just need to cut them

to fit and mount with some stand-off posts. This gauge set will be fairly universal

so you could even use it in a real car. I'll be using it to display the pedal percentages as seen

on the LCD display I tested previously. I also have some large 2.3" 7segment

characters which I'll hookup to show gear selection or possibly something

that will work with the current Fanaled project.

7948129904_54a40ed157.jpg

7948130942_c616c71b11.jpg

7948131924_49724dedf0.jpg

7948133870_52d0ea5857.jpg

Share this post


Link to post
Share on other sites

Hi again.. Heres a couple more pics of my progress building the gauge sets.

I'm planning to use one for pedal percentages and the other for speed,tacho, etc

This is a picture showing all the LEDs installed but without the bezels fitted.

7995054834_996a42955d.jpg

This is the internals partially constructed

7995053409_3e24c11d54.jpg

This is my first successful display test.

7995051067_21fa8a93fb.jpg

First digit displayed

7995310530_7cda721fb3.jpg

Share this post


Link to post
Share on other sites

Heres a short video and a pic of the first gauge set I've constructed with the tri-colour bar

fully functional. I only need to cut the bezels to finish it now. The video shows me testing

the brake pedal. The display is colour coded from the left orange, red and green.

I still have an additional 25 LEDS I could add per gauge, so I was thinking I could add another

row across the top for a rpm/gear change alert. The bezels are held in place with clear nylon

screws which will be back-lit. So I could have multi color leds fitted which

would be used to flash alerts. Also the font can be customized so it

does'nt have to be just numbers that are displayed. Each gauge can have 24 custom

characters stored. The display intensity can be changed under software control. Also the

display chips have a blink feature which allows two sets of data to be output and it alternates

between them. I've engineered the tri-gauge so you can daisy chain them together, a total of

16 individual gauges can be addressed, so you can have five tri-gauges plus a single ;)

I'm planning to write a windows/linux driver for this gauge as time permits so they can be

used standalone. What do you guys think? Any feedback would be appreciated

8032341273_7a4c1b1816.jpg

Share this post


Link to post
Share on other sites

This is attempt number one at creating a bezel to fit the gauges. I used

0.3mm plastic sheet. I would have like to use something slightly thicker

but its all I could source locally. Initially i cut out some 1mm aluminium discs and

was planning to use them as the bezels but it just too much work for me

to drill and file out the aperatures. So I used that aluminium disc as a template and

marked and cut the plastic sheet . Then overlayed the plastic disc on the gauge

marked the standoff post holes and drilled them by hand. Then I cut out some

masking tape to cover the LED modules and sprayed it on the outside with matt black car paint.

I decided to try painting externally as I wanted the matt finish on the outside.

I may paint it on the inner side for a more glossy look. I made some mistakes with this one

so it will be discarded but the next ones should be better.

I mentioned before that there is room to add an extra 25 LEDS per gauge and also I could

back light the screws but I will leave that for a later date and just get them finished

off. Once I get my simdesk painted too I'll put a video together showing them in operation.

8053128941_cea1bf81c1.jpg

Share this post


Link to post
Share on other sites

I updated the picture on the previous post. I reworked the bezels again so the aperature

for the tri-colour bar is a closer fit. I decided to go with painting it matt black on the

external surface. I ended up using nylon electrical tape to mask the aperatures as it produced

sharper edges. The aperatures themselves are gloss. I think it looks a bit better.

I was a little concerned that blocking the characters together might make it hard to distinguish

digits but Its not too bad I think. The advantage having a block of 15x7 LEDS is you can create

a custom font to display or animate whatever you like. So once I have a driver set for this thing

it will become interesting as it is quite a flexible display system for telemetry. Can you visualise

those screw heads blinking various colors ;)

Cheers

Share this post


Link to post
Share on other sites

Hi s4cral, love what you have done, looks really great.  Based on what you have posted I am hoping you may be able to help me.

 

I am looking at making my own "alternative" shifter and button layout for the G27.  It looks like you have already worked out the interface and therefore I am assuming you know what the circuit is inside the shifter.  Are you able to post details of the G27 shifter circuit and/or the interface.  My G27 is still new and I would rather not pull it apart to reverse engineer at the moment. 

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi RD

 

The G25/27 shifter has a couple of 74HC165D 8bit shift registers in it, the data lines are pulled low via a resistor to earth

and the switches pull the legs high to 5V.  The two shift registers are connected in series and do a parallel load to grab all

the button states then they're switched over to serial mode and the two bytes are clocked out.

http://www.nxp.com/documents/data_sheet/74HC_HCT165.pdf

 

Hope that helps .

Cheers

Share this post


Link to post
Share on other sites

Thanks for the reply s4cral.  That sounds pretty straight forward, I've used that technique in plenty of other circuits. 

 

From one I your previous posts I take it the yellow wire from the G25/G27 is used for both the 74HC165 !CS and !PL.  I am assuming this is also tied directly to the 25C01 serial eeprom !CS as well?  Any idea if the eeprom is required for the Logitech to work or calibrate properly?

 

Also from what I have read here and there the H shift is not driven by switches, rather a joystick type setup using two pots (orange and green wires) and the PC driver converts the joystick (H shift) position into the gear selections? 

 

I am thinking if I make a setup where the existing Logitech Gear shifter unit plugs into my gear shifter via the standard 9way, I can then plug my shifter into the steering wheel using another 9way.  In my gear shifter I will have a selector switch to use either the Logitech or my controls.  If I am just replacing the H-shift its pretty easy, If I want to replace buttons as well I will need to replicate the 74HC165 circuit which is sounding pretty straight forward.

 

Thanks again for the info...

Share this post


Link to post
Share on other sites

Hi, I would also like to say that this is a great read, it really looks great!

 

But I am also trying to use the G25 shifter standalone as the FFB of my G25 does no longer work. I had stripped down everything and left the pedals and gearshifter attached to the G25 mainboard which works, but I am now trying to look for a nicer option. I am trying to get an arduino to act as a controller. It should read the pots of the pedals and shifter just fine, but I am tackling the button problem.

 

If I understand right I need to create a clock pulse feeding in to the clock line and !CS & !PL line of the shifter's cable. Referencing to the pinout you provided earlier:

G25 Shifter Pinout: (my colors are different for some reason)
Colour Dplug Description
Black 1,9 +5V
Red 5 SPI input
Orange 4 Axis X
Green 8 Axis Y
Yellow 3 !CS & !PL
Purple 7 Clock
Grey 2 Data
Black 6 GND

 

Then the Data should contain the serialized buttons right?

Share this post


Link to post
Share on other sites

Hi RD

 

The eeprom as far as I can tell does'nt do much, its tied to the pwr led and syncs the current from it controlled by the SPI pin (pin5 DB9 for G25)

Its typical for the H shifter to use X,Y axis and calibrate the H gate.  DB9 Pin 3 !CS for G25 is connected to both !PL pins of the shift registers.

  I did something similar last year have a circuit I built  that can take USB shifters, G25/27 and Fanatec (auto detects shifter mode and type)

 all at once to plug into the V1V2 GTRS modded wheel I built.

 

 

Hi Battlezone

 

  // Procedure to clock button data from G25 shifter
  // Latching data into shift registers via parallel load.
  // clock high before PL transition

  //

  // 1-set !PL low for 8bit parallell load (D0-D7)

  // 2-delay 10us

  // 3-set !PL high  for serial operation

  // 4-loop to clock in bits   (pulse clk low, shift 1 bit, clk high, repeat this 16 times, 10us delay between clk transitions)

 

Yes you are correct serial data appears on DB9 pin2  ;)

 

Cheers

Share this post


Link to post
Share on other sites