One wire setup on BeagleBone Black

Here is the DTS file that I used to compile to setup One-Wire connection on Beaglebone Black.
I have used P9.22 for one wire connection and in parasitic mode.

/dts-v1/;
/plugin/;
/ {
    compatible = "ti,beaglebone", "ti,beaglebone-black";
    part-number = "BB-W1";
    version = "00A0";
    /* state the resources this cape uses */
    exclusive-use =
    /* the pin header uses */
    "P9.22",
    /* the hardware IP uses */
    "gpio0_2";
    fragment@0 {
      target = <&am33xx_pinmux>;
      __overlay__ {
        dallas_w1_pins: pinmux_dallas_w1_pins {
          pinctrl-single,pins = < 0x150 0x37 >;
        };
      };
    };
    fragment@1 {
    target = <&ocp>;
    __overlay__ {
        onewire@0 {
          compatible      = "w1-gpio";
          pinctrl-names   = "default";
          pinctrl-0       = <&dallas_w1_pins>;
          status          = "okay";
          gpios = <&gpio1 2 0>;
          };
        };
    };
};

Here DS18B20 or DS18S20 sensors are connected in parasitic mode, consuming only 2 wires for connection. VDD pin must be connected to GND pin of each sensors. 47 Ohms resistors are added to GND and 1wire terminal on BBB to limit current in case lines are short circuited. BBB specify that pins are at 3.3V logic and not 5V tolerant, so for more safer side you may connect to 3.3V VDD and reduce the value of R1 (say around 1.5k)

ds18b20BBB.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s