USB - Bluetooth multiprotocol OBD II adapter
on OBD - UART interpreter STN1170
with galvanic isolation.
Version 1.0 USB.



ATTENTION!!!
This project is not commercial. All materials in this article are provided "as is". The author and the companies Scantool.net LLC and OBD Solutions have the exclusive right to copy and replicate the materials of this article.


..A little background:
In 2007 I purchased an adapter ELMScan 5 Bluetooth Scantool.net LLC which has two interfaces for communication with PC: good old COM port and Bluetooth. It was built on the famous processor is an ELM327 and was used by me in conjunction with the program ScanXL Professional from Palmer Performance Engineering INC. All this shit, of course I was happy, but.. As expected, began shoveling" Internet searching equipment, which allows to communicate with the ECU of the vehicle according to the J2534 Protocol. Attention was focused on the adapter Tactrix Open Port 2.0 well and other.... But as a good customer I decided to ask a question in Scantool.net whether they are at present ready-made solutions, not to "city" and not "tulit hunchback to the wall". They wrote, what they say, ask on the forum, there you will meet the developers-engineers. Oh, and I wrote... the Result was ! the Russian response and it contained a recommendation to visit the website Ford Focus Club, where a group of enthusiasts has developed and collects the so-called "club" adapters, which are based OBD - UART multi-Protocol interpreter STN1170. This microcontroller PIC24HJ128GP504-I/PT. Manufacturer Microchip. But most importantly, of course - this is the firmware inside that implements the processing function RS232 requests from the diagnostic and broadcast them into control signals for interfaces, OBD II, as well as receive data from the OBD II interfaces and broadcast their signals for RS232 diagnostic software.
Information for those who might be thinking about trying self-programming of the controller PIC24HJ128GP504-I/PT: the Firmware is the intellectual property of the company Scantool.net LLC and does not exist "in nature" separately from the controller. Draw your attention to this fact because in my mail was a letter with thoughts of self-programming MCU...STN1170. The appearance.
The documentation and description of the interpreters of the family STN11XX available on the official site Scantool.net LLC or on the website of the developer of the firmware: OBD Solutions
Visit website Ford Focus Club and acquaintance directly with the subject was the starting point of events that ultimately resulted in this article.
In General, examining the description and documentation I realized that I had stumbled on a very robust thing, but build it will require money, time and nerves. But fear the eyes and the hands, as they say, do. All obstacles were overcome. The set of requirements specification is made. In fresh adapter when powering nothing they blew and when connecting to different cars, without jumpers, cutting tracks and hanging additional conductors tested all protocols, i.e., the manufacturer happened "in one pass". First was the idea to make the exact same adapter as do Ford Focus Club, the fact that its developers kindly gave me his version of a file printed circuit Board of the device. But there it was.. Yes maybe it's for the best. The fact that developed in the Ford Focus Club adapter is collected on the base of the SMD size 0805, 0603 and places.. 0402. I am having difficulties with the acquisition of sizes 0402 and quartz resonator GEYER KX-9A. It was decided to apply the standard size 1206 and make his own version of the PCB. Moreover, the dimensions of the adapter for me was non-critical. It was also decided to implement galvanic isolation and to improve the section ISO9141-2, using it instead of the transistor switches specialized driver K and L lines MC33199D. This driver was used by me in the previous, simpler K-L adapter and proved to be a very good side.
...It makes no sense to start a project without having the main component of the microprocessor STN1170, so I contacted Scantool.net and started to figure out how I could buy and get at least one instance. Having received the answer I just I was shocked. They wrote that can give me THREE instances as advertising!!! So on June 16, 2013. I sent them your details and at the end of July I have come processors from the USA! In parallel, in St. Petersburg, the company Advanced Electronics were ordered such highly specialized and therefore have difficulty purchasing items as: NCV7356; PESD1CAN; MMBZ27VCLT1; BAT54SW; MMBT3640; MMBT3646. These accessories come in mid-August. It remains the most erotic: a printed circuit Board. While "driving" processors and components I did not sit still, and projected cost. Had to sweat, but it seems like with grief in half, and this part of the project was brought to an end. Multiple error checks have been identified. Everything turned out pretty tight. But there was a small but useful hitch. The fact that I have relatively long for their projects fees alone do not, with rare exception. Because abandoned ordinary installation and do everything in SMD. Because "scrap". Because of the known on the Internet "LIT" - Laser-Ironing Technology IMHO - fucking around with the song.. Because choosing a person for the right price makes a good Board industrially. And here it happened "puncture". He looked at my sketch and said that the need to increase the external diameter of the through-holes, otherwise their antediluvian equipment can "fluff" the drill by. That would entail pererabotka Board. Nerves on it I already was and I found in our city firm, which, to my great joy, watching the sketch informed me that my PCB to them is "oak".. What is this 3rd grade. And they can do the 5th layered. In short, paying for two, with a green mask, Hm Board "space" (and what to do?) 2133 ruble I got 10 days ready ..4! Board. 2 PCB, type, bonus!. When I took them in hand, I realized that the guys eat their own bread for a good reason!! Actually what to say? Watch it: Factory of PCB`s "Electroconnect" They have a certification of "RosAtom", the "Russian Federal Space Agency", the Military register. All! Questions.net! Well, that is actually the whole background. Then came the Assembly and field trials, which, as described above, took place without a hitch.

Schematic diagram v1.0:

OBD-2 adapter STNScan v1.0 Schematic diagram.

The communication interface with PC performed on the USB - UART converter FT232RL. Communication UART with STN1170 is along the lines RXD, TXD. The signal line #DTR performs a hardware reset of the MCU ST1170 in the opening of the port. The signal line CBUS04 internal bus UART is used for output of the MCU STN1170 from sleep mode.
FT232RL USB UART is powered by the USB bus and is electrically connected with PC only. For galvanic isolation with on-Board network of the vehicle used digital isolators from Analog Devices - ADuM1100AR. This circuit solution I used for the first time in ISO9141-2 adapter described here and IMHO, for security purposes and the safety of diagnostic equipment and ECU, galvanic isolation required for such equipment as diagnostic interfaces. Receiver line RXD UART and transmitters lines TXD, #DTR, CBUS4, eat from the USB bus. In turn, the transmitter line UART_TX STN1170 and sinks lines UART_RX, RESET, SLEEP powered in common with the STN1170 voltage 3.3V century
Power section is made on the voltage regulators VR1 and VR2, respectively, voltage 3.3 and 5.0 century On the elements of F1; VD1; TVS1; made protection against reverse polarity when connecting the adapter to the vehicle electrical system and excess, as well as shots of the supply voltage. The chain of R5,R6 - divider for an input ANALOG_IN microcontroller potential, the value of which is calculated voltage vehicle electrical system.
Field-effect transistors Q1-Q3 are the keys that control the power to the circuit in sleep mode. System operation Power SaveTM described in the documentation on the STN1170.
The switches SW1, SW2 are used to supply power to the microcontroller during a firmware upgrade over USB without connecting to the onboard vehicle network..
Button BTN1 "Reset" performs a hardware reset of the microprocessor. Button BTN2 "NVM Reset" and hold it for more than 5 seconds in the down state returns to the default factory settings of the processor. This situation, for example, may occur when setting the maximum critical speed of data exchange between the processor and the USB, UART, which may be lost communication with the program terminal RS232.
Section tires SW CAN HS-CAN MS-CAN collected on specialized CAN transceivers. Section ISO9141-2 on specialized driver K and L lines MC33199D. Chip IC8 inverts the signals between the STN1170 and ISO9141-2 driver. Developers STN1170 initially provided using NPN transistor switches to control the K and L lines, so the input and output signals ISO_RX, ISO_K_TX, ISO_L_TX to work correctly with MC33199D had to invert.
Section J1850 contains two comparators, a voltage regulator and discrete elements. Special attention should be paid to the fact that the transistors MMBT3640 and MMBT3646 provide very fast switching times and they can be replaced with only either similar or higher performance.
The outputs of the sections conjunction with the ECU removed the connector DRB15M that connects to the main cable OBD. The cable is self-made, wiring pins DRB15M supposedly the same as the cable from the scanner Launch X431. According IDUs DRB15M=>J1962M found on the Internet.
Features of cable:
Line K; L; made of single wires. J1850BUS+; J1850BUS-, bus MS CAN and HS CAN - twisted pair. Bus SW CAN also twisted pair. One wire - SW CAN H from o transceiver CANH NCV7356. The second - GND.

Pinout of main cable:
Main OBD-2 cable. Pinout.
Photo of the finished adapter version 1.0:

Adapter STNScan v1.0 Top layer of the Assembly. Adapter STNScan v1.0 the Lower layer mounting.



Version 1.1
USB - Bluetooth.

In this part of the article describes the following, the final version of the adapter, equipped in addition to USB, optional wireless interface for communication with PC, implemented using Bluetooth technology. This interface is used mainly in the case when using the adapter diagnostics of the vehicle and the stability of the connection with the ECU not critical. I want to note the speed of the adapter on the STN1170 connected via BT in comparison with brand ELMScan 5 Bluetooth ELM327. Both adapters connected to the vehicle program ScanXL Professional. STN1170 demonstrates approximately a five-fold increase in performance compared to the ELM327. This is especially noticeable when using the monitor mode or the recording of several parameters of the engine.

Schematic diagram v1.1BT:

OBD-2 adapter STNScan v1.1BT schematic diagram.

The numbering of the elements of the schematic diagram version 1.1 is different from the version 1.0!

The first, which touched on the changes - circuit of galvanic isolation. In version 1.1 the four insulator ADuM1100AR replaced by one, a four channels - ADuM1401CRWZ, having a transfer function of the inputs and outputs in tristable state. Also, crystal HC49S SMD replaced by Geyer KX-13. These changes allowed us to optimize the circuit Board and place it on the released place connector W module, a key management food and tristable buffer NL17SZ125DTT1G.
Bluetooth module, when connecting the adapter to the USB deactivated. The radio module is de-energized and its output TXD, using einverseremove tristable buffer IC3 is disconnected from the line UART RX MCU STN1170. The power management BT module is implemented using the key with optical isolation from the USB bus and comprising an optocoupler IC1 and transistor Q1. Also with this key is removed, the control signal for translation in tristable state of the inputs and outputs of the isolator IC4 when working through BT interface.
Now I would like to pay attention to the actual BT interface and that unforgettable "sex", which I was for the "most nehochu" provided in close contact with this remarkable technology:):)

First was purchased module SPBT2632C2A from ST Microelectronics.

SPBT2632C2A

Attempt to "inject" it into the scheme, to bend to his will and forced to work as it was accompanied by multiple "sex", profanity medium, and large "rise", other amenities, and ended with the fact that this module has a place of honor in the box on the shelf. May be I will use someday, somewhere. But not with STN1170. After this "Bluetooth-preludes" I have gained some useful knowledge in this area, but despite this still seems insufficient, if I continued my experiments with module

BLE112 by Bluegiga.

BLE112

Given previous experiences, have sex with this module was very short. The module was placed in the same box as the first.. And so I decided to turn to our friends, the Chinese. And try the module from the series HC-04 - HC-07. The benefit is this product in the region of 300-400 RUB. Yes and praise him. Well, I ordered on E-Bay and am waiting. And the most important thing for the New Year is.. And mail - our mother, but also in the new year and after the new year days to work is bad.. to put it mildly..
Broke my patience, I go to Avito.ru and buy there Chinese ELM327 with Bluetooth. I have disassembled him, tore out of there, of course the above module, mounted to your breadboard.

HC-06

And here it is, the moment of truth! As they say in advertising: "consistently excellent results". Everything works as it should.
Well, enough of the lyrical digressions. Now consider the above situation, but from a technical point of view. Can anyone, after reading not eat the cones like my..


The trouble started with the use of the very first SPBT2632C2A module. When I mounted it on the breadboard, it immediately contacted the PC, and it transmitted data-it received it perfectly. But, in a barrel of honey, as always there is a fly in the ointment: at the moment of power-up, after" flashing " the HostAct, OBDAct, etc. LEDs, after 3 seconds, the HostAct led begins to flicker continuously with a frequency of about 20-25 Hz. And no actions change the situation until you physically disconnect from each other, for example, the TX pins of the Bluetooth module and UART_RX STN1170. That is, to break the connection electrically. The flickering stops immediately. After restoring the broken connection, the pair: "BT module-STN1170" returns to normal operation. You can work with the microprocessor via the terminal for as long as you want. You can, for example, connect to the car via Scan Master and "diagnose" it to the point of insanity. But as soon as you close the terminal program or Scan Master, the flashing resumes and you need to perform a hardware reset of the module again, or turn off-turn on the power, and then open-close the above circuit.
A little later, the cause of this phenomenon was established. The fact is that in many BT modules, in addition to data transmission, the so-called HCI (Host Controller Interface) is implemented via UART. In other words, using AT commands, the user or the microprocessor can change, if necessary, the module configuration, its output power, communication rules, device name, password, and other system settings. After power is applied to the module, HCI mode is activated and remains active until a radio link is established with another device. The UART interface switches to data forwarding mode. After disconnecting the radio link, the module returns to HCI mode. In the case of SPBT2632C2A, the following happens. 3 seconds after power is applied, the module activates the HCI, sending a message to the UART that it is in AT command reception mode and providing its physical address:

HC-06

The STN1170 firmware interprets this message as some kind of data, reacts inadequately to it and fails. Modules of the HC-XX line, in turn, activate the HCI mode without issuing any information about it to the UART and work with the STN1170 correctly. Thus, unfortunately, the advanced module is not suitable for implementing the Bluetooth interface in the described adapter.. By the way, a little bit about the HCI of the module shown above. Externally, this module is similar to devices from the HC-XX line, but as it turned out, it only has the appearance of HC-XX... Attempts to use its HCI were unsuccessful. Apparently, this is the cheapest possible version of the HC-XX module, and possibly a clone, in the firmware of which HCI is simply not provided.
I would also like, although it is not directly related to the post, but for "bluetoothing of the Russian Federation", to say a few words about BT module BLE112.
Without exaggerating I must say that the Bluegiga products, even to the touch, not to mention characteristics, has its crotononitrile". Range are not small. There are even modules that are paired with similar work at distances of up to 1000m. Interfaces a variety of shaft, the purpose is for any taste and color. So nothing to say, cool! There are products with excellent software flexibility. For example, here is the BLE112 module comes from the factory "empty", without firmware. On the website Bluegiga the developer of the software is available, with which he can develop a firmware that meets the requirements of his project and then compile it to a binary file, which is stitched module. Exactly these two modules I bought as a gift.. Well, there only remains to remember the saying: "do Not mistake the one who does nothing". Maybe some day I will serve the service:):)

Now I would like to detail applied in version 1.1 adapter BT module HC-07. This description and instructions for configuring the module, there is nothing like summarizing, organizing and filing easily found on the Internet a variety of information, sometimes placed in some perverted hypertrophic forms :);):)
Technical information about the module:
Chipset: CSR BC4 + 8MB Flash.
Supply voltage: 1.8 to 3.3 V
The Bluetooth specification 2.0 with EDR. Compatibility with similar modules.
Work only in Slave mode. When flashing supposedly can work in Master mode. Changing the firmware module supposedly you can "transform" into modules from the HC-04 to HC-07. This is for enthusiasts. On the Internet there is a scheme programmer, firmware, methods. Google and Yandex, as they say "help"..
Supported speed UART: 1200; 2400; 4800; 9600; 19200; 38400; 57600; 115200; 230400; 460800; 921600; 1382400 baud.
Asynchronous transfer mode max data rate of 2 Mbit.
The user as needed can change the BT module name, rate of exchange with the UART, the module PIN. To implement these simple manipulation can be connected to the module in the mode of HCI (Host Controller Interface) using UART FT232RL or equivalent UART. In this mode, the module is from the submission to him of the supply voltage and up to the moment of connection on a radio channel from a Master device. Often flashing led indication of operating modes of the module. When installing communication with the Master device light indication changes from pulse to a constant.

The connection to the HCI module is implemented in accordance with the following scheme:

Scheme to work with HCI interface.

It should be noted that in order to avoid "sex":):) when module configuration you want to apply for it power from the same circuit, which feeds on USB-UART. Otherwise the inevitable "deaf" and "dumb" module, and as a consequence, profanity user with different number of storeys:):).
To communicate with the module in HCI mode is used, any suitable program - terminal RS232. You can use "Termite", "Advanced Serial Port Monitor" or anything else. Here are some underwater stones that you want to describe:
1. The terminal should allow to disable the signs of the end of transmission/reception, such as CR; LF 0D; 0A, respectively.
2. Commands should be sent in its entirety. For example, in the string typed AT the command without parameters and then press the "send" button. Answer OK to the accepted command comes about 0.8 to 1 sec.
3. Commands should be typed in capital letters. Capital firmware module "does not understand".
4. To apply changes, you must remove power from the module and again energize it.
HCI mode commands:
ATThe ping module. Answer: OK.
AT+VERSIONDisplays the firmware version of the module. Answer: OKlinvorV1.x
AT+BAUDxSetting the speed UART. Where x is a number from 1 to C (hex). Corresponds to speeds above: 1=1200 baud;......C=1382400 baud. The answer, for example: OK38400.
AT+NAMExxxx where xxxx - the new module name. Answer: OKsetname.
AT+PINxxxx where xxxx - the new PIN. Answer: OKsetPIN.
Actually this description of this undoubtedly is a wonderful module to finish.

And finally photo just described in hardware:)

Prototyping Board, which was then adjusted version 1.1

Prototyping Board v1.1BT

PCB`s v1.1.

PCB V1.1BT top layer. PCB V1.1BT bottom layer.

Bluetooth board module Assembly.

Board of BT module Assembly. The reverse side of the Board BT module.

The adapter board Assembly.

The adapter board v1.1BT Assembly. The top layer. The adapter board v1.1BT Assembly. The bottom layer.

With BT module.


The adapter board v1.1BT with installed BT module. The adapter card v1.1BT with BT module.

Ready adapter in the housing with the cable.

STNScan V1.1BT with cable.

Interested and willing to get additional information, or to talk on this topic - welcome to Ford Focus Club, in the theme or in PM.

Thanks
Peoples:
Digital-Cj. Forum participant Ford Focus Club. Technical advice.
ittrium. Forum participant Ford Focus Club. Technical advice.
Chris Fincher. Engineer of company "Scantool.net LLC". Reviewing plans, Technical advice.
Firms:
"Scantool.net LLC". USA, Phoenix, Arizona. Processors STN1170.
"Advanced Electronics". Russia, st-Petersburg. Delivery of SMD components.
"Terraelectronics". Russia, Moscow. Delivery of SMD components.
"Electroconnect". Russia, Novosibirsk. Factory of PCB`s.

June 2013 - February 2014.
Russia, Rostov-on-Don city.
Scan Service Electronics Lab® by scan11
mailto: scan11@yandex.com




P.S.

An article is available describing the STNScan adapter updated hardware version 2.0BT using a higher performance microcontroller STN2120.

Link to the article: USB - Bluetooth multiprotocol OBD II adapter STNScan with galvanic isolation on the OBD-UART interpreter STN2120.

Back.

To main page.