Saturday, May 14, 2005

Getting the original guages to work

RVC Gagues electronics scheme

After we managed to make the gauges work by "implanting" servo's in them, we decided that it's not good enough, since we would like the original car to remain unmodified as much as possible.

The guages needles move according to the frequency that they receive. Since it is impossible to generate those frequencies from Windows (or any other non real-time OS), we needed to move into hardware (yeah!).

We decided to go with Atmel AVR microcontroller chips (mainly because that's what we could easily find in Israel). We got a sample of an ATMEGA16 and wrote some C code to generate the frequencies (WinAVR and AVRlib). Since this is the first time we used this platform it took us a few hours to get it working.

Generating the frequencies is not enough -- you need the PC to ask the microcontroller to generate the right frequency according to the speed/rpm in the game. Unfortunatelly, the AVR cannot speak directly with an RS-232 interface, so we had to connect a MAX232 chip in order to get it working.

The sequence is as following: there is a process on the PC which collects the games telemtry with Nascar 2003 APIs. It then translate the speed/rpm to commands which are written to the microcontroller via a COM port. The microcontroller parses the requests and set the frequencies to the gauges accordingly.

Nice :-)