Tuesday, January 24, 2012

The Scalextric Digital Power Base project (Part 2)

The Electronics


PIC Programming

The first challenge I had building the Scalextric Power Base according to the Electric Images' blue prints was to get all the components and to "burn" the program into the PIC18F2550 processor. I thought it's best to buy just the PIC to start with and try to get it working. I found a test circuit board I created in vocational school for a PIC16F84 processor and thought that it must somehow be possible to use the Ludipipo/JDM programmer on it, even if it's as simple as a programmer can be (only three resistors and a diode). Because the test board was designed for a much smaller PIC than the 18F2550 didn't of course fit, so I taped a breadboard onto one side of the test board and connected power and data to it (see pic).

I had a very tough time getting the programmer to work with the PIC, I almost gave up. I probably tinkered with it for like 4 months! before I got it to work (but don't think I'm that crazy that sat every evening with it, after all it was summer so in total it took me perhaps one or two weeks worth of evenings). On the same time, I got to blow some dust off my rusty electronic knowledge.
The trick that finally made it work was found here, a short but very important notice about a low pass filter on the data line that decouples them from high frequent noise.
After I got the programmer to work, I burned a bootloader (such as the one described in this blog post) into the device to be able to program it via the USB interface instead of using the troublesome serial port. When the USB programming went smooth, I could concentrate on the program itself. It took some trial and error before I understood how the MPLAB IDE and the C18 compiler worked, and I didn't of course want to ruin the bootloader that I finally got into the PIC, which of course required some extra fiddling with linker scripts.

Circuit Board

Now that I got something into the PIC, the next step was to try getting all the required components for the power base. After trying hard to find a place selling the BTS7960B half bridge IC on the net I realized that it is discontinued and is replaced with another one, called BTN7960B. This made it a little bit easier as I now found it on digi-key. While waiting for the components to arrive from the states, I begun designing the more permanent stripboard on which the circuit would sit.

To do this I used an application called VeeCAD, which makes the design phase much easier than trying to figure out a working design on the physical board itself.

Download the VeeCAD file here

When I had all the components that I needed and the design was completed I soldered it all together and tried it out using a car directly connected to the output, and to my big surprise it worked the first time!!






When I later connected the power base to the track and added a lane changer (LC) to the game, some bug/design flaw appeared. When the car moved over the IR-sensor of the LC, the car stopped and the LC made some strange noise. Read more about the problem at SlotForum. I still haven't fix the root problem, but found a workaround (described in the forum thread).

Sunday, January 8, 2012

The Scalextric Digital Power Base project (Part 1)

Introduction


It all started last Christmas when I got a Scalextric slot car track as a present from my wife. Well, actually I was with her buying it, she just convinced me to take it =)

At first it was of course fun to just drive and re-live the childhood, but I had bigger plans for it! As my nephew already had one of these Scalextric tracks I had got inspired and already had came up with a few ideas of what one could do with it.

The first thing I did was to build a lap-time system using micro switches build into the track, sending the switch's state to the computer through a Toradex I/O card to my custom build application that then signaled a program called Ultimate Racer 3 that took care of the race setup, lap-timings etc.

This worked ok, but when I found out what the digital era of slot car racing meant and I stumbled upon a complete electrical schema and source code for the microcontroller at Electric Images, I thought that I just had to try to build one myself!

The goals that I put up for the project was that I at least should be able to do the following with my setup:

  • Control the cars with standard Scalextric hand controllers (duh!)
  • Interface it with the computer using USB
  • Be able to use existing software that can communicate with standard Scalextric power bases (like the C7042), such as SSDC and PC Lap Counter. The original power base uses the RS485 serial standard to communicate with a computer.

The two last bullets does of course require some custom software to translate my data flowing on the USB line to the protocol used by the C7042 device.

In the coming posts I will describe in more detail about how the project has gone so far, what problems I've faced and what new things I've learned.

Monday, January 2, 2012

My first blog post, ever!

After several months of thinking that I should create a blog to post things about my home projects and such on, I finally got it done. So here it is, a new fresh blog, just like the new year, ready to be filled with interesting stuff.

The current project I'm working on is a control and monitoring system for my slot car track and I'll post more info on that soon.

And no, the blog's name is not misspelled ;-)