Modbus: NPK-Sensor does not respond at all

@errorntrial Did you figure it out? We have the same problem.

I already answered your question:

but look at this:

...and...

@francebaliad I'm not sure if vamsiakula0390 really managed to get it run because he never really shared the exact steps (including code) to reproduce what he is claiming, but at least there is a chance that he DID manage to get it run while I was too stupid. So I recommend asking @vamsiakula0390 for help.

Good Luck with your project

1 Like

So, Yeah. I forgot to share the process. But after getting the sensor working, we finally found out that the sensor is not reliable (as it is not reading the actual N,P,K values i.e., the sensor is always showing values which are in linear relation with the EC , which should not be true keeping in mind the variables like soil texture, soil type....). So, we put that aside. If anyone wants to try to at least make your sensor work even after knowing that the sensor is not reliable, please let me know.

1 Like

Hey @decones you were very close, The sensor you have is not showing any response because your baud rate of the sensor is different from the baud rate you are trying to measure using the software.
I was also getting the same thing earlier, but after changing the baudrate of my sensor then, I was able get some values out of that sensor.

Sorry for the late reply, I was not getting my mail notifications.

So the thing was the default baudrate is the main problem from the point 1 to point 5 when coming to the software's. We got to know about this when we are working on the temperature sensors using software's. When working on the coding part for temperature sensor, yeah we found a way, but that way is not exactly working for the NPK sensor. So, we went on trying some more libraries to make the NPK modbus sensor work. Then finally we were able to use pymodbus.client.sync and make the NPK sensor work -- which was exactly giving the values given by the software's earlier. That's the reason of me adding 5th point there.

If you want to know what the code was and how we approached, please let me know.

But at the end of the day we are at the point that the sensor is not reliable.

I am really interested in having a proper one on one discussion if you are interested. @errorntrial

Hi guys, I got this one working, I check with CASModBusScanner (wich is a really cool thing) to better understand how the sensor works. Also, in contact with the seller I discovered that was using wrong datasheet. Attached is the working one.

Regarding this sensor reliability, I've same feeling, doesn't work well for NPK meas, at this time I only use it to measure E.C.
I also develop an Android App that comunicate using bluetooth and get all data (including lat and long) in a txt file that I use to interpolate values on QGIS software... that is the cool part, still missing a good and reliable senso... put me IN if you guys find someting new...

Cheers,
André




Processando: 五插针土壤变送器(485型).doc...
Processando: 五插针土壤变送器(485型).doc...
五插针土壤变送器(485型).pdf (730,5,KB)

1 Like

Hi, I'm also been struggle with this NPK sensor . I read the datasheet that you attached but I not sure of understanding it in the right way. Currently my inquery frames looks like the variables bellow:

const byte nitro = {0x01, 0x03, 0x00, 0x1e, 0x00, 0x01, 0xe4, 0x0c};
const byte phos = {0x01, 0x03, 0x00, 0x1f, 0x00, 0x01, 0xb5, 0xcc};
const byte pota = {0x01, 0x03, 0x00, 0x20, 0x00, 0x01, 0x85, 0xc0};

So at the end they should look like this?:

const byte nitro = {0x01, 0x03, 0x00, 0x00, 0x00, 0x04, 0x44, 0x0c};
const byte phos = {0x01, 0x03, 0x00, 0x00, 0x00, 0x04, 0x44, 0xcc};
const byte pota = {0x01, 0x03, 0x00, 0x00, 0x00, 0x04, 0x44, 0xc0};

Would you mind to share your code?

I have another sensor of this type, but with 3 pins, 6-1 (Humidity, Temperature, Conductivity, Nitrogen, Phosphorus, Potassium). I have it associated with a raspberry through Lora, and indeed, the values ​​provided by the NPK parameters do not find any sense, nor a way to scale them. I have compared them with laboratory tests, and nothing to see, nor similar. Do you think there may be a way to arrive at these data mathematically? Do you know another type of NPK sensor?

i have had success using esp8266 to connect to rs485 and display on screen (including web server/blynk). And it is working perfectly. The power supply for it is only 5v (using the same 5v power supply for both npk sensor and esp8266). I have some pictures

@tnkhoa2012 Great! you got the values. Can you please share the code which have you used in esp8266 and also the circuit diagram for more clarity. I am wondering how the sensor is connected in the picture you shared.

Did you find the sensor to be reliable?? i.e.,

  1. Are the values of the sensor similar to the lab tests?
    or
  2. Are you getting only increase in Nitrogen when only Urea is added..... etc

@decons Can you please share the code which you had used and also the circuit diagram of the final product. I am not able to get the wiring from the picture you sent.