SDI-12 to 3.3V ESP32 unsure of circuit

Thread Starter

timothyb

Joined Sep 16, 2009
11
I’m trying to interface a 3.3v ESP32 to an SDI-12 12V sensor, I’m finding a lot of conflicting information online chat gpt says the following will work however I’m not convinced.


  • draw a voltage-vs-time diagram for one SDI-12 bit,
  • explain why a comparator isn’t normally used,
  • or help you phrase this explanation for a forum post verbatim.

Mod: Edit text layout.
 
Last edited by a moderator:

Irving

Joined Jan 30, 2016
5,068
SD-12 is a 3-wire parallel bus for distributed sensors using async signalling at 1200baud. The actual signalling on the serial data line is at 5v and is similar to RS-232 with the same asynchronous byte encoding. The inline data is human readable as the data is transmitted in ASCII. That means the line idles (mark) at 3 - 5v and is pulled low for the signalling (space, <1v = '1').

1769692013955.png(images from SDI-12 spec v1.4)



The typical arrangement for this would be:

1769698550342.png
The ESP-32 is a 3.3v device, but the GPIO and TX/RX pins are 5v tolerant so the CMOS buffer runs off the 5v rail, with a 1k5 resistor between the input buffer and the RX pin.
 

Thread Starter

timothyb

Joined Sep 16, 2009
11
SD-12 is a 3-wire parallel bus for distributed sensors using async signalling at 1200baud. The actual signalling on the serial data line is at 5v and is similar to RS-232 with the same asynchronous byte encoding. The inline data is human readable as the data is transmitted in ASCII. That means the line idles (mark) at 3 - 5v and is pulled low for the signalling (space, <1v = '1').

View attachment 362886(images from SDI-12 spec v1.4)



The typical arrangement for this would be:

View attachment 362898
The ESP-32 is a 3.3v device, but the GPIO and TX/RX pins are 5v tolerant so the CMOS buffer runs off the 5v rail, with a 1k5 resistor between the input buffer and the RX pin.
Is there a way to only use one esp32 pin to receive and transmit?
 

Irving

Joined Jan 30, 2016
5,068
Is there a way to only use one esp32 pin to receive and transmit?
Maybe, but you may not be able to use the UART, you' d have to bit-bang it yourself. But using the external buffer you'd need to put the RX buffer tristate when you want to start sending so you need a GPIO O/P to drive that anyway.TX/RX, TX-enable and RX-enable, as the TX output has to go tristate as before. So still needs 3 pins.
 
Last edited:

Irving

Joined Jan 30, 2016
5,068
Will this circuit work?
I can't be 100% sure until I get some time to fully analyse it, maybe later today, but on first glance I doubt it as there's no way to turn the 5v bias off (ie put the output into tristate) dynamically, nor does it meet the impedance requirements of SD-12.

Why do you have limitations on ESP-32 pins?
 

Thread Starter

timothyb

Joined Sep 16, 2009
11
I can't be 100% sure until I get some time to fully analyse it, maybe later today, but on first glance I doubt it as there's no way to turn the 5v bias off (ie put the output into tristate) dynamically, nor does it meet the impedance requirements of SD-12.

Why do you have limitations on ESP-32 pins?

I tried putting it into Tsprice, seems to work i think

simulation.png
 

Irving

Joined Jan 30, 2016
5,068
Doesn't meet SDI-12 interface criteria:

"When an SDI-12 device has its transmitter on, its direct current (DC) source resistance
must be greater than 1000 ohms and less than 2000 ohms. Due to this impedance, the maximum
cable length depends on the capacitance of all cables connected to the data line. When any SDI-12
device's transmitter is off, including during a low-power standby mode, the DC resistance to
ground must be within 160K to 360K ohms. If an SDI-12 sensor does not use the 12-volt line for
power, its data line resistance to ground while powered down must be within 160K to 360K ohms.
"

1. You cannot turn the bias feed (thru R3) off - SD-12 protocol is that all devices, in low-power standby mode or when they are not signalling, turn their transmitter off - ie no power on the line, and a DC resistance of data-line to ground around 260k +/- 100k

2. You don't meet the line-impedance spec, when the transmitter is on, of approx 1500 ohms +/- 500 ohms

You cannot do that with just 1 pin.
 
Top