Measurement of NOx - CAN-bus

Hi,
my project is about to measure NOx and store the values with a data logger on a SD-card.
My setup:

  • Arduino UNO
  • NOx -Sensor
  • Bluetooth shield HC-05
  • Seedstudio CAN-Bus shield (29 bit extented identifier)
  • Adafruit data logger shield+SD Card

The NOx sensor is connected with the CAN_low and CAN_high of the CAN-bus shield.
The supply voltage of the sensor is 24 V (for testing with a power supply).

I tested this code (and several examples of the CAN library but no changes):

// demo: CAN-BUS Shield, receive data with check mode
// send data coming to fast, such as less than 10ms, you can use this way
// loovee, 2014-6-13


#include <SPI.h>
#include "mcp_can.h"


// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = 9;

MCP_CAN CAN(SPI_CS_PIN);                                    // Set CS pin
 
void setup()
{
    Serial.begin(9600);

START_INIT:

    if(CAN_OK == CAN.begin(CAN_250KBPS))                   // init can bus : baudrate = 250k
    {
        Serial.println("CAN BUS Shield init ok!");
    }
    else
    {
        Serial.println("CAN BUS Shield init fail");
        Serial.println("Init CAN BUS Shield again");
        delay(100);
        goto START_INIT;
    }
}

     unsigned char stmp[8] = {0, 1, 2, 3, 4, 5, 6, 7};

void loop()
{
    unsigned char len = 0;
    unsigned char buf[8];

    if(CAN_MSGAVAIL == CAN.checkReceive())            // check if data coming
    {
        CAN.readMsgBuf(&len, buf);    // read data,  len: data length, buf: data buf

        unsigned long canId = CAN.getCanId();
       
        Serial.println("-----------------------------");
        Serial.print("get data from ID: ");
        Serial.println(canId, HEX);

        for(int i = 0; i<len; i++)    // print the data
        {
            Serial.print(buf[i]);
            Serial.print("\t");
        }
        Serial.println();
       
     // send data:  id = 0x00, standart flame, data len = 8, stmp: data buf
      CAN.sendMsgBuf(0xFEDF, 0, 4, stmp); 
      delay(100);                       // send data per 100ms
    }
}

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

On the serial monitor I receive this message:
Get data from ID:18F00F52
255 255 255 255 255 127 31 31

The sensor is cold…no changes.

How can I send the sensor a start signal and how can I get the measurements?

Btw this is my first project with a CAN-bus :slight_smile:

In the appendix ist the data sheet with the transfer protocol & receive signals of the NOx sensor.
Thanks in advance!

Conti UniNOx12V_spec_11 03 08.pdf (876 KB)

1 Like

Hi,

very interesting, I'm planning exactly the same with my 2560, but right now I'm not as far as you (can shield is on its way).

But I'm a bit more familiar with Conti NOx sensors.

First, the supply voltage should be 12V not 24 and while heating you need around 2 A. But that is not your issue right now.

You have to send a "dewpoint release" to tell the sensor controll that it can heat up without damage of water droplets. I think he dewpoint byte is listed on page 4 of your pdf.

Hope that solves your problem and I'm looking forward for your code.

Regards

Hey, it is the datasheet for the 12v version but i am using the 24v version because
it has a greater measurement range.
I found the solution with these changes it works:

// demo: CAN-BUS Shield, receive data with check mode
// send data coming to fast, such as less than 10ms, you can use this way
// loovee, 2014-6-13


#include <SPI.h>
#include "mcp_can.h"


// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = 9;

MCP_CAN CAN(SPI_CS_PIN);                                    // Set CS pin
 
void setup()
{
    Serial.begin(9600);

START_INIT:

    if(CAN_OK == CAN.begin(CAN_250KBPS))                   // init can bus : baudrate = 250k
    {
        Serial.println("CAN BUS Shield init ok!");
    }
    else
    {
        Serial.println("CAN BUS Shield init fail");
        Serial.println("Init CAN BUS Shield again");
        delay(100);
        goto START_INIT;
    }
}

     unsigned char stmp[8] = {0, 0, 0, 0, 0, 0, 0, 4}; // choose bits

void loop()
{
    unsigned char len = 0;
    unsigned char buf[8];

    if(CAN_MSGAVAIL == CAN.checkReceive())            // check if data coming
    {
        CAN.readMsgBuf(&len, buf);    // read data,  len: data length, buf: data buf

        unsigned long canId = CAN.getCanId();
       
        Serial.println("-----------------------------");
        Serial.print("get data from ID: ");
        Serial.println(canId, HEX); // in Hex

        for(int i = 0; i<len; i++)    // print the data
        {
            Serial.print(buf[i]);
            Serial.print("\t");
        }
        Serial.println();
    }
// send data:  id = 0x00 in Hex, extented frame = 1, data len = 8, stmp: data buf
    CAN.sendMsgBuf(0x18FEDF00, 1, 8, stmp); 
      delay(500);                       // send data per 5s00ms
}

/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

In the next days I will test the measurement with a car. :slight_smile:

How did your NOx logger project go?

Hello can help me copy the second code I change the speed to 500. I signal the sensor but do not vary the data. My teacher told me it may be because the internal nickel is not being started. I'm using the 6-pin chevrolet sensor. Nesecito remove the data for nox. Thanks in advance.
a from ID:B7
50 164 205 64 200 15 55

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 203 192 200 15 53

a from ID:B5
176 251 77 0 253 192

a from ID:B7
50 164 206 0 200 15 56

a from ID:B1
232 252 21 16 237 192

a from ID:B7
50 164 205 64 200 15 55

a from ID:B7
50 164 205 64 200 15 55

a from ID:B5
176 251 79 0 255 64

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 203 192 200 15 53

a from ID:B1
176 251 77 0 253 192

I'd be very interesting to find out how this project turned out.

I'd like to try it myself, but have a number of questions:

  1. Where can I find the full Continental UniNOx data sheet? I can't seem to access the continental data sheets from the US.

  2. It appears that the Continental sensor is one of the more widely adopted sensors, but all of the ones easily available are variations 5WK9 66xx, with xx being different revisions and in use by different car manufacturers. Do you know what the difference is between the variations?

  3. Do you have pinout on the sensor? I believe it's just +V, ground, CAN-hi, and CAN-lo, but which pin is which?

  4. Do the values reported by the sensor represent NOx ppm, or, do they need to be converted / decoded?

I think all of this could be answered by a full sensor data sheet....

A little more information about NOx CAN J1939 sensors can be found here

Regards.-

Vini33:
Hello can help me copy the second code I change the speed to 500. I signal the sensor but do not vary the data. My teacher told me it may be because the internal nickel is not being started. I'm using the 6-pin chevrolet sensor. Nesecito remove the data for nox. Thanks in advance.
a from ID:B7
50 164 205 64 200 15 55

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 203 192 200 15 53

a from ID:B5
176 251 77 0 253 192

a from ID:B7
50 164 206 0 200 15 56

a from ID:B1
232 252 21 16 237 192

a from ID:B7
50 164 205 64 200 15 55

a from ID:B7
50 164 205 64 200 15 55

a from ID:B5
176 251 79 0 255 64

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 204 128 200 15 54

a from ID:B7
50 164 203 192 200 15 53

a from ID:B1
176 251 77 0 253 192

You can recieved this data and you are very good.I also have a he 6-pin chevrolet sensor sensor. Can you tell me how to start it? I need to know its startup can-bus command, and I try to collect its data.Who can help me?Thanks in advance.

I want to develop a project about measuring NOx sensor of Ford GM Volvo and saving that data in SD card. Now I can try to get NOx sensor of Cummins, but I don't have datasheet for others. Who can tell me other can IDs and data or tell me where to get relevant information? I can try. My email: darwinying@163.com. Thank you in advance.