Go Down

Topic: Working on a car distress signal generator using UNO (Read 432 times) previous topic - next topic

alfawolf

Hey guys i recently bought an emulator from the freematics its called obd2 emulator mk2.
I connected it to my Arduino UNO  with wires and it doesn't seem to be working x_x
please help someone.
Here's my code ,

Code: [Select]
#include <Arduino.h>
#include <Wire.h>
#include <OBD.h>

COBDI2C obd;

void setup()
{  Serial.begin(38400);
   Serial.println("ATZ"); //shoud initialize the emulator
   Serial.println("ATE1"); // turn on character echoeing
   //  use the debug LED as output
  pinMode(13, OUTPUT);  
  // start communication with OBD-II UART adapter
  obd.begin();
  // initiate OBD-II connection until success
  while (!obd.init());  
}

void loop()
{
  int value;
  if (obd.read(PID_RPM, value)) {
    // RPM is successfully read and its value stored in variable 'value'
    // light on LED when RPM exceeds 3000
    digitalWrite(13, value > 3000 ? HIGH : LOW);
     delay (2000);
  }
}



The emulator comes with a GUI , when i increase rpm in it to above 3000 the led should light up but the led doesnt light up. can someone tell me what i am dong wrong?

heres the serial interface commands for the emulator:

Code: [Select]

Serial Control Interface
========================

The serial control interface is implemented as AT command-set containing following commands. The baud rate is 38400bps. All commands and responses are terminated with '\r' (ASCII: 0xd).

ATZ

    Function: initializing the emulator
    Response: the name and version of the emulator

ATE0/ATE1

    Function: turning off/on character echoing
    Response: OK

ATSET BUS [Protocol]

    Function: changing the simulated protocol (default is CAN bus 11-bit/500Kbps)
    Argument: a string that specifies the protocol which can be one of the following:
        CAN_11B_500K
        CAN_29B_500K
        CAN_11B_250K
        CAN_29B_250K
        KWP2000_FAST
        KWP2000_5BPS
        ISO9141_2
    Response: OK or Error

ATSET DTC=[OBD-II Trouble Code]

    Function: setting a DTC (up to 6 allowed)
    Argument: a code that identifies a malfunction or failure of a vehicle component (refer to this website)
    Response: OK or Error

ATSET VIN=[Vehicle Identification Number]

    Function: setting the emulated VIN
    Argument: a 17-digit vehicle identification number
    Response: OK or Error

ATSET [PID]=[Value]

    Function: setting the value of an OBD-II PID
    Arguments:
        PID: a 4-digit HEX number specifying an OBD-II PID
        Value£º the value of the OBD-II-PID
    Response: OK or Error

ATGET [PID]

    Function: retrieving the current value of an OBD-II PID
    Argument: a 4-digit HEX number specifying an OBD-II PID
    Response: The raw HEX data of the requested OBD-II PID



I have attached the layout of the connections .

johnwasser

If your Arduino circuit works when you plug it into a car then your emulator is probably not working.  If it doesn't work in a car it probably won't work on an emulator.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy