SDI-12 Communication - 3.3V Microcontroller Level Shifted Up To 5.0V For Data

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Hey guys, I have a 3.3v based microcontroller that I am wanting to use to communicate with SDI-12 sensors. For reference, SDI-12 sensors are 3-wires (12VDC for power, ground, and then a data line that is 5V). 5V is logic 0. 0V is logic 1.
Here is an example from the SDI-12 specifications:
http://www.sdi-12.org/current_specification/SDI-12_version-1_4-Jan-30-2021.pdf
sdi-12_question_1.jpg

Am I on the right track with using a circuit like this? This uses a p-channel mosfet, and an n-channel mosfet.
sdi-12_question_2.jpg

I'm guessing it might be better to use 2x mosfets on the top portion so my logic doesn't get inverted? What about for the lower portion?

Thanks and any help or advice is greatly appreciated!
 

Ian Rogers

Joined Dec 12, 2012
1,136
I have just been through this... I was running SPI from 3v to 5v to a max7291.. BUT!! the mosfet style logic level convertor was not fast enough and the 5v was never being reached... So (as Yaakov just said) I bought a couple of 74hc244's... Perfik!!!

Edit*** The mosfet convertors were running common gate..
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Maybe consider this: sn74lv1t04.pdf Available to ship at Mouser: 9745933
I have just been through this... I was running SPI from 3v to 5v to a max7291.. BUT!! the mosfet style logic level convertor was not fast enough and the 5v was never being reached... So (as Yaakov just said) I bought a couple of 74hc244's... Perfik!!!

Edit*** The mosfet convertors were running common gate..
How would I use these components in this situation? I basically have one GPIO that I am using to both receive and transmit SDI data.
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
Would a circuit like this be more preferable? This is more of a standard 3.3V to 5.0V level shifting circuit, I just didn't know how well it would play with the 500 ohm, 200K pulldown, etc.? p.s. that is a N-channel mosfet:
sdi-12_question_3.jpg

It seems like that 10K pullup resistor to 5.0V kind of messes this up... because when the GPIO is set to input to read, and the SDI-12 needs to drive the data now, ideally that 10K would not be there for this part.
 

Thread Starter

Mahonroy

Joined Oct 21, 2014
406
So I came across this in the SDI-12 specifications for an example circuit:
sdi-12_question_5.jpg
I updated my level shifter like this. Will that 10K resistor matter? I also removed the last 510 resistor because it was causing issues with the mosfet:
sdi-12_question_4.jpg
 

TryingHere

Joined Jan 4, 2023
19
So I came across this in the SDI-12 specifications for an example circuit:
View attachment 251392
I updated my level shifter like this. Will that 10K resistor matter? I also removed the last 510 resistor because it was causing issues with the mosfet:
View attachment 251391
Did any of this work? I’m trying to do the same thing having a issues figuring out how to handle 3.6 coming back from teros 12
 

Ian Rogers

Joined Dec 12, 2012
1,136
Whoooooaaa!!! Like everyone else I read SPI.... SDI is 1 wire.... I am sooo sorry MrAl ( I did wonder why you asked that question..)

Shutting up now...
 

Papabravo

Joined Feb 24, 2006
21,304
Whoooooaaa!!! Like everyone else I read SPI.... SDI is 1 wire.... I am sooo sorry MrAl ( I did wonder why you asked that question..)

Shutting up now...
Don't feel too bad, I made the same mistake in the other SDI thread where the title actually said "SPI - 12" until one of the mods corrected it. the diagram from the spec clearly shows how to use a tristate buffer and a receiver (could be a tristate buffer with the output always enabled) to make a bidirectional data line.
 

Ian Rogers

Joined Dec 12, 2012
1,136
Don't feel too bad, I made the same mistake in the other SDI thread where the title actually said "SPI - 12" until one of the mods corrected it. the diagram from the spec clearly shows how to use a tristate buffer and a receiver (could be a tristate buffer with the output always enabled) to make a bidirectional data line.
It doesn't help that the SPI system names the pin SDI ... That is my excuse LOL..
 

MrAl

Joined Jun 17, 2014
11,693
Whoooooaaa!!! Like everyone else I read SPI.... SDI is 1 wire.... I am sooo sorry MrAl ( I did wonder why you asked that question..)

Shutting up now...
Hi,

Hey no problem my friend and it's always nice to talk about this stuff anyway as it brings other ideas out too so thanks just the same ;)
 

MrAl

Joined Jun 17, 2014
11,693
This application note provides a simple bi-directional level shifter based on an N-Channel MOSFET.
Hi,

Oh you just reminded me of some boards i purchased long time back now when i was more heavily into microcontrollers (still love them though).

The board are sold just for the purpose of converting voltage levels usually 3.3v to 5v or vice versa. They have the mosfets right on them and some resistors.
The only problem i saw with any of these solutions is you have to have a reliable clamp voltage so that the circuit has a way to limit the 3.3v signals.
I'll see what i can dig up. The nice thing is everything is on that one tiny board, and often has several channels worth so you can do several pins with just one board. They are cheap too. I should have some notes around if no one else looks them up first.

As to the clamp voltage (usually 3.3v or something) you have to make sure that any and all currents that can possibly come through the clamp can never raise the voltage of the lower voltage (like 3.3v) or it can overpower the chip running under 3.3v power. If the clamp voltage current is too high it will raise the Vcc level of the 3.3v circuit and thus could blow out any chips being used on 3.3v, including the microprocessor/controller (such as the more expensive type like the ARM).

Here is just one such board:
BOB-12009 SparkFun | Mouser

They are available on Amazon also. There may be single channel, dual channel, etc., boards.
In the drawing you can see there are several channels with mosfets and resistors.

LevelShifter_20230109_051756.png
 

Attachments

Last edited:
Top