User avatar
DougieLawson
Posts: 40832
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: One wire w1-gpio and w1-gpio-custom

Sat Nov 29, 2014 8:33 am

Why do you need more than one pin? It's a 1-wire bus. So the wire runs from RPi to device1 from device1 to device2 and onwards (until you reach the limit of signalling from a single pin).
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
rpdom
Posts: 18157
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: One wire w1-gpio and w1-gpio-custom

Sat Nov 29, 2014 8:53 am

DougieLawson wrote:Why do you need more than one pin? It's a 1-wire bus. So the wire runs from RPi to device1 from device1 to device2 and onwards (until you reach the limit of signalling from a single pin).
I think there is a limit to the number of devices the driver supports. Something like 10?

Anyway, I'm using three different pins for my four (currently) sensors due to the location of the sensors.

User avatar
DougieLawson
Posts: 40832
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: One wire w1-gpio and w1-gpio-custom

Sat Nov 29, 2014 9:01 am

rpdom wrote:
DougieLawson wrote:Why do you need more than one pin? It's a 1-wire bus. So the wire runs from RPi to device1 from device1 to device2 and onwards (until you reach the limit of signalling from a single pin).
I think there is a limit to the number of devices the driver supports. Something like 10?

Anyway, I'm using three different pins for my four (currently) sensors due to the location of the sensors.
The kernel driver can only handle one pin, so I assume you're bit-banging the 1-wire protocol for your other pins.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

User avatar
JohnBeardmore
Posts: 211
Joined: Thu Nov 15, 2012 11:03 pm
Location: Derbyshire UK.
Contact: Website

Re: One wire w1-gpio and w1-gpio-custom

Sat Nov 29, 2014 8:06 pm

Where did you get you kernel source from ?

Cheers, J/.
Author of oBeMS open source Building energy Management System.
Automatic Meter Reading (AMR), Building Management System (BMS),
Building Energy Management System (BEMS), Infrastructure Control System (ICS).
See: http://t4sustainability.co.uk/oBeMS/

User avatar
DougieLawson
Posts: 40832
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: One wire w1-gpio and w1-gpio-custom

Sat Nov 29, 2014 8:47 pm

JohnBeardmore wrote:Where did you get you kernel source from ?
http://github.com/raspberrypi/linux
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

impluse
Posts: 4
Joined: Thu Nov 27, 2014 4:42 pm

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 01, 2014 9:12 am

rpdom wrote:
DougieLawson wrote:Why do you need more than one pin? It's a 1-wire bus. So the wire runs from RPi to device1 from device1 to device2 and onwards (until you reach the limit of signalling from a single pin).
I think there is a limit to the number of devices the driver supports. Something like 10?

Anyway, I'm using three different pins for my four (currently) sensors due to the location of the sensors.
hi...
you using more than one pin on single pi or using different pin ?

Can you Explain how to use more than one pin on single pi for 1-wire master
I want to use about 20 DS18B20 Sensor :shock: , I think if i use more than one pin for 1-wire it's possible to increase the number of sensor on each pin

User avatar
rpdom
Posts: 18157
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 01, 2014 9:49 am

impluse wrote:hi...
you using more than one pin on single pi or using different pin ?
Sorry, no. I'm cheating by using three different Pis.

I have considered seeing if I can change the driver to handle more than one pin, but I have too much to do already :(

Thuleman
Posts: 8
Joined: Sat Apr 26, 2014 3:52 pm
Location: Massachusetts, USA

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 15, 2014 5:56 pm

Over the last several weeks I have patched (by editing because patch utility failed) bcm2708.c with the code from fishfinger to add support for three more GPIO pins to support multiple DS18b20 temperature sensors. I ended up cross compiling with crosstool-ng using a 3.6.11 kernel source, which may be part of my mistake. My pi boots OK with the new kernel and modules, but I still only see one w1_bus_master1, where I should see master1,2,3,& 4. This is my first cross compile so I will go back and do it again with the latest debian kernel 3.12 source from raspberrypi.org. At this point I'm not sure of the relation between the w1-gpio and w1-therm modules and the patch I compiled into the kernel. If anyone has some hints please let me know. I believe a number of people are looking for this solution so let's keep this active.

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: One wire w1-gpio and w1-gpio-custom

Thu Dec 18, 2014 7:21 pm

Hi,

Had a quick look at this thread, and here are some comments about connecting multiple sensors:

1. The standard 1-wire system on the Pi is not limited to 10 devices.
The default is 10.
To change this edit the /etc/modules file:

Editing the 'wire' module line like this to allow up to 20 sensors:
wire max_slave_count=20

2. Using a star wiring system is not disallowed - it just makes the 1-wire system more prone to read failures.
Use good quality wiring using the following principles:
a. Use Ethernet cat5 cable
b. Use a single twisted pair, for example blue/blue-white to carry data and ground
c. Use a single wire from any other pair to carry power (3.3 volts)
d. Do not double-up any wires in an attempt to reduce resistance - one wire is sufficient for each function (data, ground & power)
e. Do not ground any unused wires. Leave all unused wires in the Ethernet cable disconnected (at both ends)
Also
Remember that you can use two pairs in a cat5 cable, one pair going out to a distant sensor and another pair coming back from the sensor, effectively making a 'star' topology into a single line.
and
with a lot of sensors and long cable runs, reducing the resistor value may help.

3. As error rates tend to increase with wiring complexity, add software checking to the results, with say two re-reads attempted to get a valid result.
Log all read failures for each sensor so you can pinpoint a branch of the wiring net that is causing problems.

4. If error rates are too high, try using an HA7s http://www.embeddeddatasystems.com/HA7S ... _p_23.html .
This device will manage a 1-wire network, including all the timings, and you communicate with it using the Pi's UART (serial port).
The HA7s will handle up to 100 1-wire devices (the web page says: 1000 feet, 100 devices per CAT-5 twisted net).
It does not remove the need for good network cabling, but it is more tolerant than the Pi's 1-wire system.
Note that using the HA7s allows you to communicate with many types of 1-wire device, not just temperature sensors.
No drivers or modules are required - just serial communication using ASCII characters.

Regards

anita2R

User avatar
JohnBeardmore
Posts: 211
Joined: Thu Nov 15, 2012 11:03 pm
Location: Derbyshire UK.
Contact: Website

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 5:51 pm

When I started this thread I should have perhaps explained more about the context. There are a number of situations in which I'd like to use more than one GPIO pin to access DS18B20 sensors.

The first is a building which already has start wiring plastered into the walls. The cable type probably isn't too appropriate either, but it'll probably work if the wiring is simple with one sensor per cable.

The second is a project that will involve measuring temperatures in various heat stores. It's easy enough to get a single sensor and wire into a sensor pocket, but it would be tricky to get in / out daisychained wiring in and out of a sensor pocket. I could put on a stub of wire to go into the sensor pocket, but that makes the transition line properties worse.

The third is an open source project which would involve measuring multiple temperatures. My guess is that if all people need to do is modprobes and adding 4k7 resistors to GPIO pins, a decent fraction of people who are interested will try it, but if they have to order HA7s or other one wire bus goodies, I suspect most of them won't get round to trying it. It's a question of what's easiest / most accessible.

In other situations, the HA7 does look handy.

Anyway - I never did get around to compiling a kernel module that would work, so maybe I'll try that again now there's a bit of a breather between Christmas and the New Year.


Cheers, J/.
Author of oBeMS open source Building energy Management System.
Automatic Meter Reading (AMR), Building Management System (BMS),
Building Energy Management System (BEMS), Infrastructure Control System (ICS).
See: http://t4sustainability.co.uk/oBeMS/

User avatar
JohnBeardmore
Posts: 211
Joined: Thu Nov 15, 2012 11:03 pm
Location: Derbyshire UK.
Contact: Website

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 5:58 pm

Thuleman wrote:

>My pi boots OK with the new kernel and modules, but I still only see one
>w1_bus_master1, where I should see master1,2,3,& 4. This is my first cross
>compile so I will go back and do it again with the latest debian kernel 3.12
>source from raspberrypi.org.

Hi,

Did you have any more joy with this ?


>At this point I'm not sure of the relation
>between the w1-gpio and w1-therm modules and the patch I compiled into
>the kernel. If anyone has some hints please let me know.

Please let all of us know !


>I believe a number
>of people are looking for this solution so let's keep this active.

Yes, me for one.


Cheers, J/.
Author of oBeMS open source Building energy Management System.
Automatic Meter Reading (AMR), Building Management System (BMS),
Building Energy Management System (BEMS), Infrastructure Control System (ICS).
See: http://t4sustainability.co.uk/oBeMS/

User avatar
iinnovations
Posts: 621
Joined: Thu Jun 06, 2013 5:17 pm

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 6:06 pm

Use a dedicated bus master like the DS2483 or DS2482. They are far more reliable than bitbanging using w1 and allow using owfs. They're also cheap!

C
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

User avatar
JohnBeardmore
Posts: 211
Joined: Thu Nov 15, 2012 11:03 pm
Location: Derbyshire UK.
Contact: Website

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 6:30 pm

iinnovations wrote:Use a dedicated bus master like the DS2483 or DS2482. They are far more reliable than bitbanging using w1 and allow using owfs. They're also cheap!
I don't doubt it would work, but again, if people have to order in additional components, I suspect it will put quite a few people off playing with the project.

Cheers, J/.
Author of oBeMS open source Building energy Management System.
Automatic Meter Reading (AMR), Building Management System (BMS),
Building Energy Management System (BEMS), Infrastructure Control System (ICS).
See: http://t4sustainability.co.uk/oBeMS/

User avatar
iinnovations
Posts: 621
Joined: Thu Jun 06, 2013 5:17 pm

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 8:52 pm

Well, if it's cost, they're $1. If it's soldering, you can get boards from sheepwalk ready to go. http://www.sheepwalkelectronics.co.uk/i ... 377aa7a96e

Now that I'm looking at that, however, it seems to me you should be able to get an i2c breakout for about $5, considering it's one DS2483 and an ethernet jack and/or screw terminals. Maybe $10 with some margin for handling in there.

C
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

User avatar
iinnovations
Posts: 621
Joined: Thu Jun 06, 2013 5:17 pm

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 9:00 pm

What I didn't include:

The bottom line is that the only reliable way to run a 1Wire network is either on something clocked like an arduino or a bus master. This is especially true of larger and mixed topology networks. The bus masters have the additional benefit of handling deterioriating and non-optimal signals, reflections, and other errors. They're just the right tool for the job.

Furthermore, bus masters are supported by owfs (w1 is not), which supports virtually all devices and their native function calls and just makes things easy to use.

C
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

ame
Posts: 3172
Joined: Sat Aug 18, 2012 1:21 am
Location: New Zealand

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 9:54 pm

iinnovations wrote:What I didn't include:

The bottom line is that the only reliable way to run a 1Wire network is either on something clocked like an arduino or a bus master. This is especially true of larger and mixed topology networks. The bus masters have the additional benefit of handling deterioriating and non-optimal signals, reflections, and other errors. They're just the right tool for the job.

Furthermore, bus masters are supported by owfs (w1 is not), which supports virtually all devices and their native function calls and just makes things easy to use.

C
Not strictly true. I ran a 30m long one-wire network from a hacked serial port adapter reliably for 4 years. My current experiments using the w1 driver on GPIO4 are also working well (using parasitic power no less).

Yes you can do it 'properly', but you can also find many cheap hacks that work extremely well.

Thuleman
Posts: 8
Joined: Sat Apr 26, 2014 3:52 pm
Location: Massachusetts, USA

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 10:03 pm

I found some errors in my patched bcm2708.c which I corrected, but my next attempt at compiling did not boot. I will take another look at the configuration in 7-10 days when I have some time, and do another build. My reason for wanting this is I have four DS18B20 sensors on short lines and one on a long wire. I am unable to add any more and I would like to make the long wire longer. If I have a couple more interface pins this will all work without additional hardware.
Ken

anita2r
Posts: 226
Joined: Sun Dec 23, 2012 6:55 pm
Location: Ottawa, Canada

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 10:34 pm

Hi,
iinnovations wrote:What I didn't include:

The bottom line is that the only reliable way to run a 1Wire network is either on something clocked like an arduino or a bus master.
It seems that there are two issues here:
1. Get the best possible 1-wire network
2. Get a 1-wire network that works but may have issues when the 1-wire network gets big or has poor wiring topology.

For those starting out with temperature sensing, the Pi's built-in support for 1-wire, works just fine - you don't usually start out with a big network or multiple sensors.

If the Pi's 1-wire system works fine, then you don't need anything else.

I ran 11 temperature sensors for about 6 months, and with a bit of scripting to handle errors and providing re-reads I had very acceptable results.

However as users progress and add cable and sensors, knowing that other more robust options are available, allows them to try devices where the 1-wire network is managed by a dedicated device.

In a previous post I mentioned the use of the HA7s, but I was not suggesting it for new users, it's just an option for improved performance and access to other 1-wire devices.

It's really a case of horses for courses, and not an issue of one or other approach.

... and the Pi is a great place to learn ...

Regards

anita2R

User avatar
iinnovations
Posts: 621
Joined: Thu Jun 06, 2013 5:17 pm

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 11:20 pm

anita2r wrote:Hi,
iinnovations wrote:What I didn't include:

The bottom line is that the only reliable way to run a 1Wire network is either on something clocked like an arduino or a bus master.
It seems that there are two issues here:
1. Get the best possible 1-wire network
2. Get a 1-wire network that works but may have issues when the 1-wire network gets big or has poor wiring topology.

For those starting out with temperature sensing, the Pi's built-in support for 1-wire, works just fine - you don't usually start out with a big network or multiple sensors.

If the Pi's 1-wire system works fine, then you don't need anything else.

I ran 11 temperature sensors for about 6 months, and with a bit of scripting to handle errors and providing re-reads I had very acceptable results.

However as users progress and add cable and sensors, knowing that other more robust options are available, allows them to try devices where the 1-wire network is managed by a dedicated device.

In a previous post I mentioned the use of the HA7s, but I was not suggesting it for new users, it's just an option for improved performance and access to other 1-wire devices.

It's really a case of horses for courses, and not an issue of one or other approach.

... and the Pi is a great place to learn ...

Regards

anita2R
All true, and rereading my original post, my verbiage was a bit strong. It's not the only way to get a reliable 1Wire network, but it's a SURE way to get the MOST reliable 1Wire network.

It's just tough when users get errors because they're using software/hardware combinations that just aren't quite up to the job as you get even close to edge cases. Error-handling costs time and headaches, and takes you away from doing the cool part about what you are trying to do.

I think a very important lesson to learn is when and when not to reinvent the wheel. This is a perfect case, IMO, to not reinvent the wheel, and use the right tool for the job. I mean, the i2c master I use is $1. I meant what I said above about a cheap and tiny breakout for $5. I'm going to make them and sell them to save headaches. It won't be to make money!

C
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

User avatar
iinnovations
Posts: 621
Joined: Thu Jun 06, 2013 5:17 pm

Re: One wire w1-gpio and w1-gpio-custom

Mon Dec 29, 2014 11:23 pm

The last thing I'll add here is that owfs is just a superior way to mount 1Wire networks. Another headache saver.

C
CuPID Controls :: Open Source browser-based sensor and device control
interfaceinnovations.org/cupidcontrols.html
cupidcontrols.com

racko
Posts: 1
Joined: Wed Mar 04, 2015 8:55 pm

Re: One wire w1-gpio and w1-gpio-custom

Wed Mar 04, 2015 9:02 pm

Hello,

To change gpio pin, modify "/etc/modules"

w1-gpio

to

w1-gpio gpiopin=17

Working on kernel 3.18.7

User avatar
DougieLawson
Posts: 40832
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: One wire w1-gpio and w1-gpio-custom

Thu Mar 05, 2015 9:32 am

racko wrote:Hello,

To change gpio pin, modify "/etc/modules"

w1-gpio

to

w1-gpio gpiopin=17

Working on kernel 3.18.7
That's the old way of doing it. The new way is with the device tree. Add

Code: Select all

dtoverlay=w1-gpio,gpiopin=17
to /boot/config.txt and reboot.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

silviodelgado70
Posts: 41
Joined: Sun Dec 01, 2013 10:36 pm

Re: One wire w1-gpio and w1-gpio-custom

Fri Mar 20, 2015 8:45 pm

Hello,
I'm trying to compile kernel with the changes suggested by http://holyhead.de/RaspberryPi/bcm2708- ... .12.21.txt
I think I have to:
1 - Download the sources from https://github.com/raspberrypi/linux/
2 - Change the bcm2708.c file.
3 - Compile the kernel as described here http://www.raspberrypi.org/documentatio ... uilding.md
Then I will have multiple one wire master on rpi.
Am I correct? If not please show me the right way to do this.
Thanks in advance

dpenezic
Posts: 99
Joined: Sat Dec 22, 2012 2:36 pm

Re: One wire w1-gpio and w1-gpio-custom

Fri Mar 20, 2015 10:38 pm

Hi,

it is look like that patch will result with 4 1-Wire master (GPIO 4, 21, 22, 23), if you like just that , you are on right way (not so sure that this patch will fork on all RPi type).

silviodelgado70
Posts: 41
Joined: Sun Dec 01, 2013 10:36 pm

Re: One wire w1-gpio and w1-gpio-custom

Sat Mar 21, 2015 1:38 pm

Thanks you very much, dpenezic, for your quick answer.
I will try to do that and I'll post back my result.

Return to “Interfacing (DSI, CSI, I2C, etc.)”