DIY Grain bin monitoring system and fan Control

Ok easy enough. So power, ground and I go back to A5 with the resistor off of the ground line for parasitic mode?

DS18B20 Pin
1 GND direct to GND
2 DQ (data) direct to microcontroller pin
3 Vdd (power) direct to 5V or 3.3V

Pullup resistor (500-4700 ohm) from DQ to Vdd

I wonder if my cable has a short in it, or am I wrong to test it just soldering the resistor in like this? Powers the uno right off when going off 5V and 12V doesnt smell good

Did you connect it with the correct polarity on the cable? If you connect the cable backwards it acts as a short and heats the sensors up very fast.

If you hold up the connector for the cable and look at it dead on with the clip up. Then the left terminal is the signal and the right terminal is ground.

Had the signal wire on the wrong side of the resistor, ended up going:

ground to ground
5V ā†’ 2200 ohm ā†’ A5 ā†’ signal wire

Now I just have to figure out how to display the moisture

If you have the commercial moisture cables they use a DS28EA00 onewire sensor that bitbangs I2C out to a SHT35 moisture sensor. If you need an example of the code to use to read them I have linked an example below.

Yup thatā€™s them, Iā€™ll see if I can mash the code together to get something that works. Thanks!

How many wires are there? 2 for temp and 2 for moisture?

Since the DS28EA00 acts as a bridge to the I2C humidity sensor they can all run on the same onewire bus. So only one signal wire but they often arenā€™t parasitically powered so there would be a separate wire for power, so 3 wires in total(GND, bus, Vcc),

I have been reading temp only cables such as BinSense with 2 wires. If I were to read moisture cables I would just need to add a Vcc wire? (and some code)

If I2C is being used how can it work over such a long distance? It must be 40ft or more on large bins. Or is the DS28EA00 using I2C to read the humidity sensor and sending the info back on the 1-wire protocol?

You should only have to add a Vcc line and the code. I always meant to write a library but I am to lazy to do so.

It works in a very clever way. There is only ever onewire going over the bus. At each humidity sensor there is a small PCB with a DS28EA00 onewire sensor and a SHT35 humidity sensor. The DS28EA00 is like a DS18B20 except it has 2 IO pins that can be controlled via onewire commands. These are connected to the SDA and SCL pins on the SHT35 sensor.

The code I wrote bitbangs out I2C on these two IO pins. It is basically a software I2C sketch that I changed to instead of writing and reading from registers it reads/writes to the bus. The disadvantage of this is that it is quite slow at .84 s per sensor, this means that on a large non it could take almost a minute to read all the sensors. This is probably why commercial systems use a mix of temp only and moisture cables.

The really cool part is that this code in theory should work with any I2C devices that support low speeds, this could potentially be used for something like gas sensors or bin level sensors.

1 Like

Would the DS2482 be able to read humidity through the DS28EA00?

I donā€™t see why not. It just has to be any onewire master that can read and write data to the bus.

I use code from Matt Reimerā€™s repo

I have this in my loop that reads the temp only sensors

        if (addr[0] == 0x42){ // moisture cable OneWire device
          float mois = getMois(addr, OW);
          //Serial.print("\r\n");
          //Serial.print(mois);
          float linearRH = (-2.0468 + 0.0367 * mois + -0.0000015955 * mois * mois) * displayPrecision ;
          tempSensorReadings[tempSensorCount].trueRH = ((float(tempSensorReadings[tempSensorCount].tempC) / displayPrecision - 25.0) * (0.01 + 0.00008 * mois) + (linearRH / displayPrecision)) * displayPrecision;
        }
byte displayPrecision = 100;       // 100 - for 2 decimal places, 10 - for 1 decimal place

Hereā€™s the getMois() function
Mois.ino (17.7 KB)

The trueRH needs converting to percent moisture yet, that code I have not cobbled together yet

Thanks for that. still havenā€™t had a chance to put something together. Trying to figure out why it wonā€™t read the 4 cable setup in a couple of the neighbours 32k bu westeel bins at the moment