To advance the state of the art in networked and mobile systems by ε

Main menu

Tag Archives: serial

This post is about a special networked device: a slot car track and how to connect it via Bluetooth to a PC, laptop, or mobile phone.

At Christmas we had a lot of fun playing with my nephew’s brand new slot car track: a Carrera 132 digital — so everything I write here applies to this specific slot car track, although I believe that it’s at least applicable to all other digital models from Carrera. I realized that what used to be analog some (ten) years ago now is digital and has a connection to a so-called “PC Unit”. After searching a little bit, I found out that this is nothing else than a serial connection using TTL-level signals. By connecting a PC with the right software (which you can get for free), you get a lap counter, you can measure lap times, etc.

However, this PC Unit from Carrera has two drawbacks:

It costs about 65 EUR — a lot of money for a simple box that just converts TTL-level serial signals to an USB interface.

It is wired, i.e., you have to place your PC or laptop close to the track and cannot easily connect wireless devices like smartphones or tablets that do not have an USB port.

Therefore, I decided to connect the slot car track through a cheap Bluetooth-Serial module. With this module, the slot car track will behave as a Bluetooth device implementing a serial profile (“wireless serial port”).

The Circuit

The key component is the HC-06 Bluetooth-Serial module depicted below.

This module costs about 8 EUR at ebay (including shipping from China). Be sure to get a slave module, so the PC can act as the master establishing the connection to the slave module. This module takes as input 3.3 V to 5 V TTL-level signals, just fine for the PC Unit socket of the slot car track.

The Bluetooth board has a voltage regulator on board that works with 3.6 V to 6 V. Actually, the PC Unit connector (PS/2 socket) has a 5 V output (see figure of socket below). Although I believe it would provide enough power for the Bluetooth module, I did not want to risk to ruin the slot car track of my nephew on Christmas for obvious reasons 😉 Therefore, I decided to use a separat 5 V voltage regulator to convert the 14.4 V output of the PC Unit socket to 5 V.

The circuit is very simple as can be seen below.

You have to cross-connect the RX and TX pins of the PC Unit socket and the Bluetooth module. As voltage regulator (IC1) you can use an L7805 or L4940V5, for instance. To stabilize the output, you should add a small capacitor (C1; I used 22 uF, but you can also use higher values without problem).

The PC Unit X1 is a PS/2 connector. Below you see the pins labeled with the numbers from the schematic above. Be sure not to mix up 14.4 V and ground, or RX and TX!

The pins of the Bluetooth-Serial module are nicely labeled as can be seen on the photos above.

Configuring the Bluetooth Module

The serial port of the track uses 19200 baud, 8 bit, no parity bit, and 1 stop bit. By default, the Bluetooth module uses 9200 baud, so we have to change the configuration of the Bluetooth module. To this end, you can use an FTDI breakout board (see below) that converts TTL-level signals of a serial connection to USB. BTW: you can also use this board to connect the slot car track with a cable to the PC or laptop; although this somehow defeats the purpose of this whole post 😉

This board is connected to the Bluetooth module, and as long as no wireless device is connected to the Bluetooth module, you can configure it using AT commands. You need a serial terminal software to this end, e.g., putty. Be sure to use the connection settings 9200/8/N/1 initially until you have changed it.

Depending on the Bluetooth module you got, the AT commands might be slightly different. For my module, you can change the baud rate to 19200 baud with

AT+BAUD5

You have to be fast enough when you type in this command. The module does not wait for the final line feed! So better copy&paste this line to your serial terminal. The module should respond with “OK19200”. If you are not sure whether your connection works, you can first simply type in AT. Then the module should respond with “OK”.

You can also change the name of the Bluetooth device using the following command (where “SLOTCAR” is the new name here):

AT+nameSLOTCAR

Of course, you can use any other name than SLOTCAR.

Testing it

To test it, first try to connect your PC or laptop via Bluetooth to the module. The pairing code is 1234 for my module. The module has an LED that flashes while there is no connection, and is permanently on if it is connected to a remote master device. Be sure to configure the serial port of the Bluetooth device on your PC to 19200/8/N/1.

To further test is — and finally use it 🙂 — I downloaded the X-Lap software from Carrera. When you start this software, it tries to connect to the slot car track using all available serial ports. Your Bluetooth serial port should work automatically.