3.3V Dallas one-wire bus on a 5V system

I have some Dallas/Maxim one-wire parts (DS1825) that I bought a while ago. Now reading the data sheet, I see that these are for a 3.3V bus, not a 5V bus as I have. I'm willing to set up another bus, if I have to, but the Arduino side of things is 5V and I'm not going to change that.

Has anyone got any suggestions how to level convert or adapt to drive a 3.3V Dallas one-wire bus from a 5V system?

What I think I will do is:
(1) power the parts using the 3.3V arduino power rail
(2) I think I can use two pins and do 3.3V bus sends using a voltage divider.
(3) connect the bus directly to the input pin on the arduino, and hope that 3.3V is good enough to register the proper logic level

Any obvious problems with this approach?

The 5V input should read 3.3V ok.

The Absolute Maximum Rating of the DS1825 is 6V, so won't damage the part by connecting it to a 5V source, but it might not operate correctly or (more likely) will draw more current.

A simple resistor divider is probably sufficient. You may not be able to run the data line at maximum speed, but it should work.

If you want to get more fancy. You can use a buffer gate with open collector outputs and pull up to 3.3V in one direction and 5V in the other direction or get a level shifter, also known as a translator. These can typically operate up to many megahertz.

Good luck,
Steve T

You could use something like this. The MOSFET is not critical and any small signal N-channel MOSFET capable of a few ma with a maximum GS threshold of 2V or less should do.

BillO:
33to5_translator.jpg

Interesting. Is this bi-directional? The 1-wire bus has to be bi-directional.

I have the parts for the voltage-divider out and seat-of-pants input on separate pins approach, so I'll give that a go and see what happens. Worst case I can use a 3904 to level shift the incoming 3.3V signal.

Yes, this is bi-directional, although I used the wrong symbol for the MOSFET. It should have a diode in it with the cathode at the source and the anode at the drain. That diode forward biases when the 5V side goes low, pulling the 3.3V down. The GS threshold then kicks in and the whole MOSFET turns on. Even if you use a MOSFET without the internal diode, you can use a 1N60P or other Schottky diode. This circuit will work up to very high frequencies and puts no undue load on any component.

Since the DS1825 will only sink about 4 or so ma, I'm not sure the resistor voltage divider will work, but give it a try anyway. It is the least expensive method.

BillO:
Since the DS1825 will only sink about 4 or so ma, I'm not sure the resistor voltage divider will work.

Yeah. I was doodling maybe just using a diode on my output pin. The 4K7 1-wire bus pull-up gives me a 3.3V high signal, and when I want to assert a low I can do so through a small signal diode. When it's time for the DS1825 to talk, I put the output pin in hi-Z and listen on the other pin. I think as long as the DS1825 is powered through its power pin, the source current I assert on the bus does not matter and the 4K7 bus pull up should be fine.

I really like the mosfet idea, but the only ones I have on-hand are large power mosfets.

If you don't need to provide a strong pull-up on the data line there's no need for level conversion - just pull up the data line to 3V3 - the Arduino inputs can safely read 3V3 signals. The OneWire library is open-drain (unless you explicitly specify strong-pull-up (the power argument to the write() function).

If the library actually sets the I/O to open drain, then MARKT is on the button. No translation required. The ATmega inputs are fine with 3.3V as 'high'.

BillO:
You could use something like this. The MOSFET is not critical and any small signal N-channel MOSFET capable of a few ma with a maximum GS threshold of 2V or less should do.

How do you think the 10K R of the level translator will affect the Rpup of the 1-wire bus.
Shall we put no extra Rpup and use the one of the translator in its place.
Or shall we put in each logic side, and Rpup in parallel with the translator 10k R

Use standard bidirectional a level shifter like this:

R1 and R2 ARE the pull-up resistors. The MOSFET a small signal one like the BSS138.

The boards as sold by Adafruit, Sparkfiun and the rest of the usual suspects use 10k resistors. Add a 10k in parallel and you're within spec for the one wire bus.

BillO:
... Even if you use a MOSFET without the internal diode...

I thought the diode is a "feature" of MOSFETs - it is integral (often unwanted) part of the MOSFET and you cannot make one without it. AFAIK when you need a MOSFET that is able to block current in both directions you need to use two MOSFETs.

wvmarle:
The MOSFET a small signal one like the BSS138.

It is difficult to get a THT MOSFET with low enough threshold voltage for this to work. However any NPN transistor can be used instead (with additional Base resistor ofc).

Smajdalf:
I thought the diode is a "feature" of MOSFETs - it is integral (often unwanted) part of the MOSFET and you cannot make one without it. AFAIK when you need a MOSFET that is able to block current in both directions you need to use two MOSFETs.

Indeed.

It is difficult to get a THT MOSFET with low enough threshold voltage for this to work.

IRLZ44N has a threshold of max 2.0V so may work. You don't need very low on resistance. It's a bit expensive a part for this job, though. Better get a ready-made level shifter board instead.

However any NPN transistor can be used instead (with additional Base resistor ofc).

Then you do have to add the diode :slight_smile: