ediabaslib

Build a Bluetooth - D-CAN/K-Line Adapter

To build a Bluetooth adapter it’s now recommended to use the Replacement firmware for ELM327 instead!
You could still use the firmware as a replacement for FTDI based adapters (Only Steps 1 and Steps 2 is required, the firmware update is also possible).

This chapter describes how to build a D-CAN/K-Line adapter with bluetooth support.
This firmware is not supported any more, use it at your own risk!

Basically two components are required:

Step2: Program the processor

There is a replacement firmware available that has the following advantages over the standard firmware:

For the first programming of the new firmware you have to connect the MISO, MOSI, SCK, RESET, GND and +5V to a standard AVR programmer (also supply the adapter with 12V). The combined.hex file contains the bootstrap loader and the firmware. The fuses have to be set as follows:

Fuse Value (hex)
Low 0xFD
High 0xDC
Extended 0xF9

Next time the firmware update is possible with UpdateLoader.exe (using CanAdapter.hex).

Step3: HC-05 connector

Now it’s time to add an connector for the HC-05 board. The board requires only GND, +5V, TXD and RXD. But be beware of one problem: The HC-05 operates with 3.3V logic, whereas the converter uses 5V. For TXD signal (output from HC-05) this is no problem, the high level is detected correctly by the ATF16V8, but the RXD signal generated by the ATF16V8 has be be adjusted.
I have used a voltage divider with 1K and 2K connected to ground. The HC-05 TXD signal could be now connected the Pin1 of the PLD (when using the custom.jed file).

Step4: HC-05 configuration

The HC-05 has now to be set into the correct operation mode. Connect it to an USB-TTL converter and attach the KEY pin to 3.3V or press the button on the board (depends on board type) during power on.
Use a terminal program with the following parameters: Baud 38400, 8, N, 1. Make sure that all commands are terminated with <CR><LF>! Now test the connection with the command: AT<CR><LF>. The device must respond with OK<CR><LF>. Now use the following commands to set the operation mode (also see HC-05 specification):

Step5: Replace HC-05 pin header

The pin header of the HC-05 board normally point into the wrong direction, so it will not fit into the adapter case. Remove the pin header and replace it with a new one that points into the opposite direction. Additionally you may have to replace the shrinking tube.

Step6: Add a power switch

If you want to leave the adapter plugged into the OBDII socket, you need a possibility to switch it off. You have to disconnect the pin header as shown in the picture below and add a switch that could be mounted in the empty USB cable space.

Step7: Mount everything together

Plug the modified HC-05 into it’s socket and close the adapter. You should now be able to connect to the adapter via bluetooth from the PC. Make sure you are using a bluetooth chip in the PC and not a USB-TTL converter with HC-05 in master role because this will result in incorrect timing!
When sending strings to the adapter you should at least get an echo from the adapter, otherwise there is a problem with the connections.
You could test reading the ignition pin with the following command (hex values):
82 F1 F1 FE FE 60
The response is (additionally to the echo):
82 F1 F1 FE <state> <checksum> with state bit 0 set to 1 if ignition is on.

Firmware update

With UpdateLoader-win32.exe (application is only in german language) it’s possible to update the firmware via bluetooth. Simply select the COM port and the hex file (CanAdapter.hex, not Combined.hex!) and start update.
The update can only be initiated if there is a valid application in the adapter. When the update via bluetooth is not possible any more, connect the adapter via USB, start the update process and power on the adapter (12V).

FTDI FT232RL 3V3OUT design problem

Some D-CAN cables have a design mistake and the 100nF capacitor is missing at the 3V3OUT.
Before adding the recommended capacitor to the 3V3OUT pin there is ca. 400mV of ripple at the 3V3OUT, after adding the cap there is no ripple.

From the FTDI FT232RL datasheet:
Name: 3V3OUT
Type: Output
+3.3V output from integrated LDO regulator. This pin should be decoupled to ground using a 100nF capacitor. The main use of this pin is to provide the internal +3.3V supply to the USB transceiver cell and the internal 1.5 KOhm pull up resistor on USBDP.
Up to 50mA can be drawn from this pin to power external logic if required. This pin can also be used to supply the VCCIO pin.

Atmel PB4 overvoltage problem

OBD pin 1 go to R6 1K and then the Atmega PB4, in paralell with this is R5 47K to ground.
This creates a voltage divider that reduces the 12V to 11.75V, the absolute maximum rating is 5.5V for the Atmega.
A possible solution is to move the 47K resistor to R6 and then replaced R5 with a 18K resistor.