09-05-2016 11:11 AM
Hi,
I'm currently trying to connect a Decagon 5TM soil moisture sensor to a NI PCI-6225 card.
The sensor has three wires: GND, power, and data. Data can be send via a DDI serial protocol at a 1200 baud rate, see http://manuals.decagon.com/Integration%20Guides/5TM%20Integrators%20Guide.pdf (page 10). When the sensor is powered, it sends 1 start bit, 8 data bits and 1 stop bit. Afterwards the sensor can be powered off, which increases its life time.
I would like to power the sensor via a digital line of the NI PCI-6225 card and then read in the data via a second, single digital line of the same card.
Since data is send in a serial fashion, I thought it would be possible to aquire the data using the 'VISA configure serial port' and the 'VISA read' function. However, 'VISA configure serial port' expects a COM port as input and not a single digital line.
Does anybody have an idea how I could circumvent this problem or if there's another way to read the data? In the end I'd like to read data from 12 sensors of that kind, which should be accomplished using the 24 digital channels the NI card offers.
Any help would be appreciated...
Kind regards
Sepplovich
09-05-2016 11:30 AM - edited 09-05-2016 11:33 AM
There is a chip (or two) on a VISA device that "looks at" a digital line, times its transitions according to some protocol (e.g. RS-232, VISA), and "interprets" it as a Byte value. It usually had inputs that lets you specify the clock speed (a.k.a. Baud Rate), how many "data" transitions + "support" transitions (sometimes called "Parity" and "Stop" bits) to expect, and can also buffer the data so you can get, say, 100 bytes terminated by a specified set of bits (sometimes called a "Termination Character").
You could "reinvent the Wheel" and choose to implement the VISA protocol using one or two digital lines, but this strikes me as a lot of work and not "cost-effective". A colleague of mine showed me a device that spits out a digital stream that conforms to the VISA protocol, but at some insane Baud rate (something over a million, as I recall) that he feeds into another chip that "plays VISA" and returns a stream of u8 bytes. I don't remember the cost of the chip, but I believe it was less than $20.
Bob Schor
P.S. -- I may have stated the chip behavior wrong. It might have accepted the bit stream and turned it into a VISA signal, sent to the PC via a USB connection, and read with a simple VISA read. In any case, a small amount of hardware was used to turn a one-bit Bit Stream into usable VISA, something that the Industry has been doing for at least 4 decades ...
09-05-2016 11:32 AM
VISA is for serial ports, TCP/IP, GPIB communications. You have a DAQ card so you need to use DAQmx to read from that cart. Use continous timed digital reads to read the data.
The tricky part is you are going to need to write your own driver to detect the pattern of bits in the digital read and convert them to data. It might be more work than you can handle.
I'd suggest looking at one of those DDI to serial converters they talk about in that document.
09-06-2016 02:24 AM
Thanks Bob_Schor and RavensFan for your input.
I thought there might be a simpler solution.
A friend of mine was communicating with the same sensor over an Arduino Mega. He simply connected the Data pin of the sensor to one of the Arduinos RX inputs and used Serial.parseInt() to read the data. I thought there would be a similar solution for Labview.
I'm not an expert in electronics, but could it work if I'd simply connect the Data pin of the sensor to the RX pin (pin 2?) of a 9 pin RS232 D-Sub connector and connect that to the PC?
09-06-2016 02:31 AM - edited 09-06-2016 02:34 AM
Hi Sepp,
but could it work if I'd simply connect the Data pin of the sensor to the RX pin (pin 2?) of a 9 pin RS232 D-Sub connector and connect that to the PC?
Well, reading the PDF you linked in your 1st message would help to answer your question:
The serial signals and protocols supported by the sensor require some type of interface hardware to be compatible with the serial port found on most personal computers (or USB-to-Serial adapters). There are several SDI-12 interface adapters available in the marketplace;
Found on page 4!
I'm not an expert in electronics
Then you should read manuals more carefully and follow their recommendations! 😄
09-06-2016 02:50 AM
Well, I've read the manual carefully: the sensor can communicate with 2 different protocols: DDI and SDI-12. After beeing powered, it sends data using the DDI protocol and only AFTERWARDS it switches to the SDI-12 protocol!
Using the DDI protocol has the advantage that I can switch on the sensor, read the data and turn it off afterwards. This has the advantage that it hasn't to be powered all the time, increasing its lifetime. A SDI-12 to USB converter costs more than 100€ which I would like to save, having bought already a quite expensive NI card. Moreover, even the manufacturer of the sensor recommends at some point on its homepage not to use the SDI-12 protocol if you want to have reliably read data from the sensor...
05-06-2021 02:35 PM
I am about to implement the same Decagon sensors - any chance you would share your code and hardware specs?
Thanks a bunch
DN
05-07-2021 03:15 AM - edited 05-07-2021 03:26 AM
Hello,
in the end I've used an Arduino Nano as an interface. In the meanwhile there's a SDI-12 library in the official Arduino libraries repository.
The trick is to power the sensors only shortly one after the other, so you can use the same standard sensor address when querying data.
If I remember correctly, I used the digital lines of the NI card to power the sensors. The current output of the NI card I was using was sufficient for that.
Hope this helps