Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

OBDII Communications project

Discuss Control Systems here

OBDII Communications project

Postby acg2010 » Sun Nov 02, 2014 8:08 pm

This is the continuation and on-going experiments with using Flowstone to develop a auto vehicle OBDII monitoring and diagnostic tool. Original thread is here: viewtopic.php?f=2&t=2886&p=15568#p15568

I have mocked up a initialization schematic using a time, counter, and selector to send commands to reset the vehicle OBDII communication, read back the ELM version, and select the protocol. I will expand that to then poll the OBDII for various readings and convert the OBDII hex values and display them in readouts. However, I got tired of working on the Flowstone schematic, then having to go out to my car, connect the OBDII adapter, connect through Bluetooth, then tryout the schematic. Looking for an off-line OBDII emulator, I can across OBDSim by Gary at http://icculus.org/obdgpslogger/obdsim.html

I have installed and set-up com0com and OBDSim and successfully obtained communication and read back the simulated temperature reading. However, after I send the first PID 010c command for the temperature, I can not get any additional readings so I only get the first reading and then the OBDSim just bounces back my command of 010c.

Anyone had any experience with using OBDSim and com0com for virtual com ports?

Please Note: Further updates to this project are further down on this thread
Attachments
ComPort_OBDII_Start16.fsm
(247.35 KiB) Downloaded 3626 times
OBDSim.jpg
OBDSim.jpg (131.46 KiB) Viewed 91992 times
Last edited by acg2010 on Sun Dec 21, 2014 12:22 am, edited 2 times in total.
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: OBDII Communications project

Postby FluxCapacitance » Sun Nov 09, 2014 12:17 am

Hooked everything up on my windows 8 laptop and couldn't get the pull-down listing of COM ports to work. Com menu works ok on my Win 7 PC but it's inside. :x
User avatar
FluxCapacitance
 
Posts: 14
Joined: Sun Feb 02, 2014 2:47 am

Re: OBDII Communications project

Postby acg2010 » Sun Nov 09, 2014 5:14 pm

FluxCapacitance, I have only tried this schematic on Windows XP SP3 as I am too stubborn and too cheap to upgrade to Windows 7 or 8 on my personal computers. The Com port menu module is partly done in Ruby, wonder if that is where the problem lies. I can't verify since I don't have Windows 8, maybe someone else could?

Here is a update on the project.

Again, still having troubles trying to use OBDSim and com0com as emulator. However my OBDII Tester works fine with the bluetooth adapter and while in the vehicle and responses at least as far as my initialize scheme goes. However, I have encountered a problem when trying to poll the OBDII for readings. When the PID is first sent, the OBDII responds with "Searching" , then sends a hex value of the reading. My timer/counter idea for polling the OBDII for parameters therefore does not work since it sends PIDs sequentially before receiving the searching and actual value is sent by the OBDII. Therefore I need to rethink this approach or have a way that times the message received and sent properly.

I have just a basic GUI for now, opting for a tabbed window approach. I still need to finish the bluetooth connection tab, the error code tab (just copy of bluetooth module as place holder for now), and fix the send/receive timing issue. Also it appears that the <CR> control character is being sent twice each time.

I know this could probably be done all in code easier and more efficiently but I just wanted to work with what I had to start. The work goes on.
Attachments
OBDIITester_graphic2.jpg
OBDIITester_graphic2.jpg (74.13 KiB) Viewed 91957 times
ComPort_OBDII_Start25.fsm
(293.48 KiB) Downloaded 3631 times
OBDIITester_graphic1.jpg
OBDIITester_graphic1.jpg (16.78 KiB) Viewed 91957 times
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: OBDII Communications project

Postby acg2010 » Sun Nov 23, 2014 5:53 am

While working on this vehicle OBDII tool, I got frustrated with the OBDSim not working correctly so I could check/test my work off-line (not connected to vehicle). Then I realized why not create a OBDII emulator in Flowstone. Below is my start at the emulator. I tested it with hyperterminal and can achieved connection and response back in hex. Still having trouble with receiving back a "<" prompt properly and changing the knobs for the virtual vehicle parameters cause it to send data without a request. However,it has a lot of potential and should be fully expandable to any virtual vehicle data (O2 senors, VIN, etc.). Someone might find this useful for their projects. There is probably a much better way to do the logic check portion of the schematic.
Attachments
ComPort_OBDII_111614_OBDSimu3.fsm
(372.48 KiB) Downloaded 3697 times
OBDEmulator.jpg
OBDEmulator.jpg (71.78 KiB) Viewed 91794 times
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: OBDII Communications project

Postby JB_AU » Tue Nov 25, 2014 8:04 am

Here is a little project using various parts, with wmic i can detect a usb device when the program loads allowing to connect automatically, adding a simple (tick/if) this schematic can use wmic to check when a device is connected & open the port, i hope you enjoy :D

AUTOCOM.fsm
(59.79 KiB) Downloaded 3762 times
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
 
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: OBDII Communications project

Postby acg2010 » Thu Nov 27, 2014 5:38 am

Very cool AUTOCOM schematic JB_AU, I will have to see how to apply to my project.

Here is a slight update to the OBDEmulator with DTC codes P0100-P0199 with either manual entry or a randomized output.

Below is a capture from communication with hyperterminal as example

Received 3 bytes : "ATI"
Sent 12 bytes : "ELM327 v1.5"
Received 3 bytes : "ATZ"
Sent 2 bytes : "<"
Received 4 bytes : "0105"
Sent 11 bytes : "41 05 97"
Received 4 bytes : "010C"
Sent 13 bytes : "41 05 51 0E"
Received 4 bytes : "0101"
Sent 6 bytes : "P0100"
Sent 6 bytes : "P0161"
Sent 6 bytes : "P0132"
Sent 6 bytes : "P0198"
Sent 6 bytes : "P0148"
Sent 6 bytes : "P0133"
Sent 6 bytes : "P0166"
Sent 6 bytes : "P0152"
Sent 6 bytes : "P0155"
Sent 6 bytes : "P0181"
Sent 6 bytes : "P0187"
Sent 6 bytes : "P0199"
Sent 6 bytes : "P0188"
Sent 6 bytes : "P0144"
Sent 6 bytes : "P0176"
Sent 6 bytes : "P0125"
Sent 6 bytes : "P0158
Attachments
ComPort_OBDII_112614_OBDSimu5.fsm
(378.32 KiB) Downloaded 3613 times
OBDIITester_graphic3.jpg
OBDIITester_graphic3.jpg (88.76 KiB) Viewed 91734 times
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: OBDII Communications project

Postby acg2010 » Mon Dec 01, 2014 1:04 am

Back to OBDII reader project:
Think I have most everything worked out OK now. I was confusing some of the PID commands for temperature and RPMs. Also, timing is a problem between sending the PID command and reading the returned hex value. Also because of the timing, a blank string was being returned inbetween commands and returned hex values causing the display to jump around and not hold the value. I tried lots of sample and hold techniques, read thru all the old SynthMaker forum on sample and hold and finally found Tektoog's blocker modules and found the string one worked to correct the problem. Also I added the command to turn off echo (ATE0) during the initialization procedure so the PID commands were not being read as the PID returned value.

I think I have fixed all the PID and math issues and added a km/hr to mph conversion for speed. Timing seems to work except when ending the polling of values. Somehow this causes a mismatch in the timing. Tried to fix with linking the Stop Polling button to the timer and selector switch to return to initial state. Seems like temp and RPMs work, haven't driven with set up to fully check the speed readout though. Next I need to add the DTC explanations so you know what the error codes read mean. Work continues.
Attachments
ComPort_OBDII_Start25h.fsm
(297.8 KiB) Downloaded 3616 times
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: OBDII Communications project

Postby acg2010 » Sun Dec 21, 2014 12:20 am

Project update - now I have everything working properly (math conversions of hex PID values, sending polling parameters, etc.) except for a couple of nagging issues:

1) Try as I could, I could not find a way of using Flowstone to access the bluetooth device (OBDII adapter) and connect it to the laptop. I did see JB_AU's Flowbluino writeup using bluetooth tools but that would involve having the user to install the tools to get access to the bluetooth device through Flowstone. It appears to be easier, for now to just let the user to open bluetooth program on the laptop and connect to the adapter directly through its icon so for now I will most likely remove the bluetooth tab section from the schematic on the next update.

2) Timing of sending and receiving a PID response is still not 100% accurate. I had to cheat by making a clunky timer that cycles through slower to faster tick timer thus avoiding the "Searching..." response delay . However, the fastest I could reliably poll and receive values accurately was to use a trigger divide factor of 2 on the 100 tick. This still gives fairly good real time data reads. However, ever so often, the timing causes one miss read of the parameters.

I took the system out on the road to test the speedometer readings, and it responded well both digital and "analog" readouts. I added a parameter graphing capability and logging so parameters can be imported into MS EXCEL or similar program for additional evaluation. Please note that corrected raw PID parameter reading need scalliing to show up on the graph properly. I tried graphing the O2 sensor and it match voltage readings similar to that obtained by the Torque program.

If you get a chance to try this out or a version of your own, please let me know what your experience is with it (problems, suggestions, etc.).

Thanks acg2010
Attachments
ComPort_OBDII_Start25K.fsm
(308.91 KiB) Downloaded 3634 times
OBDIITester_122014.jpg
OBDIITester_122014.jpg (37.55 KiB) Viewed 91354 times
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: OBDII Communications project

Postby acg2010 » Sat Dec 27, 2014 1:20 am

New Update (WIP) 12/26/14

This is my attempt to add multiple PID parameter monitoring. I tried speeding up the return value by placing a 1 after each PID command (supposedly cuts the 200ms ELM327 timeout to 50ms), however, with 8 parameters, updates are still slow. The fastest I could send and read accurately was at a 100/20 = 5 per second (100 Tick with trigger divide by 20). I have given the GUI a black and white theme. However, the 7 segment readout displays are sometimes hard to read. Also, due to the slower update speed with 8 PID parameters being monitored, the Speed parameter lags behind actual.

The MPG does not work due to the formula requiring "Speed" which varies, therefore it still needs some work. Also, the O2 sensors do not seem to give proper volt values that I seem to be getting on the graph. Also the graph section is disconnected for now till I get a few things worked out first.

Edit - Just realized from WIKI PID codes that MAF values needs to be divided by 100 and the O2 sensor values need to be divide by 200. Will update and posted revised schematic later.

Coolant Temp, RPMs, and Engine Load seem to read and display properly.

Once I fix the remaining issues, I want to try and build a schematic that will send the 0100 code that lists all useable PID values by the vehicle, then have that populate a PID parameter selection menu. Since my car does not have any error codes, I have not been able to check that part of the system.

Edit - I should mention that I am testing using a bluetooth ELM 327 OBDII adapter paired to a laptop with a USB bluetooth running Windows XP SP3 and testing utilizing a 2003 Mitsubishi Motero Sport vehicle.

To use the OBDII Tool:
1) First set up your adapter per manufacturer's instructions. Connect your PC to the adapter through the Bluetooth software and note what COM port the adapter is assign (it is Com port 6 in my case).
2) Go to the OBDII Tool "Configure" tab and select the appropriate COM port from the drop down menu. Set the Baud rate if different.
3) Turn COM Port switch to right to connect to the OBDII adapter, LED should turn blue if connected.
4) Go to "Initialize" tab and make sure drop down menu is set to Initialize, then hit Initialize button (momentary switch). The AT Commands should show up in the Text viewer window.
5) Select PID parameters you wish to monitor and display from the drop down menues.
6) Select the "Poll Parameters" selection from the drop down menu (same as the Initialize).
7) Turn the switch to "Polling" to activate sending of selected PID values and receiving of Hex return PID values.
8) Go to Display tab to observe parameter values selected displayed.
Attachments
ComPort_OBDII_Start25p_test.fsm
(499.84 KiB) Downloaded 3584 times
New OBDII Tool.jpg
New OBDII Tool.jpg (69.3 KiB) Viewed 91175 times
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Re: OBDII Communications project

Postby acg2010 » Thu Jan 01, 2015 8:04 pm

Making Gauges

Personally, I am not very good at graphic design. However, I wanted to create some gauges for the OBDII tool. I started by looking at lots of tutorials on creating them in Photoshop, Illustrator, Paint.Net (which is the graphics editor that I typically use). But all seemed very long with many steps. I therefore looked for some tools to download or use on-line. I came across the templates of gauges at various auto websites, that I yet to try and work with. I also came across the website of a company that lets you customize gauges on-line to see what they look like before buying:

http://www.speedhut.com

You can make some cool looking gauges, however they are copyrighted. You could use it to get some ideas though and create your own in a graphics editor.

Then I found a free program called Scalemaker Advanced on the X-Plane simulator forum website:

http://forums.x-plane.org/index.php?app ... wfile=2754

You do have to register (free) to be able to download the program. I used it to create a rpm gauge. However, it is pretty basic.

Next I found a website similar to the speed hut that lets you create gauges on-line and then download/copy the png graphic created:

http://www.optixl.com/gauge/

The intent is for use in reports or dashboards, not really auto style gauges. However, I created a mph speedometer graphic (left out the needle). You are allowed to use the created graphic for free.

I then used Paint.Net to place a large dark, thick ring around it and re-sized it. The ring helped hide the bad edge aliasing from the created png gauge graphic ( I tried lots of other things but this seemed to work the best so far). This is brought into the Knobman software and a stitched image is created with a just a line for the needle added. This can then be placed into the animated knob in Flowstone.

I have attached a couple of examples.
Attachments
RPM_Gauge4.fsm
(1.4 MiB) Downloaded 3705 times
RPM_Gauge.fsm
(823.14 KiB) Downloaded 3649 times
SP32-20150101-123446.jpg
SP32-20150101-123446.jpg (23.44 KiB) Viewed 91040 times
acg2010
 
Posts: 80
Joined: Tue Oct 05, 2010 3:18 am

Next

Return to Machine Control

Who is online

Users browsing this forum: No registered users and 2 guests