Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-19 Thread Colin Law
On 19 September 2016 at 13:23, Jan Kandziora  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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-05 Thread 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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-05 Thread Colin Law
On 4 September 2016 at 19:59, Jan Kandziora  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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-04 Thread 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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-04 Thread Colin Law
On 3 September 2016 at 13:04, Jan Kandziora  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
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers

--
___
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-03 Thread Colin Law
On 3 September 2016 at 14:00, Colin Law  wrote:
> On 3 September 2016 at 13:45, Jan Kandziora  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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-03 Thread 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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-03 Thread Colin Law
On 3 September 2016 at 13:04, Jan Kandziora  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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


Re: [Owfs-developers] Owserver on pi (zero) using DS18B20 and pullup resistor

2016-09-03 Thread 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
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers