
Here’s an app note from Maxim describing how to implement a 1-Wire bus master using the UART peripheral of your preferred microcontroller.
This application note explains how to use a microprocessor’s UART to implement a 1-Wire® bus master. It includes an explanation of the required electrical interface, UART configuration, and timing relationship between UART and 1-Wire signals. The flexibility offered in setting up UART byte timing allows straightforward implementation of 1-Wire time slots as well as the reset and presence detect pulses. With the inclusion of deep transmit and receive FIFOs, several byte values can be transferred on the 1-Wire bus with just a few clock cycles per bit required from the main processor.

With modern microcontroller architectures the proposed circuit may not me nescessary. E.b. The STM STM32 family can internally connect RX with TX, and TX can be switch to open-drain instead of push-pull, and so a one-wire device can be connected direct to TX. Only the pull-up resistor is need.
Good tip on not needing the circuit.
One advantage of this little circuit however, is that you could add a couple of resistors on the RX line (voltage divider) and then have a 3.3v micro run a 5v 1-wire device.
Well, e.g. STM32 GPIO is 5-Volt tolerant in input mode and that mean you _can_ pull up to 5 Volt without the need of additional drivers.
Wouldn’t only one resistor be required. e.g. 4.7k between RX and GND, as the pullup 4.7K would form the other half of the voltage divider?
Another option would be a zener between Vpullup and the 4.7K pullup to drop the voltage to 3.3V, 3V, or whatever is required.
Don’t loose time implementing one-wire at bit-bang level and use one of these:
for the embedded world:
DS2465 – I2C controlled 1-wire master – NDA only required for SHA routines
DS2482-100 – I2C controlled Single-Channel 1-Wire Master
DS2482-800 – I2C controlled 8-Channel (!!) 1-Wire Master
and also for the non-embedded world:
DS9490, DS9490B, DS9490R – USB to 1-Wire/iButton Adapter
DS9097U, DS9097U-009, DS9097U-E25, DS9097U-S09 Universal 1-Wire COM Port Adapter
DS2490 – USB to 1-Wire Bridge Chip
well ok, technically this app note is not about bitbanging, but bytebanging; however I think that an uart has far more useful usages than driving a one wire bus!
just my 2 cents!
Okay, so you say hand-wiring e.g. DS2465 to a discovery board would save you time then to use the uart? As always: it depends….
Well yes it depends :)
It depends on the size of your soldering iron :)
It depends on the availability and use of the uart for something else (debug? – not all chips have 2 uarts)
It also depends on the ability to create accurate microsecond delays and to implement the 1-wire bus :)
So yes, it depends indeed ;)
cheers!
I always thought 1wire was dead…