Building a low cost OBD2 ECU Simulator

Re: Building a low cost OBD2 ECU Simulator

Postby firewalker » Wed Jul 25, 2018 10:18 am

Hello Martin!

Just wanted to say thanks you for you code and effort.

For those facing problems:

I had to change ITN32U canId = 0x000; to uint16_t canId = 0x000;. If someone uses a board with 8 MHz crystal, in the file mpc_can.h the line

Code: Select all
byte begin(byte speedset, const byte clockset = MCP_16MHz);     // init can


should be changed to

Code: Select all
byte begin(byte speedset, const byte clockset = MCP_8MHz);     // init can
firewalker
 
Posts: 1
Joined: Wed Jul 25, 2018 9:49 am

Re: Building a low cost OBD2 ECU Simulator

Postby m207365 » Fri Nov 23, 2018 3:19 pm

Hey Martin - thanks for the code and ideas.

I have your simulator code working on an Arduino UNO with a Seeed CAN BUS v2.0 shield and an OBDLink SX dongle. The only change I made to the original code was to change:
INT32U canId = 0x000;
to
unsigned long int canID = 0x0000

The original code would give me this error during compile: 'INT32U' does not name a type. I do not know why. I'm using Arduino 1.8.15.0 on a Windows 10 machine. The board is a UNO clone with an ATMEGA 328P IC.

Oh, I also had to change the CS pin to 9 for the v2.0 shield.

Anyway, all is good now. It will be a big help. In my case, I had to go up and down the stairway to get to the garage. It's also 2 degrees F below zero here today in New Hampshire, USA.

I bought the dongle maybe 8 or 9 years ago from Scantool.net. I've had it apart. It doesn't really have an ELM327 chip. Instead, it has some other chips and circuitry to emulate an ELM327.

For what it's worth, these commands return these messages:
ati = ELM327 v1.3a
sti = STN 1130 v3.30
stdi = OBDLINK SX r2.2

Now I'm in the process of putting together a second Arduino with another SEEED CAN BUS shield and a touchscreen LCD display. The idea is to mount it in my truck so that I can press buttons on the screen to get OBD-II readings. I think the challenge is going to be having enough Arduino pins. The TFTLCD uses a lot of pins. I may have to go to a Mega bd.
m207365
 
Posts: 2
Joined: Thu Nov 22, 2018 8:07 pm

Re: Building a low cost OBD2 ECU Simulator

Postby MartinViljoen » Sun Nov 25, 2018 7:56 pm

m207365 wrote:Hey Martin - thanks for the code and ideas.

I have your simulator code working on an Arduino UNO with a Seeed CAN BUS v2.0 shield and an OBDLink SX dongle. The only change I made to the original code was to change:
INT32U canId = 0x000;
to
unsigned long int canID = 0x0000

The original code would give me this error during compile: 'INT32U' does not name a type. I do not know why. I'm using Arduino 1.8.15.0 on a Windows 10 machine. The board is a UNO clone with an ATMEGA 328P IC.

Oh, I also had to change the CS pin to 9 for the v2.0 shield.

Anyway, all is good now. It will be a big help. In my case, I had to go up and down the stairway to get to the garage. It's also 2 degrees F below zero here today in New Hampshire, USA.

I bought the dongle maybe 8 or 9 years ago from Scantool.net. I've had it apart. It doesn't really have an ELM327 chip. Instead, it has some other chips and circuitry to emulate an ELM327.

For what it's worth, these commands return these messages:
ati = ELM327 v1.3a
sti = STN 1130 v3.30
stdi = OBDLINK SX r2.2

Now I'm in the process of putting together a second Arduino with another SEEED CAN BUS shield and a touchscreen LCD display. The idea is to mount it in my truck so that I can press buttons on the screen to get OBD-II readings. I think the challenge is going to be having enough Arduino pins. The TFTLCD uses a lot of pins. I may have to go to a Mega bd.


Ah! Is that why the old sketch wont compile LOL!
You have no Idea how much you helped me now. :D

I have 2 SeeedStudio Shields the V1 which I used when I created this forum and then recently Seeed sent me the V2. I started creating a new way of monitoring the CAN-BUS. and needed to use the old V1.00 to simulate a data dump. so I dont have to run to the car all the time. But the old sketch wouldn't compile it was complaining about the same variable declare.

I had to copy the new library folder away from the lib folder and then copy the old one back and then switch them again :D :D :D

Thanks for this!

By the way I created a new sketch. It presents you with a command line console running directly on the arduino. all you have to do is connect to it using putty and you can dump and monitor for changes directly on the micro controller without needing external software. I havent tested it on my Jeep yet. If you want to try it out.

See: https://github.com/mailmartinviljoen/WisperChipCli
User Guide: http://www.techtinker.co.za/2018/11/24/ ... -software/
Image
User avatar
MartinViljoen
 
Posts: 110
Joined: Mon Oct 06, 2014 5:23 pm
Location: Centurion South Africa

Re: Building a low cost OBD2 ECU Simulator

Postby m207365 » Mon Nov 26, 2018 11:25 pm

I will definitely check out your new code. At this point, I’m just trying lots of ideas. Not sure exactly how I want my dashboard to work.

I was going to use my 240x320 touchscreen LCD, but it uses a lot of pins, too many to use it with the CAN BUS shield on a UNO type board. I was trying to set it up on a Mega 2560, which has more than enough pins. Both shields run on the Mega but not at the same time. Trouble is I couldn’t find in the CAN BUS library where pins 2 (INT) and 4 (CS-TF) are assigned. So, I gave up on that temporarily.

Now I’m using a 16x2 display running SPI. It works ok but only has enough room to display 1 msg at a time.

On another note, I was able to modify my OBDLink SX mfg by Scantools.net and bypass its FT232 chip to get TTL serial out. I was able to use it with your simulator sketch.

One thing I didn’t have any luck with was using the program that came with my Scantools adapter. It’s called OBDWiz. It apparently wants certain codes back from the simulator in order to fully connect. No big deal, though. I can use Putty just fine with your simulator. :D

I ordered a GPS module this morning. At this point, I'm leaning toward capturing the detailed OBD-II data, as well as GPS, on a SD card, and only displaying simple data on the 16x2 display.
m207365
 
Posts: 2
Joined: Thu Nov 22, 2018 8:07 pm

Previous

Return to OBD2 & CAN-BUS Projects

Who is online

Users browsing this forum: No registered users and 1 guest

cron