The Combine Forum banner

Reading Opi moisture cables with 1wire (one wire)

11917 Views 24 Replies 9 Participants Last post by  ada401wp
Had anyone successfully read the moisture sensors with a home brew one wire reader that would like to share how they do it? My Arduino detects an unknown one wire chip on the bus and I suspect the moisture sensor is connected to it but I don't know how to read it.
21 - 25 of 25 Posts
If you use a resistance sensor, and calibrate it for the density of the grain, you can get far better moisture readings than the sensors in OPI cables.
I just read a PhD thesis done a couple of years ago on using small capacitive sensors to measure moisture. They had success, though they never achieved an accuracy better than the 2% that using relative humidity and the OPI cables can do.

The problem with resistive sensors is that they corrode and will wear out over time, though maybe grain would wear them (which would cause its own issues).

For me I think the OPI moisture cables are the best and easiest way to go. I managed to decode their moisture curve data that the OPI handheld reader is using, but when I feed their constants into the formula I get moisture calculations that are quite far off of the OPI calculations. Must be missing something. Maybe they've modified the curve formula. For example, OPI is using the Halsey equation for canola, but I don't know if it's the modified Halsey equation and which version. For that matter the results from the OPI reader don't seem to match any of the standard charts I've seen for EMC. Although OPI's reading matches what the moisture was reading on the 919 when I put it in the bin, so I think it's somewhat accurate, moreso than the charts I found.
See less See more
Okay I purchased a couple of moisture cables. I can see them on the 1-wire bus with owfs, but I can't easily determine how they identify which sensor is in which position. On the temp-only cables they use the hi and low byte fields to store this information. Anyone know how they determine sensor position on the moisture cables with DS28EA00 sensors?

From what I read on this forum and elsewhere the humidity sensors are standard SHT15 ICs, connected to the DS28EA00. Matt Reimer has code on github for reading this digital humidity value. However to get a moisture reading on the grain will require a formula to convert temperature and relative humidity to grain moisture. But it's certainly do-able and Matt has got it working I think. He may know how to determine which sensor is in what position. If none of you know I'll send him an e-mail.

In case you haven't seen this yet, m_elias, here's the modified 1wire code that can read the humidity value:
https://github.com/mattdreimer/Arduino-Temperature-Control-Library

And specifically, here's what he added:
https://github.com/mattdreimer/Ardu...mmit/7a55d1690fa3e100808b84fd0bdd8503a387823d
Just thought I'd add some of what I've learned here. I'll put it on my blog eventually.

According to the SHT1x data sheet, the relative humidity value you read off the sensor can be converted to a percent using the following formula:

RHlinear = c1 + c2 * SOrh + c3 * SOrh^2

If SOrh is the 12 bit number read from the sensor, c1 is -2.0468, c2 is 0.0367, and c3 is -1.5955E-6.

To get true RH when temperatures are not close to 25C, you use this formula:
RHtrue = (Tc - 25) * (t1 + t2 * SOrh) + RHlinear

Where Tc is temperature in C, t1 is 0.01, t2 is 0.00008.

This SOrh value can be read from the sensor using the code in modified 1wire library Matt Reimer put on github above.

Once we have relative humidity in percent, then it's a matter of applying a crop-specific formula, which I'll post when I find out where to find that.
Thanks torriem, that's good stuff. This winter I hope to update my Arduino/ESP8266 code to handle the moisture cables.
Trying to get Matts opi class to read humidity, but it always returns 4095.
Temperature reading seems fine.
Does anyone have an example use of Matt's code that calls getMois?
Thanks
Although I'm not using Matt Reimer's library directly, I have copied code from his getMois function into my own Arduino sketch. I don't have any moisture cable in operation but I was able to get readings from the one I borrowed. Those readings need calibrating according to temperature and then according to the grain you are trying to read before you get a grain moisture content value (this I don't yet know how to do).
Trying to get Matts opi class to read humidity, but it always returns 4095.
Temperature reading seems fine.
Does anyone have an example use of Matt's code that calls getMois?
Thanks
Using the library directly:
// function to print the Moisture for a device
void printMoisture(DeviceAddress deviceAddress)
{
printAddress(tempDeviceAddress);
unsigned int RH = sensors.getMois(deviceAddress);
Serial.print("M");
Serial.println(RH);
}

This works. I do convert to true RH elsewhere in the code.
I found a excel spreadsheet where you enter your grain type, temp and rh and it gives the EMC content. I ported the grain specific formulas to convert to Mois% but when I compare them to a handheld OPI reader they are roughly 1.5% higher. They must use different,tweaked EMC curves.

If your getting 4095, it might not be your code.
Try using a different pull-up. 1K works the best for me.
I have noticed that when using a 4.7k it reads the temp but erratic results on the Rh.
See less See more
  • Like
Reactions: 1
21 - 25 of 25 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top