Owserver on pi (zero) using DS18B20 and pullup resistor

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
I want to use owserver on a raspberry pi (zero) running Raspbian
(Jessie) using the method of direct connection to GPIO pins with a
pullup resistor.  Unfortunately I have found a fair amount of
conflicting and confusing information on this around the web.  Is
there an up to date and authoritative write up somewhere on how to do
this?

Colin

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Jan Kandziora
Am 03.09.2016 um 10:36 schrieb Colin Law:
> I want to use owserver on a raspberry pi (zero) running Raspbian
> (Jessie) using the method of direct connection to GPIO pins with a
> pullup resistor.  Unfortunately I have found a fair amount of
> conflicting and confusing information on this around the web.  Is
> there an up to date and authoritative write up somewhere on how to do
> this?
>
1. You have to recall the Raspberry Pi's GPIOs are 3.3V. You'll have a
non-standard 3.3V Onewire then. That's okay for the DS18B20, but for
other Onewire chips, you have to check the datasheets. Same, if you
use an external pullup, it has to go to 3.3V, not 5V.

Of course, you can always use this simple level shifting circuit, should
you need a 5V Onewire:

|
|        +5V ----.           ,-----+---- +3.3V
|                |           |     |
|                \         G |     \
|                /      –––––'     /
|                \    ––– – –––    \
|                |     |  ^  |     |
| 5V bus line ---+-----'  '--+-----+---- 3.3V bus line
|                      D     S
|

The transistor is a small signal N-channel enhancement mode MOSFET, e.g. a
2N7000, BS170 or MMBF170. The value of the two pullup resistors depend on
the pullup current you need, 1.5kΩ is okay for most cases.


2. You have to put

dtoverlay=w1-gpio,gpiopin=4

or

dtoverlay=w1-gpio-pullup,gpiopin=4,pullup=5

into your Raspberry Pi boot partition config.txt. And of course, the
w1-gpio resp. w1-gpio-pullup dtb files have to be present in the boot
partition overlays directory. Then reboot.


3. You have to use --w1 for this. The w1 kernel driver is the only way
to use the bitbanging host adapter.


4. You have to update your owfs to 3.1p1 or later, because Debian Jessie
uses kernel 3.16.x, and there was a long-unseen incompatiblity between
post-3.16rc kernels and pre-3.1p1 owfs.

You can use the owfs packages from the Raspbian testing repository. Edit
(or create) your /etc/apt/preferences to contain:
--------------------------------------------------------------------------
Package: *
Pin: release o=Raspbian,a=stable
Pin-Priority: 500

Package: *
Pin: release o=Raspbian,a=testing
Pin-Priority: 300
--------------------------------------------------------------------------
This is important so you keep stable (Jessie) for all packages but the ones
explicitly taken from testing (Stretch).


Then, add a line
--------------------------------------------------------------------------
deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi
--------------------------------------------------------------------------
to your /etc/apt/sources.list to get access to the Raspbian testing
repository.

Do an

$ sudo apt-get update

to read the package metadata, then check

$ sudo apt-cache policy

whether the testing repo is there with priority 300. Then

$ sudo apt-get update -t testing owserver ow-shell

That should install all you need, including the startup files and systemd units.
Note you have to edit /etc/owfs.conf again to contain (this and only this)
--------------------------------------------------------------------------
!server: server = localhost:4304
server: w1
--------------------------------------------------------------------------
Restart the owserver service after that.


Done.


Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
On 3 September 2016 at 13:04, Jan Kandziora <[hidden email]> wrote:

> Am 03.09.2016 um 10:36 schrieb Colin Law:
>> I want to use owserver on a raspberry pi (zero) running Raspbian
>> (Jessie) using the method of direct connection to GPIO pins with a
>> pullup resistor.  Unfortunately I have found a fair amount of
>> conflicting and confusing information on this around the web.  Is
>> there an up to date and authoritative write up somewhere on how to do
>> this?
>>
> 1. You have to recall the Raspberry Pi's GPIOs are 3.3V. You'll have a
> non-standard 3.3V Onewire then. That's okay for the DS18B20, but for
> other Onewire chips, you have to check the datasheets. Same, if you
> use an external pullup, it has to go to 3.3V, not 5V.
>
> Of course, you can always use this simple level shifting circuit, should
> you need a 5V Onewire:
>
> |
> |        +5V ----.           ,-----+---- +3.3V
> |                |           |     |
> |                \         G |     \
> |                /      –––––'     /
> |                \    ––– – –––    \
> |                |     |  ^  |     |
> | 5V bus line ---+-----'  '--+-----+---- 3.3V bus line
> |                      D     S
> |
>
> The transistor is a small signal N-channel enhancement mode MOSFET, e.g. a
> 2N7000, BS170 or MMBF170. The value of the two pullup resistors depend on
> the pullup current you need, 1.5kΩ is okay for most cases.
>
>
> 2. You have to put
>
> dtoverlay=w1-gpio,gpiopin=4
>
> or
>
> dtoverlay=w1-gpio-pullup,gpiopin=4,pullup=5
>
> into your Raspberry Pi boot partition config.txt. And of course, the
> w1-gpio resp. w1-gpio-pullup dtb files have to be present in the boot
> partition overlays directory. Then reboot.
>
>
> 3. You have to use --w1 for this. The w1 kernel driver is the only way
> to use the bitbanging host adapter.
>
>
> 4. You have to update your owfs to 3.1p1 or later, because Debian Jessie
> uses kernel 3.16.x, and there was a long-unseen incompatiblity between
> post-3.16rc kernels and pre-3.1p1 owfs.
>
> You can use the owfs packages from the Raspbian testing repository. Edit
> (or create) your /etc/apt/preferences to contain:
> --------------------------------------------------------------------------
> Package: *
> Pin: release o=Raspbian,a=stable
> Pin-Priority: 500
>
> Package: *
> Pin: release o=Raspbian,a=testing
> Pin-Priority: 300
> --------------------------------------------------------------------------
> This is important so you keep stable (Jessie) for all packages but the ones
> explicitly taken from testing (Stretch).
>
>
> Then, add a line
> --------------------------------------------------------------------------
> deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi
> --------------------------------------------------------------------------
> to your /etc/apt/sources.list to get access to the Raspbian testing
> repository.
>
> Do an
>
> $ sudo apt-get update
>
> to read the package metadata, then check
>
> $ sudo apt-cache policy
>
> whether the testing repo is there with priority 300. Then
>
> $ sudo apt-get update -t testing owserver ow-shell
>
> That should install all you need, including the startup files and systemd units.
> Note you have to edit /etc/owfs.conf again to contain (this and only this)
> --------------------------------------------------------------------------
> !server: server = localhost:4304
> server: w1
> --------------------------------------------------------------------------
> Restart the owserver service after that.
>
>
> Done.

That's great Jan

Many thanks

Colin

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Jan Kandziora
Am 03.09.2016 um 14:28 schrieb Colin Law:
>
> Many thanks
>
I missed one thing: you have to load the w1-gpio kernel module!

Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
On 3 September 2016 at 13:45, Jan Kandziora <[hidden email]> wrote:
> Am 03.09.2016 um 14:28 schrieb Colin Law:
>>
>> Many thanks
>>
> I missed one thing: you have to load the w1-gpio kernel module!

Which I do, I think, by running (only once)

sudo modprobe w1-gpio

Colin

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
On 3 September 2016 at 14:00, Colin Law <[hidden email]> wrote:

> On 3 September 2016 at 13:45, Jan Kandziora <[hidden email]> wrote:
>> Am 03.09.2016 um 14:28 schrieb Colin Law:
>>>
>>> Many thanks
>>>
>> I missed one thing: you have to load the w1-gpio kernel module!
>
> Which I do, I think, by running (only once)
>
> sudo modprobe w1-gpio

And it all works first time.  Great.

Thanks again Jan

Colin

>
> Colin

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
In reply to this post by Jan Kandziora
On 3 September 2016 at 13:04, Jan Kandziora <[hidden email]> wrote:

> Am 03.09.2016 um 10:36 schrieb Colin Law:
> ...
> 2. You have to put
>
> dtoverlay=w1-gpio,gpiopin=4
>
> or
>
> dtoverlay=w1-gpio-pullup,gpiopin=4,pullup=5
>
> into your Raspberry Pi boot partition config.txt. And of course, the
> w1-gpio resp. w1-gpio-pullup dtb files have to be present in the boot
> partition overlays directory. Then reboot.

Could I ask for further clarification on this please?  I have used
dtoverlay=w1-gpio,gpiopin=4
and installed the kernel module using
sudo modprobe w1-gpio
and the DS18B20 works fine in three wire mode with a 4.7k pullup on DQ

Google tells me (Ithink) that if I use
dtoverlay=w1-gpio-pullup,gpiopin=4,pullup=5
then I can use parasitic mode with an external strong pullup driven by
gpio05 in the way described in [1]
However other results appear to suggest that I can use parasitic mode
without the strong pullup, and I have also seen suggestions that to
install the module I could use
modprobe w1-gpio pullup=1
and I have been unable to determine exactly how the various options
relate to each other.

Further clarification would be much appreciated.

Regards

Colin

[1] https://hatfors.wordpress.com/2015/09/12/measuring-temperature-with-a-parasite-power-1-wire-sensor-raspberry-pi-and-integrating-into-ose-using-haskell/

>
>
> 3. You have to use --w1 for this. The w1 kernel driver is the only way
> to use the bitbanging host adapter.
>
>
> 4. You have to update your owfs to 3.1p1 or later, because Debian Jessie
> uses kernel 3.16.x, and there was a long-unseen incompatiblity between
> post-3.16rc kernels and pre-3.1p1 owfs.
>
> You can use the owfs packages from the Raspbian testing repository. Edit
> (or create) your /etc/apt/preferences to contain:
> --------------------------------------------------------------------------
> Package: *
> Pin: release o=Raspbian,a=stable
> Pin-Priority: 500
>
> Package: *
> Pin: release o=Raspbian,a=testing
> Pin-Priority: 300
> --------------------------------------------------------------------------
> This is important so you keep stable (Jessie) for all packages but the ones
> explicitly taken from testing (Stretch).
>
>
> Then, add a line
> --------------------------------------------------------------------------
> deb http://mirrordirector.raspbian.org/raspbian/ testing main contrib non-free rpi
> --------------------------------------------------------------------------
> to your /etc/apt/sources.list to get access to the Raspbian testing
> repository.
>
> Do an
>
> $ sudo apt-get update
>
> to read the package metadata, then check
>
> $ sudo apt-cache policy
>
> whether the testing repo is there with priority 300. Then
>
> $ sudo apt-get update -t testing owserver ow-shell
>
> That should install all you need, including the startup files and systemd units.
> Note you have to edit /etc/owfs.conf again to contain (this and only this)
> --------------------------------------------------------------------------
> !server: server = localhost:4304
> server: w1
> --------------------------------------------------------------------------
> Restart the owserver service after that.
>
>
> Done.
>
>
> Kind regards
>
>         Jan
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Jan Kandziora
Am 04.09.2016 um 17:21 schrieb Colin Law:
>
> Could I ask for further clarification on this please?  I have used
> dtoverlay=w1-gpio,gpiopin=4
> and installed the kernel module using
> sudo modprobe w1-gpio
> and the DS18B20 works fine in three wire mode with a 4.7k pullup on DQ
>
1.5k please. PLEEEEAAAAAASE! (and to 3.3V, not 5V)

Why? Because when you use parasitic power on the DS18B20, a 4.7k pullup
to 3.3V will only deliver 3.3V/4.7k = 0.7mA to the chip. That's not
enough during conversion. You will get power-on-resets (aka 85°C readings).


> Google tells me (Ithink) that if I use
> dtoverlay=w1-gpio-pullup,gpiopin=4,pullup=5
> then I can use parasitic mode with an external strong pullup driven by
> gpio05 in the way described in [1]
>
Yes. You can use that strong pullup. But usually that's not needed, you
can feed up to 4mA to the Onewire by the normal "weak" pullup. That's
what the chips can sink.

There are two drawbacks when you use such a strong "weak" pullup. First,
the power consumption. I think that's negliable. Second, heating up the
sensor from inside by its bus output transistor. That's negliable as
long as you don't measure low temperatures.

In that case, use the host-controlled strong pullup. Or better, power
your sensor.


> However other results appear to suggest that I can use parasitic mode
> without the strong pullup, and I have also seen suggestions that to
> install the module I could use
> modprobe w1-gpio pullup=1
>
You have to do that in addition to the dtb configuration. The dtb only
connects symbolic hardware names like "w1-gpio-pullup,gpiopin" and
"w1-gpio-pullup,pullup" to existing pin numbers.

The driver use the symbolic name and the device tree core gives it back
the real pin number, as configured by the admin.


Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
On 4 September 2016 at 17:39, Jan Kandziora <[hidden email]> wrote:

> Am 04.09.2016 um 17:21 schrieb Colin Law:
>>
>> Could I ask for further clarification on this please?  I have used
>> dtoverlay=w1-gpio,gpiopin=4
>> and installed the kernel module using
>> sudo modprobe w1-gpio
>> and the DS18B20 works fine in three wire mode with a 4.7k pullup on DQ
>>
> 1.5k please. PLEEEEAAAAAASE! (and to 3.3V, not 5V)
>
> Why? Because when you use parasitic power on the DS18B20, a 4.7k pullup
> to 3.3V will only deliver 3.3V/4.7k = 0.7mA to the chip. That's not
> enough during conversion. You will get power-on-resets (aka 85°C readings).

I have it to 3.3V ok. So 4.7k is ok for 3 wire mode but for parasitic
it should be 1.5k

>
>
>> Google tells me (Ithink) that if I use
>> dtoverlay=w1-gpio-pullup,gpiopin=4,pullup=5
>> then I can use parasitic mode with an external strong pullup driven by
>> gpio05 in the way described in [1]
>>
> Yes. You can use that strong pullup. But usually that's not needed, you
> can feed up to 4mA to the Onewire by the normal "weak" pullup. That's
> what the chips can sink.
>
> There are two drawbacks when you use such a strong "weak" pullup. First,
> the power consumption. I think that's negliable. Second, heating up the
> sensor from inside by its bus output transistor. That's negliable as
> long as you don't measure low temperatures.
>
> In that case, use the host-controlled strong pullup. Or better, power
> your sensor.
>
>
>> However other results appear to suggest that I can use parasitic mode
>> without the strong pullup, and I have also seen suggestions that to
>> install the module I could use
>> modprobe w1-gpio pullup=1
>>
> You have to do that in addition to the dtb configuration. The dtb only
> connects symbolic hardware names like "w1-gpio-pullup,gpiopin" and
> "w1-gpio-pullup,pullup" to existing pin numbers.
>
> The driver use the symbolic name and the device tree core gives it back
> the real pin number, as configured by the admin.

To summarize then, for parasitic mode I should not need an external
strong pullup and should be able to use just a 1.5k pullup and to
specify
dtoverlay=w1-gpio,gpiopin=4
and
sudo modprobe w1-gpio pullup=1

With in addition the 3.3 to 5V level shifter as in your first post if
any devices on the bus need 5V

I am interested in your comment
> There are two drawbacks when you use such a strong "weak" pullup. First,
> the power consumption. I think that's negligible. Second, heating up the
> sensor from inside by its bus output transistor. That's negligible as
> long as you don't measure low temperatures.

My rudimentary knowledge of thermodynamics tells me that if one
provides a certain amount of power from inside as you suggest and that
heats the device by (for example) 0.1 degrees when the device is in
ambient 0C, then if the device were in ambient 50C then the heating
would still be the same (0.1 degrees).  Is that wrong?

Thanks again for the help

Colin

>
>
> Kind regards
>
>         Jan
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Owfs-developers mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/owfs-developers

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Jan Kandziora
Am 04.09.2016 um 19:08 schrieb Colin Law:
>
> I have it to 3.3V ok. So 4.7k is ok for 3 wire mode but for parasitic
> it should be 1.5k
>
Yes.

>
> To summarize then, for parasitic mode I should not need an external
> strong pullup and should be able to use just a 1.5k pullup and to
> specify
> dtoverlay=w1-gpio,gpiopin=4
> and
> sudo modprobe w1-gpio pullup=1
>
> With in addition the 3.3 to 5V level shifter as in your first post if
> any devices on the bus need 5V
>
Yes.


>> There are two drawbacks when you use such a strong "weak" pullup. First,
>> the power consumption. I think that's negligible. Second, heating up the
>> sensor from inside by its bus output transistor. That's negligible as
>> long as you don't measure low temperatures.
>
> My rudimentary knowledge of thermodynamics tells me that if one
> provides a certain amount of power from inside as you suggest and that
> heats the device by (for example) 0.1 degrees when the device is in
> ambient 0C, then if the device were in ambient 50C then the heating
> would still be the same (0.1 degrees).  Is that wrong?
>
It's a constant heat amount. Not a constant temperature amount.
Temperature inside the sensor is a derivative value.

That said, when someone mentions the absolute temperature of something,
you can immediately say it's about radiation. Heat radiation works much
better at higher temperature. It goes with T^4.

So, at lower temperature, changes of the sensor temperature in reaction
to ambient temperature will be much slower, and internally generated
heat can make a difference when sampling the temperatures often.

For your application, you always have to check if radiation is dominant.
If your answer is yes, be aware absolute temperature matters.


Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
On 4 September 2016 at 19:59, Jan Kandziora <[hidden email]> wrote:

> Am 04.09.2016 um 19:08 schrieb Colin Law:
>>
>> I have it to 3.3V ok. So 4.7k is ok for 3 wire mode but for parasitic
>> it should be 1.5k
>>
> Yes.
>
>>
>> To summarize then, for parasitic mode I should not need an external
>> strong pullup and should be able to use just a 1.5k pullup and to
>> specify
>> dtoverlay=w1-gpio,gpiopin=4
>> and
>> sudo modprobe w1-gpio pullup=1
>>
>> With in addition the 3.3 to 5V level shifter as in your first post if
>> any devices on the bus need 5V
>>
> Yes.

Excellent, thanks. I will write this all up somewhere ones I have got
it all fully working.

>
>
>>> There are two drawbacks when you use such a strong "weak" pullup. First,
>>> the power consumption. I think that's negligible. Second, heating up the
>>> sensor from inside by its bus output transistor. That's negligible as
>>> long as you don't measure low temperatures.
>>
>> My rudimentary knowledge of thermodynamics tells me that if one
>> provides a certain amount of power from inside as you suggest and that
>> heats the device by (for example) 0.1 degrees when the device is in
>> ambient 0C, then if the device were in ambient 50C then the heating
>> would still be the same (0.1 degrees).  Is that wrong?
>>
> It's a constant heat amount. Not a constant temperature amount.
> Temperature inside the sensor is a derivative value.
>
> That said, when someone mentions the absolute temperature of something,
> you can immediately say it's about radiation. Heat radiation works much
> better at higher temperature. It goes with T^4.
>
> So, at lower temperature, changes of the sensor temperature in reaction
> to ambient temperature will be much slower, and internally generated
> heat can make a difference when sampling the temperatures often.
>
> For your application, you always have to check if radiation is dominant.
> If your answer is yes, be aware absolute temperature matters.

It is purely academic in my case as I will only be reading once a
minute or so,  and what you say is correct if radiation is dominant.
Whether radiation is, in fact, dominant in the typical case I don't
know. If conduction, either through the case or along the leads were
dominant then I think my original suggestion holds and the temperature
rise will be largely independent of absolute temperature.

When estimating device temperature for devices mounted on a PCB the
convention is to use a linear model (see [1] for example). This
applies to devices such as transistors mounted above the PCB on leads
as well as to surface mount devices.  Quite how one would estimate the
conduction/radiation relationship for a sensor on the end of a wire I
have no idea.

[1] http://www.rohm.com/web/eu/tr_what7

Cheers

Colin

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Jan Kandziora
Am 05.09.2016 um 09:00 schrieb Colin Law:
>
> When estimating device temperature for devices mounted on a PCB the
> convention is to use a linear model (see [1] for example). This
> applies to devices such as transistors mounted above the PCB on leads
> as well as to surface mount devices.  Quite how one would estimate the
> conduction/radiation relationship for a sensor on the end of a wire I
> have no idea.
>
>From what I still have in mind of my lectures on the topic, people tend
to underestimate the effects of radiation at high temperatures and then
wonder why their setup won't work well at low temperatures.

Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
In reply to this post by Jan Kandziora
On 4 September 2016 at 19:59, Jan Kandziora <[hidden email]> wrote:

> Am 04.09.2016 um 19:08 schrieb Colin Law:
>> ...
>> To summarize then, for parasitic mode I should not need an external
>> strong pullup and should be able to use just a 1.5k pullup and to
>> specify
>> dtoverlay=w1-gpio,gpiopin=4
>> and
>> sudo modprobe w1-gpio pullup=1
>>
>> With in addition the 3.3 to 5V level shifter as in your first post if
>> any devices on the bus need 5V
>>
> Yes.

Sorry, I need yet further clarification on this.  I have been trying
to get to grips with device tree and (on pi with raspbian jessie) in
/boot/overlays/README it says

"Device Tree makes it possible
to support many hardware configurations with a single kernel and without the
need to explicitly load or blacklist kernel modules."

which I think means that it should not be necessary to use modprobe
w1-gpio or to put the module in /etc/modules.
Also for w1-gpio it has

"Name:   w1-gpio
Info:   Configures the w1-gpio Onewire interface module.
        Use this overlay if you *don't* need a GPIO to drive an external pullup.
Load:   dtoverlay=w1-gpio,<param>=<val>
Params: gpiopin                 GPIO for I/O (default "4")
        pullup                  Non-zero, "on", or "y" to enable the parasitic
                                power (2-wire, power-on-data) feature

Does this mean I can (should?) use
dtoverlay=w1-gpio,gpiopin=4,pullup=y

and remove the modprobe command?

Colin

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Jan Kandziora
Am 19.09.2016 um 10:42 schrieb Colin Law:

> On 4 September 2016 at 19:59, Jan Kandziora <[hidden email]> wrote:
>> Am 04.09.2016 um 19:08 schrieb Colin Law:
>>> ...
>>> To summarize then, for parasitic mode I should not need an external
>>> strong pullup and should be able to use just a 1.5k pullup and to
>>> specify
>>> dtoverlay=w1-gpio,gpiopin=4
>>> and
>>> sudo modprobe w1-gpio pullup=1
>>>
>>> With in addition the 3.3 to 5V level shifter as in your first post if
>>> any devices on the bus need 5V
>>>
>> Yes.
>
> Sorry, I need yet further clarification on this.  I have been trying
> to get to grips with device tree and (on pi with raspbian jessie) in
> /boot/overlays/README it says
>
> "Device Tree makes it possible
> to support many hardware configurations with a single kernel and without the
> need to explicitly load or blacklist kernel modules."
>
> which I think means that it should not be necessary to use modprobe
> w1-gpio or to put the module in /etc/modules.
>
This is a misunderstanding.

If you don't modprobe the module, someone else has to do. It depends on
your udev setup whether udev does it for you. The kernel doesn't load
modules automatically just because a device is listed in the loaded
device tree.

Before device trees, hardware layout has been hardcoded in the driver
modules or have to be specified by module options. That's what is no
longer necessary.



> Also for w1-gpio it has
>
> "Name:   w1-gpio
> Info:   Configures the w1-gpio Onewire interface module.
>         Use this overlay if you *don't* need a GPIO to drive an external pullup.
> Load:   dtoverlay=w1-gpio,<param>=<val>
> Params: gpiopin                 GPIO for I/O (default "4")
>         pullup                  Non-zero, "on", or "y" to enable the parasitic
>                                 power (2-wire, power-on-data) feature
>
> Does this mean I can (should?) use
> dtoverlay=w1-gpio,gpiopin=4,pullup=y
>
Haven't checked yet. Technically it is possible to use the internal push
transistor of the GPIO port to act as a strong pullup.

HOWEVER, you should use a series resistor outside the GPIO port then.
Because, overcurrent from shorting the Onewire too long may kill the
GPIO4 push transistor inside the BCM2835 SoC.


> and remove the modprobe command?
>
Check with lsmod whether the module gets loaded automatically by udev.

Kind regards

        Jan

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers
Reply | Threaded
Open this post in threaded view
|

Re: Owserver on pi (zero) using DS18B20 and pullup resistor

Colin Law
On 19 September 2016 at 13:23, Jan Kandziora <[hidden email]> wrote:

> Am 19.09.2016 um 10:42 schrieb Colin Law:
>> I have been trying
>> to get to grips with device tree and (on pi with raspbian jessie) in
>> /boot/overlays/README it says
>>
>> "Device Tree makes it possible
>> to support many hardware configurations with a single kernel and without the
>> need to explicitly load or blacklist kernel modules."
>>
>> which I think means that it should not be necessary to use modprobe
>> w1-gpio or to put the module in /etc/modules.
>>
> This is a misunderstanding.
>
> If you don't modprobe the module, someone else has to do. It depends on
> your udev setup whether udev does it for you. The kernel doesn't load
> modules automatically just because a device is listed in the loaded
> device tree.

Are you sure about that?
https://www.raspberrypi.org/documentation/configuration/device-tree.md
says, in section 3.1,
"With a Device Tree, the kernel will automatically search for and load
modules that support the indicated, enabled devices. As a result, by
creating an appropriate DT overlay for a device, you save users of the
device from having to edit /etc/modules; all of the configuration goes
in config.txt, and in the case of a HAT, even that step is
unnecessary. Note, however, that layered modules such as i2c-dev still
need to be loaded explicitly."

>
> Before device trees, hardware layout has been hardcoded in the driver
> modules or have to be specified by module options. That's what is no
> longer necessary.
>
>> ...
>> Does this mean I can (should?) use
>> dtoverlay=w1-gpio,gpiopin=4,pullup=y
>>
> Haven't checked yet. Technically it is possible to use the internal push
> transistor of the GPIO port to act as a strong pullup.
>
> HOWEVER, you should use a series resistor outside the GPIO port then.
> Because, overcurrent from shorting the Onewire too long may kill the
> GPIO4 push transistor inside the BCM2835 SoC.

I didn't realise there was a push transistor in the GPIO port. I
haven't been able to find any information on this. Do you have any
references/specs I can look up?  If the push does work then presumably
one can get away with a higher value of pullup on the data line.

>
>> and remove the modprobe command?
>>
> Check with lsmod whether the module gets loaded automatically by udev.

I can confirm that using raspbian Jessie w1-gpio is loaded without
using modprobe or putting it in /etc/modules

Cheers

Colin

------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/owfs-developers