Grain storage temperature and moisture probe
Build it step by step
0 of 7 doneMake the probe
Fix three DS18B20 at depths on a PVC pipe and seal the ends.
Wire the bus
Join the three data wires with one 4.7 kΩ pull-up.
Test the readings
Check all three agree in room air within about 0.5 degrees.
Label the probes
Warm one in your hand to learn which index it is.
Add the AHT20
Check humidity on the LCD.
Test the warning
Warm one probe and see HOT SPOT.
Install
Push the pipe into the grain and mount the electronics above, dry.
How do you build a grain storage temperature and moisture probe?
A probe with three DS18B20 sensors pushed into a grain bin warns when hot spots start, an early sign of insects or mould. You need Arduino Nano, DS18B20 waterproof probe × 3, Resistor 4.7 kΩ, AHT20 temperature and humidity sensor, 16x2 LCD with I2C backpack (PCF8574) and Active buzzer 5 V. It takes 7 steps and about 90 minutes.
- Level
- Intermediate
- Time
- About 90 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- PassivesBuyResistor 4.7 kΩ × 1
- SensorsBuy
- DisplaysBuy
- Motors & ActuatorsBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Three DS18B20 red wires | Nano 5V | Power |
| Three DS18B20 black wires | Nano GND | Ground |
| Three DS18B20 yellow data wires | Nano D2 and 4.7 kΩ resistor to 5V | One shared bus |
| AHT20 VCC and GND | Nano 5V and GND | Power, check your module accepts 5 V |
| AHT20 SDA and SCL | Nano A4 and A5 | I2C |
| LCD I2C SDA and SCL | Nano A4 and A5 | I2C, shared |
| LCD I2C VCC and GND | Nano 5V and GND | Power |
| Active buzzer + | Nano D6 | Warning |
| Active buzzer - | Nano GND | Ground |
Code
Insulating grain keeps its heat, so a hot spot from insects or mould shows up as one probe reading several degrees above the others, usually a few days before there is visible damage. Fix the three waterproof probes at different depths on a PVC pipe with the cables inside it, and push the pipe into the grain; the AHT20 sits above the grain in the bin air. Compare the probes with each other rather than trusting one absolute number, and compare today's readings with last week's. The three probes share one data wire and are read by index, so label their order once. Grain should be stored dry; for the safe moisture level for your crop, follow local agricultural guidance. Arduino IDE, board "Arduino Nano" (processor ATmega328P, or ATmega328P (Old Bootloader) for clones).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Libraries: OneWire, DallasTemperature, Adafruit AHTX0, LiquidCrystal_I2C.
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <Adafruit_AHTX0.h>
#include <LiquidCrystal_I2C.h>
OneWire ow(2);
DallasTemperature ds(&ow);
Adafruit_AHTX0 aht;
LiquidCrystal_I2C lcd(0x27, 16, 2);
const byte BUZ = 6;
const float HOT_SPOT_C = 5.0; // a probe this much above the coolest one is a hot spot
const float MAX_RH = 70.0; // humidity above the grain that favours mould
void setup() {
Serial.begin(9600);
pinMode(BUZ, OUTPUT);
ds.begin();
aht.begin();
lcd.init(); lcd.backlight();
}
void loop() {
ds.requestTemperatures();
float t[3];
for (byte i = 0; i < 3; i++) t[i] = ds.getTempCByIndex(i);
sensors_event_t hum, temp;
aht.getEvent(&hum, &temp);
float lo = min(t[0], min(t[1], t[2])), hi = max(t[0], max(t[1], t[2]));
bool hot = (hi - lo) >= HOT_SPOT_C;
bool damp = hum.relative_humidity > MAX_RH;
lcd.setCursor(0, 0);
lcd.print(t[0], 0); lcd.print(" "); lcd.print(t[1], 0); lcd.print(" "); lcd.print(t[2], 0); lcd.print("C ");
lcd.setCursor(0, 1);
lcd.print("RH "); lcd.print(hum.relative_humidity, 0); lcd.print("% ");
lcd.print(hot ? "HOT SPOT " : (damp ? "DAMP " : "OK "));
Serial.print(t[0]); Serial.print(","); Serial.print(t[1]); Serial.print(",");
Serial.print(t[2]); Serial.print(","); Serial.println(hum.relative_humidity);
digitalWrite(BUZ, (hot || damp) && ((millis() / 1000) % 10 == 0)); // short beep every 10 s
delay(5000);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
24.50,-127.00,-127.00,0
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Room air | Three probes within 0.5 degrees |
| One probe warmed | HOT SPOT after the difference reaches 5 |
| High humidity | DAMP |
| Normal | OK |
If it does not work
A probe reads -127
Check its wiring and the shared pull-up.
Only two probes found
Check each data wire joins the bus.
No display
Try LCD address 0x3F.
False warnings
Probes in different sun or draught; keep them in the same bin.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the grain storage temperature and moisture probe?
Arduino Nano, DS18B20 waterproof probe × 3, Resistor 4.7 kΩ, AHT20 temperature and humidity sensor, 16x2 LCD with I2C backpack (PCF8574) and Active buzzer 5 V.
How long does the grain storage temperature and moisture probe take to build?
About 90 minutes for a intermediate maker, in 7 steps.
How do I know the grain storage temperature and moisture probe works?
Room air: Three probes within 0.5 degrees. One probe warmed: HOT SPOT after the difference reaches 5. High humidity: DAMP.
A probe reads -127: what should I check?
Check its wiring and the shared pull-up.
Only two probes found: what should I check?
Check each data wire joins the bus.
No display: what should I check?
Try LCD address 0x3F.
False warnings: what should I check?
Probes in different sun or draught; keep them in the same bin.
