Hi, i'm trying to connect a campbell sceintific TDR 655 (https://www.campbellsci.com/cs655-specifications) with a SDI-12 output to an Arduino UNO. I'm not sure if this is possible using some kind of shield or with direct connections. An external power supply (12 Vdc 45 mA) will be use for the CS655 and the Arduino will serve as a datalogger. I'd appreciate any recommendation.
I tried this library (GitHub - joranbeasley/SDISerial: An SDI-12 Serial Library for Arduino) for interfacing SDI-12 sensors with Arduino. It seems there is no problem with sensors with only one SDI-12 Data line (Decagon device example). The thing is the CS655 has Rx and Tx so i'm a little loss with the connections and how to modify the example code.
CS655 Function Arduino
Green TxD 2
Red Power (External)
Black G Ref. G
Clear G Shield G (Source)
Orange RxD ?
#include <SDISerial.h>
#include <string.h>
#define DATA_PIN 2
SDISerial connection(DATA_PIN);
char output_buffer[125]; // just for uart prints
char tmp_buffer[4];
//initialize variables
void setup(){
connection.begin();
Serial.begin(9600);//so we can print to standard uart
//small delay to let the sensor do its startup stuff
delay(3000);//3 seconds should be more than enough
}
//main loop
void loop(){
//print to uart
Serial.println("Begin Command: ?M!");
//send measurement query (M) to the first device on our bus
char* resp = connection.sdi_query("?M!",1000);//1 second timeout
//this really just returns a message that tells you the maximum wait before the measurement is ready
sprintf(output_buffer,"RECV: %s",resp?resp:"No Response Recieved!!");
Serial.println(output_buffer);
delay(10000);//sleep for 10 seconds before the next read
}
The SDI-12 specification here shows that comms all work on a single data wire so I have no idea what the other one is for on your CS655.
As the library is based on Software Serial maybe you can just try that instead with correct baud rate and invert signal.
Software Serial didnt work, so now i connected the Shield Ground wire to Arduino's G and ignored de Rx wire using Tx as the SDI data line.
CS655 Function Arduino Power Source
Green TxD pin 2 -
Red Power - 12V
Black G Ref. - G
Clear G Shield G -
Orange RxD - -
Now im getting a response using the same code as above (RECV: 2). As the code says is the value of the maximum wait before the measurement is ready. I'm not sure how to proceed though.
Did you invert the logic in software serial as this looks like it's needed. I don't think this option is documented for it but adding a true after the rx & tx pin will do it.
From the software serial header...
So finally i succeeded by using another library https://github.com/StroudCenter/Arduino-SDI-12 and wiring ref. ground to power source and shield ground to arduino ground (just like the schematic above). I used the simple logger example code from the library.
Hello I need to read the same sensor but it does not work, I connect the earth as you say and use the same program. But the sensor is still not detected.
I do not know what to do with the orange cable, I leave it in the air?