Jump to content

Recommended Posts

Hello all, 

I have been doing a project for a bit now, trying to get data from a NOx sensor. Nonetheless, I have tried to initialize the CANbus (SAEJ1939 Protocol) connection, but when I check the voltage for the CAN pins, there is no voltage. It should have 24 Volts so the sensor initializes. I have also connected the sensor and it does not start heating up whatsoever. I have tried other example programs for CANbus that do not use SAEJ1939 with no avail. If anyone could tell me what I am doing wrong I would really appreciate it. I have attached my program and the mentioned pins that have no voltage. Also what does PE (see picture) mean?  Thank you!

 

IMG_1940.jpg

 

Link to comment
Share on other sites

  • MVP 2023

As in, the connector does not SUPPLY 24 volts, it NEEDS it.

PE means Protective Earth.  It is often needed for the  -  to be connected to ground.  But at the very least your cable's shielding should be connected to it and properly earthed.

Should the sensor be using the same power as the bus network?

  • Thanks 1
Link to comment
Share on other sites

Thank you very much for your replies. When I become experienced I hope to be able to help people like you do. 

20 hours ago, Gabriel Franco said:

You should use an external PS wired to +V - V

Figures. I thought it had something to do with the CANBus pins, as in High and Low. So I would have to wire in two power sources? In the CANbus pins and the HMI Pins?  Wouldn't adding an external PS make my code a bit irrelevant since it would start the communication immediately without user input? Is there a solution for this? Would I have to buy an expansion module to be able to power the CANbus ports? Thank you very much for your reply.

 

19 hours ago, Ausman said:

Should the sensor be using the same power as the bus network?

Yes, it should. It's just that we should be able to control when it starts. Adding  a power source would not let us have the level of control we would like on the sensor. Since the sensor would start immediately when the PLC turns on. My perception was that since the PLC had power already (24 V) once the communication started it would supply the voltage on demand. Guess I was completely wrong. I thank you very much for your reply.

Edited by Sergio Ramos
Adding questions
Link to comment
Share on other sites

8 hours ago, Sergio Ramos said:

So I would have to wire in two power sources? In the CANbus pins and the HMI Pins? 

No, just one device on the entire CANBus network. You can use same PS used to power PLC, however I recommend to protect with fuse the CANBus power lines.

8 hours ago, Sergio Ramos said:

Wouldn't adding an external PS make my code a bit irrelevant since it would start the communication immediately without user input? Is there a solution for this?

Is your code what defines when and how exchange data, you may add conditions as required.

8 hours ago, Sergio Ramos said:

Would I have to buy an expansion module to be able to power the CANbus ports?

I don´t think

 

 

Link to comment
Share on other sites

On 3/15/2022 at 10:13 AM, Sergio Ramos said:

Adding  a power source would not let us have the level of control we would like on the sensor

I don't think you should have an issue with that. power and communication are different things, I don't know the entire scope of your application, but the sensor being ON and communication is established does not mean that you have less control, indeed you should have even more control since you can distinguish between a null reading, a disconnection, and the actual reading from the sensor.
so, Ideally, you should be able to power up the system, establish the connection, if everything is ok then get the readings of the sensor, and based on your logic take actions
Why will you need an external PS depends on the design of the CAN network, since CAN is a Fieldbus protocol you could have many devices over long distances (voltage drops could be an issue ), or a cable could be damaged and make a short circuit, so having a different Voltage source for your control (PLC) network or sensor makes sense depending on the design of the network itself.
In your case seems that the same PS could be used for everything.

 

Link to comment
Share on other sites

22 hours ago, Gabriel Franco said:

No, just one device on the entire CANBus network. You can use same PS used to power PLC, however I recommend to protect with fuse the CANBus power lines.

Is your code what defines when and how exchange data, you may add conditions as required.

I don´t think

 

 

Yep I think I finally understood. I thank you very much!

 

5 hours ago, Fernando Castro said:

I don't think you should have an issue with that. power and communication are different things, I don't know the entire scope of your application, but the sensor being ON and communication is established does not mean that you have less control, indeed you should have even more control since you can distinguish between a null reading, a disconnection, and the actual reading from the sensor.
so, Ideally, you should be able to power up the system, establish the connection, if everything is ok then get the readings of the sensor, and based on your logic take actions
Why will you need an external PS depends on the design of the CAN network, since CAN is a Fieldbus protocol you could have many devices over long distances (voltage drops could be an issue ), or a cable could be damaged and make a short circuit, so having a different Voltage source for your control (PLC) network or sensor makes sense depending on the design of the network itself.
In your case seems that the same PS could be used for everything.

 

I see, so it is completely independent. The data transmission will not start until a connection via programming is established. I think I get it now. Gracias te lo agradezco mucho! (Vi en uno de tus posts que eras de Mexico, yo soy tu paisano :) )

 

 

I wish there was some more information on the J1939 protocol. I have looked everywhere and it seems it is fairly unused in my application for reading sensors. I just attached the power but it does not seem to get a connection. I'll keep trying, but if anyone has examples of using SAEJ1939 on Visilogic I would really appreciate if you could share. In any case I thank you all for guiding me through this!

Link to comment
Share on other sites

  • MVP 2023

Your reply just popped up as I finished writing this, but I'll put mine up anyway for some further info.

Perhaps your sensor does incorrect actions through not being powered up at a certain time in the plc boot sequence?  But really....sensors are sensors and pretty much do an output of a condition, so even if they are already powered on the plc should be able to do a correct read at any time.

For what it's worth, I mostly use the same power supply for my entire systems, but they are all separately fused and some of the sensor circuits have an interrupt relay on them, so the plc can cycle the power to that circuit as necessary.  Perhaps this is an option for you to implement?   The longest power run for me is perhaps 50m so it is a practical way to do things.

My systems run 24/7, and sometimes a sensor might play up but is only needing a power cycle to fix the gliche which has occurred.  The plc recognises erroneous signals and cycles the power by powering the relay which opens the NC contacts.  On one particular modbus loop, this saves a lot of headache.  Some unique "extremely hard to pinpoint" power condition on the site causes very occasional interference which permanently upsets some sensors, and the only practical solution is to recognise errors and do a power cycle.

edit...And in writing the last sentence I have just realised it could even be that the site is right next to a main road, with who knows what sort of interference coming from a vehicle driving past.   I well remember a PC program I wrote many years ago to do lap recording for a motorsports venue special 24 hr event.  It all worked perfectly in repeated testing, but on the day of the event it kept on completely falling over due to all the electrical noise coming from some of the cars' special ignition systems....driving past 50m away!  Everyone understood, but it was very embarrassing having to eventually correlate manual recording together with the sporadic automated one!

cheers, Aus

Link to comment
Share on other sites

On 3/16/2022 at 5:08 PM, Ausman said:

Your reply just popped up as I finished writing this, but I'll put mine up anyway for some further info.

Perhaps your sensor does incorrect actions through not being powered up at a certain time in the plc boot sequence?  But really....sensors are sensors and pretty much do an output of a condition, so even if they are already powered on the plc should be able to do a correct read at any time.

For what it's worth, I mostly use the same power supply for my entire systems, but they are all separately fused and some of the sensor circuits have an interrupt relay on them, so the plc can cycle the power to that circuit as necessary.  Perhaps this is an option for you to implement?   The longest power run for me is perhaps 50m so it is a practical way to do things.

My systems run 24/7, and sometimes a sensor might play up but is only needing a power cycle to fix the gliche which has occurred.  The plc recognises erroneous signals and cycles the power by powering the relay which opens the NC contacts.  On one particular modbus loop, this saves a lot of headache.  Some unique "extremely hard to pinpoint" power condition on the site causes very occasional interference which permanently upsets some sensors, and the only practical solution is to recognise errors and do a power cycle.

edit...And in writing the last sentence I have just realised it could even be that the site is right next to a main road, with who knows what sort of interference coming from a vehicle driving past.   I well remember a PC program I wrote many years ago to do lap recording for a motorsports venue special 24 hr event.  It all worked perfectly in repeated testing, but on the day of the event it kept on completely falling over due to all the electrical noise coming from some of the cars' special ignition systems....driving past 50m away!  Everyone understood, but it was very embarrassing having to eventually correlate manual recording together with the sporadic automated one!

cheers, Aus

Thank you for the insight Aus. I don't know if it is because of an noise or other issues, which hopefully I believe it is not the case. I added a switch (for now) to regulate the power on the sensor. I also followed the advice posted before and powered the V- and V+ pins.   At the moment I cannot figure out how to start the heating up process of my nox sensor. I don't know if it is a programming aspect, (hopefully it is) but on I can't find where on Visilogic I can input a SPN or a start code for the sensor.  I have redone my program several times and now I can say that the program does import the right data but the sensor simply does not start. I have attached my program if you'd like to take a look.  I sincerely thank you for your reply.

 

P.s It is quite funny that you mention that the it does not work if cars are  going by. My office is right next to the shipping area where large truck go by. I might need to test somewhere else xD. 

1998127121_ManualNox.pdf

Link to comment
Share on other sites

  • MVP 2023

Hi,

Two tips for you about NOx not start.

1. Average current on NOx =1.5A.  Peak current can be above 10A (typical 6-10A) for internal PWM in cold condition. Than you must use above 10A PS or battery for sensor power. 

2. In ManualNox on the last page present Start Code. Maybe it must be programmed in Request tab of J1939 FB.

If it possible, please post all pages of sensor manual.

Link to comment
Share on other sites

17 hours ago, kratmel said:

Hi,

Two tips for you about NOx not start.

1. Average current on NOx =1.5A.  Peak current can be above 10A (typical 6-10A) for internal PWM in cold condition. Than you must use above 10A PS or battery for sensor power. 

2. In ManualNox on the last page present Start Code. Maybe it must be programmed in Request tab of J1939 FB.

If it possible, please post all pages of sensor manual.

Then for the sensor I would have to provide around 10 A so it can start? Would the PLC be all right since the power is going from the PLC to the sensor? II have attached a copy of the full manual.

And for the start code, yes that is exactly what I do not understand how to do. I cannot seem to find where I can input a SPN, or if I would have to send bits of data to the seventh byte so it would start. I've had some ideas but they have not worked thus far. If you have any thought or comment please let me know. I sincerely appreciate your help, thank you!

Nox sensor full manual (2).pdf

Link to comment
Share on other sites

  • MVP 2023

Thanks for manual.

I find this info on arduino forums, maybe you can run your sensor by use some data from this two topic.

https://forum.arduino.cc/t/measurement-of-nox-can-bus/352960/2

https://forum.arduino.cc/t/controlling-automotive-nox-sensor-with-can-bus/540699

Please scroll programs. You can find J1939 message for start sensor. 

Link to comment
Share on other sites

4 hours ago, kratmel said:

Thanks for manual.

I find this info on arduino forums, maybe you can run your sensor by use some data from this two topic.

https://forum.arduino.cc/t/measurement-of-nox-can-bus/352960/2

https://forum.arduino.cc/t/controlling-automotive-nox-sensor-with-can-bus/540699

Please scroll programs. You can find J1939 message for start sensor. 

Now that I took look at them,  I'm wondering if it is possible to create a bit array  in visilogic? I mean as (0,0,0,0,0,4,0,0). I want to try and send that, is there a way to do this? I thank very much once again. 

Link to comment
Share on other sites

On 3/18/2022 at 12:16 PM, kratmel said:

Thanks for manual.

I find this info on arduino forums, maybe you can run your sensor by use some data from this two topic.

https://forum.arduino.cc/t/measurement-of-nox-can-bus/352960/2

https://forum.arduino.cc/t/controlling-automotive-nox-sensor-with-can-bus/540699

Please scroll programs. You can find J1939 message for start sensor. 

Hello Kratmel, I really appreciate your help.

I found the issue of the problem, the start code must be configured with the subsequent MIs of the chosen vector startpoint in the j1939 transmit screen (the data pointer, first parameter in the j1939 configuration). Say if the start MI was MI 0, and your start code was 04h in hexadecimal. You would have to put the start up values as MI0=0 MI1=0 MI2=0 MI3=400, in the hexadecimal format. And then the sensor would start heating up. And to turn it off the same would be done with another vector and you would have to input your stop code. Hope this can help someone if they have a similar experience as mine. 

 

I thank everyone once again. 

  • Upvote 1
Link to comment
Share on other sites

  • MVP 2023

Hi, it's great that you can run the sensor.

You have come a long way in launching this sensor. However, if possible - put here a photo of the configuration that allowed you to start the sensor.

I can't ask you to send your project - it's your intellectual property. However, the part of it that configures and reads data with small comments would be very useful for forum visitors.

Link to comment
Share on other sites

Hello,

Honestly, I do not mind to share my code at all.  I'm just an intern at this company (have not even graduated) where not even my boss knows how to use PLC (no one really), so this was more of a "see if the intern can do it to save costs" kind of project.  In school, I mostly learned about basic ladder programming, and I used Siemens and Rockwell. So this was completely out of what I know, (no one in the company taught me anything),  and I am really grateful to the people in this forum for helping me learn something new. Sorry if this sounds like a rant, just wanted to express my thanks and why I am willing to share my program. Hopefully it can help someone the way I was helped here. 

Thanks again. 

 

Parameters.thumb.jpg.6c34047e2cd0443d9e68120f39fe1db2.jpg

J1939 NOX TEST CONNECTION.vlp

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...