sipimokus/node-obd2

Can't get data of my Volkswagen Golf 6

Opened this issue · 1 comments

Hey,

i just started playing with node-obd2.
i tried to get data based on the example from my car. But the website (localhost:3000) does not return a thing. it works with fake data.

This is my setup:

  • ELM327 v1.5
  • connected over USB: /dev/ttyUSB0
  • Raspberry Pi 2

i would really appreciate if you could give me a hint whats going on here?

My code:

process.env.NODE_ENV   = "production";
process.env.DEBUG      = "OBD2.*";

var obd2 = require("obd2");
var OBD = new obd2({
    device  : "ELM327", // Device type
    serial  : "usb",   // usb, bluetooth
    port    : "/dev/ttyUSB0",   // Device COM port / path
    baud    : 11500,    // Device baud rate
    delay   : 100,       // Ticker delay time (ms)
    cleaner : true      // Automatic ticker list cleaner ( ex. PID not supported, no response )
});

var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var debug = require("debug")("Example");

app.use('/assets', express.static( __dirname + '/assets') );

// Server
http.listen(3000, function()
{
    debug('Listening on *:3000');

    // OBD Initializing
    OBD.start( function()
    {
        debug("OBD2 example start");

        OBD.on("dataParsed", function( type, elem, data )
        {
            io.emit('obd2', type, elem, data );
        });

        OBD.on("pid", function( data )
        {
            io.emit('pid', data );
        });

/* Extra usage code
        OBD.listPID(function( pidList )
        {
            // io.emit list
            io.emit('pidList', pidList );

            // io.emit pid
            OBD.readPID( "0C" );

            // io.emit pid & vss
            OBD.readPID( "0D", function( data )
            {
                io.emit('vss', data );
            });

            // Unavailable, auto clean
            OBD.readPID( "99" );

        });
*/

    });

});

app.get('/', function(req, res)
{
    res.sendFile(__dirname + '/index.html');
});

io.on('connection', function(socket)
{
    debug('User connected');

    socket.on('disconnect', function()
    {
        debug('User disconnected');
    });

    socket.on('pidTickerList', function( addList )
    {
        OBD.Ticker.stop();
        for ( var index in addList )
        {
            OBD.readPID( addList[ index ] );
        }
    });

    socket.on('pidList', function()
    {
        OBD.listPID( function( pidList )
        {
            io.emit('pidList', pidList );
        })
    });

    OBD.listPID( function( pidList )
    {
        io.emit('pidList', pidList );
    });
});

log infos:

  OBD2.Core.Ticker Tick AT : AT SP0 +198ms
  OBD2.Serial.Base Serial port write: AT SP0 +0ms
  OBD2.Serial.Base Serial port data : OK +8ms
  OBD2.Serial.Base Serial port data : > +1ms
 +195msCore.Ticker Tick PID : 0100
  OBD2.Serial.Base Serial port write: 0100 +2ms
  OBD2.Serial.Base Serial port data : S +7ms
  OBD2.Serial.Base Serial port data : EA +2ms
  OBD2.Serial.Base Serial port data : R +10ms
  OBD2.Serial.Base Serial port data : CHING.. +2ms
  OBD2.Serial.Base Serial port data : . +2ms
  OBD2.Serial.Base Serial port data :  +1ms
  OBD2.Serial.Base Serial port data : 41 +5s
  OBD2.Serial.Base Serial port data : 00BE3E +2ms
  OBD2.Serial.Base Serial port data : E8 +2ms
  OBD2.Serial.Base Serial port data : 11 +1ms
  OBD2.Serial.Base Serial port data : > +204ms
 +4sD2.Core.Ticker Tick PID : 0100
  OBD2.Serial.Base Serial port write: 0100 +1ms
  OBD2.Serial.Base Serial port data : 41 +137ms
  OBD2.Serial.Base Serial port data : 00BE +2ms
  OBD2.Serial.Base Serial port data : 3E +1ms
  OBD2.Serial.Base Serial port data : E811 +1ms
  OBD2.Serial.Base Serial port data :  +2ms
  OBD2.Serial.Base Serial port data : > +202ms
  OBD2.Serial.Base Serial port data : BUS +54s
  OBD2.Serial.Base Serial port data :  ERRO +1ms
  OBD2.Serial.Base Serial port data : R> +6ms
pi@raspberrypi:~/obd $ ^C
pi@raspberrypi:~/obd $ node obd-serial.js 
  OBD2.Main Initializing +0ms
  OBD2.Core.DTC Loading list +26ms
  OBD2.Core.DTC [ERROR] Data directory not found! +17ms
  OBD2.Core.DTC Loaded count: 0 +4ms
  OBD2.Core.DTC Ready +1ms
  OBD2.Core.PID Loading list +3ms
  OBD2.Core.PID Loaded count: 70 +33ms
  OBD2.Core.PID Ready +0ms
  OBD2.Core.OBD Ready +2ms
  OBD2.Core.Ticker Ready +1ms
  OBD2.Device.Main Loaded device: elm327 +7ms
  OBD2.Device.Main Ready +1ms
  OBD2.Serial.Main Serial type: usb +1ms
  OBD2.Serial.Main Serial port: /dev/ttyUSB0 +1ms
  OBD2.Main Ready +13ms
  OBD2.Serial.Base Serial port open : undefined +2s
  OBD2.Device.Main Connecting +5ms
  OBD2.Core.Ticker Start +3ms
  OBD2.Device.Main Connected +8ms
  OBD2.Core.Ticker Tick AT : AT D +101ms
  OBD2.Serial.Base Serial port write: AT D +5ms
  OBD2.Serial.Base Serial port data : OK> +48ms
  OBD2.Core.Ticker Tick AT : AT Z +169ms
  OBD2.Serial.Base Serial port write: AT Z +1ms
  OBD2.Serial.Base Serial port data : AT Z +5ms
  OBD2.Core.Ticker Tick AT : AT L0 +200ms
  OBD2.Serial.Base Serial port write: AT L0 +0ms
  OBD2.Serial.Base Serial port data : E +591ms
  OBD2.Serial.Base Serial port data : LM327 +2ms
  OBD2.Serial.Base Serial port data :  v1.5 +2ms
  OBD2.Serial.Base Serial port data : > +1ms
  OBD2.Core.Ticker Tick AT : AT E0 +109ms
  OBD2.Serial.Base Serial port write: AT E0 +0ms
  OBD2.Serial.Base Serial port data : AT +5ms
  OBD2.Serial.Base Serial port data :  E0 +1ms
  OBD2.Serial.Base Serial port data : OK> +4ms
  OBD2.Core.Ticker Tick AT : AT S0 +195ms
  OBD2.Serial.Base Serial port write: AT S0 +1ms
  OBD2.Serial.Base Serial port data : OK +8ms
  OBD2.Serial.Base Serial port data : > +1ms
  OBD2.Core.Ticker Tick AT : AT H0 +195ms
  OBD2.Serial.Base Serial port write: AT H0 +1ms
  OBD2.Serial.Base Serial port data : OK> +9ms
  OBD2.Core.Ticker Tick AT : AT AT2 +194ms
  OBD2.Serial.Base Serial port write: AT AT2 +0ms
  OBD2.Serial.Base Serial port data : OK +9ms
  OBD2.Serial.Base Serial port data : > +2ms
  OBD2.Core.Ticker Tick AT : AT SP0 +195ms
  OBD2.Serial.Base Serial port write: AT SP0 +0ms
  OBD2.Serial.Base Serial port data : OK +8ms
  OBD2.Serial.Base Serial port data : > +2ms
 +3sD2.Core.Ticker Tick PID : 0100
  OBD2.Serial.Base Serial port write: 0100 +2ms
  OBD2.Serial.Base Serial port data : SEARCHING... +166ms
  OBD2.Serial.Base Serial port data : 41 +5s
  OBD2.Serial.Base Serial port data : 00BE3EE81 +6ms
  OBD2.Serial.Base Serial port data : 1 +1ms
  OBD2.Serial.Base Serial port data : > +200ms
 +17s2.Core.Ticker Tick PID : 0100
  OBD2.Serial.Base Serial port write: 0100 +1ms
  OBD2.Serial.Base Serial port data : 41 +134ms
  OBD2.Serial.Base Serial port data : 00BE3EE811 +22ms
  OBD2.Serial.Base Serial port data :  +185ms
  OBD2.Serial.Base Serial port data : > +2ms
  OBD2.Core.Ticker Stop +951ms
  OBD2.Core.Ticker Stop +2s
  OBD2.Core.Ticker Stop +654ms
  OBD2.Core.Ticker Stop +487ms
  OBD2.Core.Ticker Stop +7s
  OBD2.Core.Ticker Stop +732ms
  OBD2.Core.Ticker Stop +368ms
  OBD2.Core.Ticker Stop +328ms
  OBD2.Core.Ticker Stop +264ms
  OBD2.Core.Ticker Stop +291ms
  OBD2.Core.Ticker Stop +462ms
  OBD2.Core.Ticker Stop +180ms
  OBD2.Core.Ticker Stop +151ms
  OBD2.Core.Ticker Stop +217ms
^[[B^C
pi@raspberrypi:~/obd $ ^C
pi@raspberrypi:~/obd $ ^C
pi@raspberrypi:~/obd $ node obd-serial.js > obd.log
  OBD2.Main Initializing +0ms
  OBD2.Core.DTC Loading list +25ms
  OBD2.Core.DTC [ERROR] Data directory not found! +18ms
  OBD2.Core.DTC Loaded count: 0 +3ms
  OBD2.Core.DTC Ready +1ms
  OBD2.Core.PID Loading list +4ms
  OBD2.Core.PID Loaded count: 70 +32ms
  OBD2.Core.PID Ready +1ms
  OBD2.Core.OBD Ready +1ms
  OBD2.Core.Ticker Ready +2ms
  OBD2.Device.Main Loaded device: elm327 +6ms
  OBD2.Device.Main Ready +1ms
  OBD2.Serial.Main Serial type: usb +1ms
  OBD2.Serial.Main Serial port: /dev/ttyUSB0 +1ms
  OBD2.Main Ready +14ms
  OBD2.Serial.Base Serial port open : undefined +2s
  OBD2.Device.Main Connecting +5ms
  OBD2.Core.Ticker Start +3ms
  OBD2.Device.Main Connected +8ms
  OBD2.Core.Ticker Tick AT : AT D +102ms
  OBD2.Serial.Base Serial port write: AT D +4ms
  OBD2.Serial.Base Serial port data : OK> +46ms
  OBD2.Core.Ticker Tick AT : AT Z +171ms
  OBD2.Serial.Base Serial port write: AT Z +1ms
  OBD2.Serial.Base Serial port data : AT Z +5ms
  OBD2.Core.Ticker Tick AT : AT L0 +200ms
  OBD2.Serial.Base Serial port write: AT L0 +1ms
  OBD2.Serial.Base Serial port data : EL +591ms
  OBD2.Serial.Base Serial port data : M327  +1ms
  OBD2.Serial.Base Serial port data : v1.5 +2ms
  OBD2.Serial.Base Serial port data : > +34ms
  OBD2.Core.Ticker Tick AT : AT E0 +230ms
  OBD2.Serial.Base Serial port write: AT E0 +1ms
  OBD2.Serial.Base Serial port data : AT E0OK> +44ms
  OBD2.Core.Ticker Tick AT : AT S0 +170ms
  OBD2.Serial.Base Serial port write: AT S0 +1ms
  OBD2.Serial.Base Serial port data : OK> +12ms
  OBD2.Core.Ticker Tick AT : AT H0 +190ms
  OBD2.Serial.Base Serial port write: AT H0 +1ms
  OBD2.Serial.Base Serial port data : OK> +18ms
  OBD2.Core.Ticker Tick AT : AT AT2 +187ms
  OBD2.Serial.Base Serial port write: AT AT2 +1ms
  OBD2.Serial.Base Serial port data : OK> +10ms
  OBD2.Core.Ticker Tick AT : AT SP0 +194ms
  OBD2.Serial.Base Serial port write: AT SP0 +1ms
  OBD2.Serial.Base Serial port data : OK +9ms
  OBD2.Serial.Base Serial port data : > +8ms
 +187msCore.Ticker Tick PID : 0100
  OBD2.Serial.Base Serial port write: 0100 +2ms
  OBD2.Serial.Base Serial port data : SE +7ms
  OBD2.Serial.Base Serial port data : AR +1ms
  OBD2.Serial.Base Serial port data : C +1ms
  OBD2.Serial.Base Serial port data : H +2ms
  OBD2.Serial.Base Serial port data : ING +6ms
  OBD2.Serial.Base Serial port data : ... +2ms
  OBD2.Serial.Base Serial port data :  +3ms
  OBD2.Serial.Base Serial port data : UN +5s
  OBD2.Serial.Base Serial port data : ABLE T +2ms
  OBD2.Serial.Base Serial port data : O CON +2ms
  OBD2.Serial.Base Serial port data : NECT +1ms
  OBD2.Serial.Base Serial port data : > +1ms
 +27s2.Core.Ticker Tick PID : 0100
  OBD2.Serial.Base Serial port write: 0100 +1ms
  OBD2.Serial.Base Serial port data : SE +9ms
  OBD2.Serial.Base Serial port data : ARCHING... +33ms
  OBD2.Serial.Base Serial port data : 41 +5s
  OBD2.Serial.Base Serial port data : 00BE +2ms
  OBD2.Serial.Base Serial port data : 3E +1ms
  OBD2.Serial.Base Serial port data : E81 +1ms
  OBD2.Serial.Base Serial port data : 1 +1ms
  OBD2.Serial.Base Serial port data :  +2ms
  OBD2.Serial.Base Serial port data : > +203ms

Thanks!

ouput of dataParsed values:

  OBD2.Serial.Base Serial port data : OK> +20ms
  OBD2.Core.Ticker Tick AT : AT SP0 +134ms
  OBD2.Serial.Base Serial port write: AT SP0 +1ms
ecu { value: 'OK',
  name: undefined,
  mode: undefined,
  pid: undefined,
  min: undefined,
  max: undefined,
  unit: undefined } <Buffer 4f 4b 0d 0d 3e>
#################################### OBD.on("dataParsed")
  OBD2.Serial.Base Serial port data : OK> +12ms