We wrote Program for Interfacing Hydros sensor 21 with Arduino Uno board using SDI-12 interface and saw the result on serial monitor . We tried a lot in implementing a program for connecting sensor directly to the digital Pin (Pin7/Pin2) of the Arduino UNO board using SDI-12 interface and viewing the result on the serial monitor. We found only garbage data coming on the serial Monitor.
We uploaded program here.
#include <SDI12.h>
const int dataPin = 2; // Connect the data pin to digital pin 2
SDI12 sdi12;
void setup() {
Serial.begin(9600);
sdi12.begin(dataPin);
}
void loop() {
// Request data from the sensor
sdi12.sendCommand(“0M!”);
// Wait for the sensor to respond
delay(1000);
// Read and print the sensor response
while (sdi12.available()) {
char c = sdi12.read();
Serial.print(c);
}
// Wait for a moment before taking the next reading
delay(5000);
}
Can you guide whether we require any digital hardware between Hydros sensor21 and Arduino Uno board?