I'm trying to connect a DS18B20 to my Beaglebone Black. Now I wan't to determine the Baudrate but can't find it in the Datasheet of the DS18B20.

In the internet I saw different ones (9600, 19200). Can I simply choose one the Sensor pick's up on it? If so up to what maximal rate?

Sorry for this RTFM question, but I really can't find the answer for that.

  • \$\begingroup\$ Are you trying to interface it to a UART? The 1-wire protocol is significantly different and while I believe you can fudge it with a UART it's not the usual way you'd interface to one. \$\endgroup\$ – PeterJ Dec 30 '13 at 11:08
  • \$\begingroup\$ @PeterJ. I'm pretty new to this whole stuff. I use the serialib library. Is there a better/easier way to access it using c/c++? I didn't find any library at maxim integrated. Any help would be greatly apretiated \$\endgroup\$ – magu_ Dec 30 '13 at 11:22
  • 1
    \$\begingroup\$ I've never used 1-wire from a Linux based system, but maybe take a look at owfs.org. But hopefully someone has a better idea how to get it running, just using serial ports is a fairly roundabout way that might not be reliable. \$\endgroup\$ – PeterJ Dec 30 '13 at 11:28

You don't normally connect 1-wire devices to UARTs. So you don't need to set a baud-rate.

See Beaglebone Black 1-wire or ditto with Arch Linux

As an aside, 1-wire support is standard in the Raspian OS used on the Raspberry pi, it seems somewhat easier to use.

  • \$\begingroup\$ Thank you for your answer. I'm right now trying to make it run but have some problems to load the overlay. It say's that I can't find the file (I did use capemgr.9 since .8 is not there(I'm using Ubuntu on it)) \$\endgroup\$ – magu_ Dec 30 '13 at 13:05
  • \$\begingroup\$ Now I finally made it run. Starting on this route would have saved me some headache... Thanks again. \$\endgroup\$ – magu_ Dec 30 '13 at 19:08

The timing of the DS18B20 is a lot more complex than a UART. With UART you specify a bitrate of for instance 9600 bits per second and you know each bit will be 104 us. That's the only number you need.

On pages 15 ff. of the datasheet the timing of the DS18B20 is explained. For instance

During the initialization sequence the bus master transmits (TX) the reset pulse by pulling the 1-Wire bus low for a minimum of 480μs. The bus master then releases the bus and goes into receive mode (RX). When the bus is released, the 5kΩ pullup resistor pulls the 1-Wire bus high. When the DS18B20 detects this rising edge, it waits 15μs to 60μs and then transmits a presence pulse by pulling the 1-Wire bus low for 60μs to 240μs.

You get similar prose for read and write times.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.