Electron w/ OBDII WIG-09555 UART Connection, no answer?

Hello Particle Community,

I am having trouble getting my Particle Electron working with the Sparkfun OBDII UART Board.

As a first step I wanted to have the Particle connect to over serial to the board and send commands through the serial monitor in Particle Dev.

I got stuck very early with the command “atz” not being responded to by the UART board.

I am perplexed why this doesn’t work on Particle. I try the exact same thing with an Arduino Mega and everything works fine

Does any one have any insight to why I am not able to get it to work?

I thought it may have something to do with the Arduino being 5V and the Particle Electron being 3.3V. However, When I look at the signals sent on O-Scope both traces are the same, and both have an amplitude of 500mv.

Code:

SYSTEM_MODE(MANUAL);
void setup(){
  // initialize both serial ports:
  Serial.begin(9600);
  Serial1.begin(9600);
}
void loop(){
  // read from port 1, send to port 0:
  if (Serial1.available()){
    int inByte = Serial1.read();
    Serial.write(inByte);
  }
  // read from port 0, send to port 1:
  if (Serial.available()){
    //int inByte = Serial.read();
    int inByte = Serial.read();
    Serial1.write(inByte);
  }
}

Wire Setup

The hookup guide on SparkFun specifically says that you need a 5 volt Arduino board. How are you measuring this 500mv signal that you are seeing? Have you tried using a 3.3v to 5v level shifter?

Hi Ric,

I’m going to try a level shifter, I was using an older Sparkfun one BOB-08745, and its actually been retired due to an issue of not returning 5V->3V. I will be getting their latest one and retrying, thank you for the suggestion.

I could use your help though on understanding my mistake for the voltage amplitude of UART signals. I was measuring the RX input on the OBD and Ground on the particle.

The scope showed 500 mV on measure, How would I measure the correct voltage amplitude?

Could it be that you are using a standard 10:1 scope probe and your 500mV signal is actually 5V?

That signal certainly looks like valid serial data.

@bko, You beat me to it. But why would he see 5v coming from the Electron? I was assuming that when he said he measured 500mv on both, he was referring to the Electron and the Mega.

1 Like

Could it be that you are using a standard 10:1 scope probe and your 500mV signal is actually 5V?

Ah, the above plot is from the Particle. That’s a good suggestion, something to do with probe ratio

Hmm… just looked at the STN1110 data sheet, and it says that the RX input is compatible with 3.3v and 5v logic, so that’s probably not your problem (although I still don’t understand your scope trace).

Looking at the Family Reference and Programming Manual for the STN1110, it looks like the default baud rate is 38,400. Could this be the problem?

2 Likes

Hi Everyone! The correct level shifters arrived today from SparkFun, I’ll be checking the setup today and posting results.

Still having no luck getting an answer from the OBD board.

Again, I am using the below script to confirm I can send serial commands to the SparkFun OBDII Board.

Here’s the simple script to take data from the serial monitor to the Serial1 output.

Also! I have set the OBD board’s baud rate to 115200 already.

    SYSTEM_MODE(MANUAL);

void setup(){
  // initialize both serial ports:
  Serial.begin(115200);
  Serial1.begin(115200);
}

void loop(){
  // read from port 1, send to port 0:
  if (Serial1.available()){
    int inByte = Serial1.read();
    Serial.write(inByte);
  }

  // read from port 0, send to port 1:
  if (Serial.available()){
    //int inByte = Serial.read();
    int inByte = Serial.read();
    Serial1.write(inByte);
  }
}

Here is my wiring setup. I am using my 5V signal from the USB Voltage. (Battery and USB cord removed for photo)

I am able to confirm that I am sending a boosted 5V signal from the level shifter via Oscope.

Finally I am even able to read the opening chirp from the OBDII card where it says its software revision on startup. I observed this by having the particle serial monitor

However, despite all of this I still don’t get a response from the OBDII board when I send it commands. ex. ATZ, ATH1 etc

How are you sending the commands? Do you send them the same way to the electron as you do with the Mega?

1 Like

Have you tried a lower baud rate? There is certainly some rounding of 5V signal rising edges there in your scope photo. It is hard to say at that horizontal scale if there is a problem or not.

If there is some command you can send in a loop that just returns a known status, I would write special test code to just send that in loop with 500 or 1000ms delay and see if it ever works.

1 Like

Hi Ric,

This code runs without change on the Arduino.

I connected the Level Shifter to the Arduino( 5V-5V) and also measured that scope trace. It got a response from the OBD II board.

Arduino Trace, Level (5V-5V) Input: Red, Output: Yellow, 115200 Baud, OBD Board Responds

Particle Trace, Level (3V-5V) Input: Red, Output Yellow, 115200 Baud, No answer from OBDII Board

That doesn’t really answer my question. The code you posted doesn’t show how you’re sending the AT commands. Are you using a terminal program for that? If so, are you using the same one for the Particle and Arduino tests?

I understand,

Particle: Serial Monitor in Particle Dev
Arduino: Serial Monitor in Arduino IDE

Can you use the same monitor for both tests? I’m wondering if they both append carriage returns or not, or whether there is some other difference between the two that might be causing your problem.

@Ric , Good thinking! At 9600 baud using Arduino IDE Serial Monitor, it worked to send ATZ.
It also worked to send 115200 baud using the Arduino IDE.

How interesting!

Why would it work with one Serial Monitor and not with another??

I read in docs that the AT commands have to end with a carriage return, so maybe the Particle monitor doesn’t do that while the Arduino one does?

1 Like

I tested the two monitors. The Particle monitor in Dev appends a linefeed character (Decimal 10) to the text you send; I didn’t see anywhere that you can change that. The Arduino monitor lets you set that with a drop down menu at the bottom of the monitor window. If it’s set to carriage return, it sends a decimal 13 (is yours setup that way?).

2 Likes