Monday, April 12, 2010

Joystick Cruelty

It all began with a brand new, unsuspecting force feedback joystick, completely unaware of what was going to happen to it. Little did it know, it was going to meet its destiny.


So, the torture began...


... and it carried on for about 10 whole minutes. You can see the tormenting tool at the bottom of the picture below.


However, it was all for a good cause. After some cutting and drilling, the old joystick became an H-Shifter, mounted right in the place of the actual gear shifter in the BMW E36 center console.




In case you're wondering how the joystick is going to act as a H-shifter, it's all thanks to a great and simple software called FFShifter.

Note. No hardware was harmed while making this blog post. Except for a Logitech 3D Pro joystick.

Thursday, April 8, 2010

Getting Real

I've just made one more step towards building my simulator, by getting a complete BMW E36 dashboard from the scrapyard.

I will probably cut off the passenger side, and keep only the driver side and the center console, where I'm planning to accommodate a H-shifter, which I'm going to build off a force feedback joystick. I have already bought a Logitech 3D Pro which I'm planning to take apart... but more about that in a future post, so stay tuned.

Here's how the dash looks like.

Tuesday, April 6, 2010

Going Live

Both the Arduino and the PC side software are now updated to process the speed and RPM signals coming from Live For Speed.

What's interesting, is that the Arduino (ATMega1280) being single-theaded, I had to write all the code in one function. So, there is only one thread which reads data from the serial port, and as soon as a complete package is received, it updates the control lights and speed / RPM signals.
The speedometer and rev counter are fed with clock signals, whose frequencies vary according to the speed / RPM to be displayed on the dial (the actual speed and RPM sensors on the real car read their values from the rotating wheels/engine crankshaft, thus sending clock-like signals to the instrument cluster). These signals are generated by means of two dedicated timers, also implemented in the same single thread.

Here's a video of the real thing working in LFS.

Moving the Needles

I've finally succeeded in moving the RPM and Speed dials! It took some months, some burned integrated circuits, a useless H-Bridge and two 2N2222 transistors to get them working.

Here's a video showing a test program.

Saturday, March 20, 2010

Connected and Alive

This is probably one of the most important moments in my project's life so far.

In a few words, the dashboard now reflects the exact state of the simulation in Live For Speed, covering for the moment only the control lights.

So, this is what I've done recently.
First, I've ported the original software to the Arduino language and flashed it to the new board. Hooked it up to the dash interface, and voila! The lights were flashing in sequence just as before.
This encouraged me to go to the next step, so I modified a C# code that I had previously found on the web, which connects to LFS using OutGauge, to acquire live data on a UDP connection. I modified this program to send all the data through a serial port to the Arduino board.
The updated Arduino software continously reads data from the serial port (simulated over USB), interprets it, and sends the corresponding signals to the dash interface in order to light up whichever control lights are on in the game.
All of the lights are working, such as turn signals, hazard lights, full beam, traction control, parking brake, shift light, and red line.

Here's the thing in action.

New Grounds

Browsing around the www, I came across this simple, easy to use development board, which seemed just right for my project. As I've said in an earlier post, I want to reduce my efforts as much as possible, so this Arduino MEGA board was just what I was looking for, as it is built around a powerful enough microcontroller, the ATMega1280, it exposes all I/O pins (analog, digital, PWM etc), and has a simple, open-source programming language, as well as a pretty bare IDE which also allows you to upload the software via USB.


Could I ask for more?
Yes. I could wish for ready-made libraries for working with the serial port, PWM and such, but they are already there. And, as an open-source project, it benefits from continuous improvement from all over the world.

I forgot to mention that it's pretty cheap, too.

Friday, March 19, 2010

It's Working!!! (ish)

I've just written a basic software to be flashed to the ATMega chip, which lights up the control lights in the dashboard, one by one.

After some struggling and debugging, I got it working just fine. Except for the needles, which for some reason won't budge.


Interfaces, Interfaces...

Once I figured out the inputs this instrument cluster needs in order to light up control lights and move needles, I started working on the interface board between the ATMega board and the cluster itself.





I need this interface board for the following purposes.
1. Converting the 5V TTL signals coming from the microcontroller, to 12V as expected by the instrument cluster.
2. Because some of the lights come on when their corresponding pin is high (12V), while others when it's low (Ground), I had to provide "source" of current for the first ones, and "sinks" for the others. This meant using two different kinds of buffers (integrated circuits outputting 12V when 5V are being input): the ULN2803 and the UDN2981.

The board features 2 connectors to hook up the ATMega board, and 3 to connect to the dash. A power connector was also installed to bring 12V and 5V voltages from the ATX source.





Controlling Things


I have some experience with AVR microcontrollers, having built an autonomous robot from scratch in my university years, but I've come to a point where I got lazy enough to search for ready-made things rather than building them myself, if it wasn't essential to the "fun factor".

So I got this development board, the "AVR-MT-128" from OLIMEX, built around the ATMega128 chip. It has a LCD display and serial port, which I am going to use to acquire data from the computer. It also appears to have just enough pins to connect it to the dashboard (of course, I'm going to build an interface board).



The Beginning

The saga begins...

... with this instrument cluster which I've just bought, stripped right down from a '92 BMW 325i (E36 model).


I have already figured out the pinout (thanks to some googling), and hardwired it to an ATX power source donated by my late PC.

The Idea

It was one of my childhood dreams to build a hardware racing simulator.

In my dreams it was of course, all high-tech and stuff, just like the ones I could see on TV built by NASA to train their astronauts... but who knows what may come out. All I know is, it's going to be something really challenging and relaxing to work on, no strings attached.