Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: [Android Development] Can OBDSim help me ?

  1. #1
    Newbie
    Join Date
    Nov 2011
    Posts
    5

    [Android Development] Can OBDSim help me ?

    Hey,

    I'm currently writing an Android application similar to the famous Torque ( https://market.android.com/details?id=org.prowl.torque )

    The purpose is to connect to an ELM327 device (which is connected to a car) and display the car's speed in the Android application. I don't know yet if i just have to listen the ELM327 device or if i will have to "talk" to him (i read something about AT commands...)

    Anyway, you understand that writting the whole application IN A REAL CAR will be really boring.

    So that's why I'm here, the obdsim manpage says "OBDSim is technically also an ELM327 simulator"...

    Ok, so is there a simple way to get a random speed information (in the "ELM327 format", i think something like 101001011..... ) without being a real car ? The manpage is pretty hard to understand, what's a seed, what's a generator...



    Thanks

  2. #2
    North of the land of Hey Huns
    Auto Apps:loading...

    Join Date
    Jun 2004
    Location
    Westminster, MD
    Posts
    2,144
    A generator is something that creates data for you. You basically want the Random generator, or Cycle generator with a cycle time of say, 30. Cycle would make the number steadily go up, and roll over its max value every 30 seconds (So go from 0-255mph in 30 seconds). This would give you a good basis for starting.

    The command line for that would be "obdsim.exe -g Cycle -s 30". In the case of the Cycle generator, the seed number is how many seconds per cycle you want.
    "stop with the REINSTALLS, what do you think we got some lame-o installer!!!" - mitchjs
    RevFE
    My Shop

  3. #3
    Newbie
    Join Date
    Nov 2011
    Posts
    5
    Ok thanks, I understand now.

    As you said, I'm using :

    Code:
    cidou@cidou-Inspiron-9300:~$ obdsim -g Cycle -s 30
    Setting cycle length to 30 seconds
    SimPort name: /dev/pts/1
    Successfully initialised obdsim, entering main loop
    10.000029 seconds. 0 samples, 0 queries. 0.00 s/s, 0.00 q/s
    10.000102 seconds. 0 samples, 0 queries. 0.00 s/s, 0.00 q/s
    10.000786 seconds. 0 samples, 0 queries. 0.00 s/s, 0.00 q/s
    About the data results, it seems obdsim is now looking for queries, right ?

    If I want obdsim to generate some speed datas for me, do I need to send the appropriate command (like i will do on the ELM327) ?

    If I correctly understand the OBD-II PIDs ( http://en.wikipedia.org/wiki/OBD-II_PIDs ), I'll have to send 010D to get speed datas :

    Code:
    Mode
    (hex)	PID
    (hex)	Data bytes returned	Description	Min value	Max value	Units	Formula
    01	0D	1	Vehicle speed	0	255	km/h	A

    But now, how can I communicate with obdsim ? Is it possible just with an other terminal ?

  4. #4
    Newbie preet's Avatar
    Join Date
    Sep 2009
    Location
    Canada eh
    Posts
    43
    You write data to the port that obdsim has opened up for you. In your example:
    Code:
    SimPort name: /dev/pts/1
    Now there's a virtual serial port sitting at /dev/pts/1 and you can read/write to it using your application as if you were connected to an ECU through an ELM327 cable.

  5. #5
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    Fundamentally you need some way to communicate between OBDsim and your software on the android device. By default, obdsim creates a pty on the local machine. So, you could run obdsim on the device itself and tell your software to read from the pty.

    That might be a PITA; what you probably want is bluetooth, with obdsim running on your main machine. OBDSim supports bluetooth just fine so long as you build in support [when you build it, you need libbluetooth-dev or similar available on your system]. Also the man page gives the example commands to make it available correctly from the main machine

    Each "generator" is a different way to generate data; you're right, that "010D" will grab vehicle speed; the question is, when obdsim turns up a number, where will that number come from? Different generators create numbers different ways; random makes up a number every time you ask for one, gui_fltk pulls one from the gui, etc. The "seed" is simply a parameter to the generator, different generators use the seed for different things.

    So, for a quick and easy first go; leave out the generator and seed, and just run "obdsim -c" at the command-line; that connects screen to it so you can experimentally try communicating with an ELM327 device by hand. [so you can, for example, type '010D' and see the results]. Assuming that's all copacetic, to do your actual development you'll want "obdsim -b", which simply tells obdsim to run as a bluetooth device.

    In the longer run, most folks find it best to have sensible data coming out of the sim. That's what the 'Logger' plugin is for; run with the 'Logger' generator and a seed that points to a database you either create yourself, or download from here:
    http://icculus.org/obdgpslogger/examples/ces2010/ [me driving my mini to vegas]
    http://icculus.org/obdgpslogger/examples/striple/ [me pottering around in the santa monica hills on my putt putt]

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

  6. #6
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    And, of course, to answer the original question: Yes, OBDSim can help you :-)

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

  7. #7
    Newbie
    Join Date
    Nov 2011
    Posts
    5
    thanks for your answers, i'm using bluetooth and it works really great!

    is there a list of obdsim supported commands like speed, engine rpm, ... ?

  8. #8
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    Short version: no, that's what 0100, 0120, 0140, etc are for

    Long version: It's up to the individual generators which PIDs they support. Logger, for example, reports a list of the PIDs available in the database it's using.
    This database has one set of PIDs: http://icculus.org/obdgpslogger/exam...treettriple.db
    This has completely another: http://icculus.org/obdgpslogger/exam...010/ces2010.db

    The right thing to do is have your code always use 0100 first, to get a list of supported PIDs from the vehicle/sim, and then decide what to do from there.

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

  9. #9
    Newbie
    Join Date
    Jan 2012
    Location
    Austria
    Posts
    3

    Android OBD Developement

    Hey all,

    i'm also trying to develope an android app to read OBD2 data.
    I've downloaded and builded the obdgpslogger for linux und i'm using obdsim to generate data.
    Everything works just fine, but Bluetooth

    I tried to connect with other OBD2 read apps like torque oder OBDII Reader, but it didn't work.
    And i've to tell you that i'm not a experienced linux user
    I tried the following:

    first i binded my Android Phone to rfcomm (i hope i have to take the phones bluetooth adress here? But i also tried the one from my laptop)
    Code:
    sudo rfcomm bind 0 7C:61:93:D2:0C:BA 1
    sudo sdptool add SP
    where 7C:61:93: D2:0C:BA is the bluetooth adress from my android phone. So i get a rfcomm0 in /dev
    next, i tryed to start
    Code:
    obdsim -b
    which was starting but with an unknow Simport name
    Code:
    obdsim -b
    SimPort name: Unknown
    Successfully initialised obdsim, entering main loop
    why?
    So i tried to tell the rfcomm device at startup
    Code:
    obdsim -b -t rfcomm0
    SimPort name: Unknown
    Successfully initialised obdsim, entering main loop
    unfortunately with the same result. Unknown SimPort name.
    Also tried to connect to the device with rfcomm and so on..
    Everytime i try to send a OBD command to my laptop there is a report that my device [,,] tried to acess the service »00001103-0000-1000-8000-00805F9B34FB«.
    So there is an incoming signal, but i do not know how to send this to the simulator.

    What i'm doing wrong? Or do i have some errors in reasoning and this is not possible?

    Thanks in advance!

  10. #10
    SuperMod - OBDII GPS Logger forum
    Auto Apps:loading...

    Join Date
    Mar 2009
    Location
    Los Angeles
    Posts
    929
    The simport name will always be unknown when you first open the bluetooth simport. I don't remember what it becomes when it's not unknown, but it's not on startup

    The mistake you made is almost certainly the bind; you need to bind to the mac address of your bluetooth chip in the PC that obdsim is running on, not to your phone. I think the way to go is:
    1) First, reboot. Bluetooth seems to carry all kinds of weird state with it, even when you unplug&replug the bluetooth card. Of course, this is linux so it's probably not strictly necessary, but I don't know which modules need to be reloaded for it to do the right thing.
    2) Run those commands to make your PC advertise it can do serial correctly
    3) Pair your phone to your pc
    4) Run obdsim -b.
    5) Stick it in the camel and go.

    Sorry if that's a bit arcane... linux bluetooth sometimes seems that way, although it's definitely less arcane than the windows equivalent :-)

    Gary (-;
    OBDGPSLogger, for logging OBDII and/or GPS data
    OBDSim, an OBDII/ELM327 software simulator
    mp3car forums: obdgpslogger, obdsim

Page 1 of 3 123 LastLast

Similar Threads

  1. OBDSim help?
    By preet in forum OBDSim
    Replies: 7
    Last Post: 05-18-2011, 12:29 AM
  2. OBDsim with FB
    By nemo1 in forum OBDSim
    Replies: 2
    Last Post: 10-25-2010, 09:33 PM
  3. What is OBDSim?
    By chunkyks in forum OBDSim
    Replies: 0
    Last Post: 09-20-2010, 02:26 PM
  4. CF with my OBDSim
    By chunkyks in forum Centrafuse
    Replies: 0
    Last Post: 09-15-2010, 02:02 PM
  5. New Toy: obdsim
    By chunkyks in forum OBDII GPS Logger
    Replies: 7
    Last Post: 07-02-2009, 11:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •