-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get Python 3 W1ThermSensor work with RPi 1-Wire Pi Plus adapter card #50
Comments
What version of w1thermsensor are you using? Can you please try with the current version or the latest version from pypi? |
I think they already are the newest ones(?), as did the RPi scratch reinstall yesterday, and as listed from the Add/Remove Software: |
Do you get a reading not using the python software?
i.e. hower the HAT says to get readings?
…On Mon, 31 Dec 2018, 09:03 mikespolk ***@***.*** wrote:
I think they already are the newest ones(?), as did the RPi scratch
reinstall yesterday, and as listed from the Add/Remove Software:
(x) Python w1 therm sensor module (Python 3)
python3-w1thermsensor-1.0.5
Python w1 therm sensor module (Python 2)
python-w1thermsensor-1.0.5
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALt5CavOCEhY4ft1cay-3coTDlvT3Gks5u-hkggaJpZM4ZlRVc>
.
|
Forgot to say, I ask as I am assuming it is this hat
https://pinout.xyz/pinout/1_wire_pi_plus
You talk to a chip via i2c on the HAT, not with 1-wire directly, which this
module does.
See the link and the link on there to GitHub, their webpages etc.
…On Mon, 31 Dec 2018, 09:28 Ben Simmons ***@***.*** wrote:
Do you get a reading not using the python software?
i.e. hower the HAT says to get readings?
On Mon, 31 Dec 2018, 09:03 mikespolk ***@***.*** wrote:
> I think they already are the newest ones(?), as did the RPi scratch
> reinstall yesterday, and as listed from the Add/Remove Software:
> (x) Python w1 therm sensor module (Python 3)
> python3-w1thermsensor-1.0.5
> Python w1 therm sensor module (Python 2)
> python-w1thermsensor-1.0.5
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#50 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ALALt5CavOCEhY4ft1cay-3coTDlvT3Gks5u-hkggaJpZM4ZlRVc>
> .
>
|
Yes, my 1-Wire adapter is just that formfactor that bsimmo sent the link for.
How to proceed next? |
I guess mute (but I think that may just be the current issue) on the email
or on GitHub stop following/etc.
Have a look on GitHub, it'll be where you asked to follow.
…On Mon, 31 Dec 2018, 14:03 fireheadman ***@***.*** wrote:
How do I get off this list? I keep unsubscribing then get another email.
On Mon, Dec 31, 2018 at 8:30 AM mikespolk ***@***.***>
wrote:
> Yes, my 1-Wire adapter is just that formfactor that bsimmo sent the link
> for.
> Also, to clarify, what already have been tried:
>
> 1.
>
> Just to make sure. to not interfere with any possible GPIO wirings I
> am going to use, I have disconnected any other connections from the GPIO
> pins.
> 2.
>
> With the (Python2 level) OWFS library as I mentioned above, the
> sensors enumerate OK, but not with the w1thermsensor library.
> 3.
>
> Did try many combinations in /boot/config.txt, /etc/modules,
> /etc/modprobe.d/raspi-blacklist.conf files, for the dtparam=i2c,
> dtparam=i2c1, i2c-bcm2708, i2c-bcm2835, i2c-dev, w1_gpio and w1_therm
> lines, to view if I have luck (=didn't have)
>
> How to proceed next?
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <
#50 (comment)
>,
> or mute the thread
> <
https://github.com/notifications/unsubscribe-auth/AS7YGz0-qCJ1wDo1OK0sJxBU6vIEHlHrks5u-i2agaJpZM4ZlRVc
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALt41WWvQizIBk5xHiNtE7jMAzs-zUks5u-l9pgaJpZM4ZlRVc>
.
|
@mikespolk the newest version is 1.1.2. @mikespolk can we discuss and debug this issue in gitter? (link is in the README) |
OK, let's move to Gitter, and then finally update status here, when ready. |
But your sensor HAT is i2c,
1-wire is 1-wire.
You need to talk to the HAT with i2c.
This module doesn't do that.
…On Tue, 1 Jan 2019, 09:04 mikespolk ***@***.*** wrote:
OK, let's move to Gitter, and then finally update status here, when ready.
Meanwhile, short answer: removed 1.0.5 with
*sudo apt-get --purge remove python3-w1thermsensor*
and then installed 1.1.2 with
*pip3 install w1thermsensor*
(hope, did that correctly, as aimed)
However, no sensors enumerated, yet.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALtwXygDyrX2jodrJR7Rhb5EjxG5mIks5u-2rQgaJpZM4ZlRVc>
.
|
@bsimmo thanks for the answer, I think that's exactly the problem. I'm confused though as why the sensor appears in /sys/bus/w1/devices Which is not supported by the w1 kernel module according to https://www.kernel.org/doc/Documentation/w1/slaves/w1_therm |
I think 00- could be 'ghost' sensors, i.e. not really there and/you have
bad wiring. I'd have to search on it.
Also no idea either.
…On Tue, 1 Jan 2019, 14:39 Timo Furrer ***@***.*** wrote:
@bsimmo <https://github.com/bsimmo> thanks for the answer, I think that's
exactly the problem. I'm confused though as why the sensor appears in
/sys/bus/w1/deviceswith the00` family code.
Which is not supported by the w1 kernel module according to
https://www.kernel.org/doc/Documentation/w1/slaves/w1_therm
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALtyAJVMsQYvFu0_Gz5CH3jVcQiEjKks5u-7lUgaJpZM4ZlRVc>
.
|
Just to mention, yesterday again I doublechecked the wirings by installing the owfs library to my from-scratch-installed RPi, according these articles: https://www.abelectronics.co.uk/kb/article/3/owfs-with-i2c-support-on-raspberry-pi and https://www.abelectronics.co.uk/kb/article/1/i2c--smbus-and-raspbian-linux, and my DS18B20 and DS18S20 sensors enumerated OK. |
So reading through that they are putting a 'driver' in to make fake 1-wire
files.
You'll need to modify this python module to pick up the specific serial
code it creates.
This module is not a driver, it just looks for valid serial numbers.
You'll still need to be running that owfs 'driver' also.
…On Tue, 1 Jan 2019, 23:37 mikespolk ***@***.*** wrote:
Just to mention, yesterday again I doublechecked the wirings by installing
the owfs library to my from-scratch-installed RPi, according these
articles:
https://www.abelectronics.co.uk/kb/article/3/owfs-with-i2c-support-on-raspberry-pi
and
https://www.abelectronics.co.uk/kb/article/1/i2c--smbus-and-raspbian-linux,
and my DS18B20 and DS18S20 sensors enumerated OK.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALt1woEqJkiTLsvABYYCpxKoVCljp5ks5u_Dd1gaJpZM4ZlRVc>
.
|
for the info, I've been working on the emails, for some reason the initial post didn't send the actual post with it, so I just went off the title and assumed there was no description with it. I understand the thread a bit better, same problem though. |
so had a read through. I would suggest abondoning using this module for now. look at the OWFS website and examples for reading the data from it the files or server/http port. but it look like it mounts the sensor in then you'll not need to use the python server module. an alternative method is to see how to talk directly to the chip on the hat via i2c to get it's readings, but that sounds more complicated ;-) Edit Then see if that works. |
Yes, have to try that. Essentially, in that configuration, the owfs must be defined to autostart at boot, and then let it generate the temperature readings to /mnt/1wire folder, asynchronously in the background. Then my Py3 app would read the file contents when needed. For that, I think that these articles would serve best: What I have to do first is to again create a fresh boot Raspbian image from scratch, to prevent existing w1thermsensor and its definitions or any other trial+error configurations from causing any secondary problems. Will take its time, and I will provide update then. |
Yes, I got owfs background processes working, by following the above articles, essentially this: https://wiki.m.nu/index.php/OWFS_with_i2c_support_on_Raspberry_Pi_(English_version)
Thank you timofurrer and bsimmo for Support and troubleshooting! |
In linux everything is a text file, the 1-wire is a text file as such too.
Just done at slower level in the OS (the bits you load at the start up)
If it looks the same owfs mnt folder then exerting DS18B20s code should
work but pointed the the different directory.
Try what I mentioned above.
I personally don't think this module should support i2c reading. At the
moment this module just passed a text file.
The OS is doing what OWFS is doing but for one wire at an OS module level.
Leave it to OWFS to do the low level stuff, it designed for it and used in
industry. Keep the expertise in one place.
Or get OS to do it at the OS level.
…On Thu, 3 Jan 2019, 12:07 mikespolk ***@***.*** wrote:
Yes, I got owfs background processes working, by following the above
articles, essentially this:
https://wiki.m.nu/index.php/OWFS_with_i2c_support_on_Raspberry_Pi_(English_version)
- 1-Wire sensors are connected via the HAT type 1-Wire Pi Plus adapter
card
- owfs autostarts at boot
- In /mnt/1wire folder, there starts appearing 10* and 28* subfolders,
for DS18S20 and DS18B20 sensor types, respectively
- The up-to-date temperatures are readable in the temperature text
files.
So I can have my Py3 application, running in the foreground, to read
temperatures from text files.
The temperature readings seem to update automatically every 10 seconds
or so.
Thank you timofurrer and bsimmo for Support and troubleshooting!
I would however be very glad, if the w1thermsensor module would support
the i2c bus, too, someday.
That is because in home automation, where the cabling may be lengthy,
1-Wire adapter car protects RPi internal bus from electrical interference,
and would let it run more stable from day to day.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALtzNzbVmQxIquX5st7PvT7tjHbiX8ks5u_jjsgaJpZM4ZlRVc>
.
|
Thanks @bsimmo for the support!
What's great about this module is it's simplicity - in maintenance and usage. Therefore I want add i2c support any time soon - except someone has a really good point way it should be implemented.
@mikespolk I'd be interested about that, too. If that's working I'll add an option to configure this path. |
Attached is listing you asked for, from a booted, idle RPi, having those owfs autostart stuff installed. |
After all of the previous discussions, and because I would love to see things trivial where possible, I am quite confused with one thing: |
There may be one, I've never used an i2c module for 1-wire.
If you know the i2c specs from the chipset datasheets you could probably
make one.
Grab the chip name and search on it.
…On Fri, 4 Jan 2019, 11:11 mikespolk ***@***.*** wrote:
After all of the previous discussions, and because I would love to see
things trivial where possible, I am quite confused with one thing:
Why wouldn't there just be a module that, as its only task, executes a
1-wire read sequence thru the i2c bus, and then synchronously returns the
results to the calling Py application? Instead of acting as a background
server and using a drop-in directory structure to pass results?
Or, is this question irrelevant in some way?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ALALtxkHgZx2HQM8GzlDQsv3Jpkt5RAjks5u_30ygaJpZM4ZlRVc>
.
|
l have the same problem. when l run w1thermsensor ls, there is no sensors found. The ds18b20 is emitting a red light. what does it mean please? It is plugged to pin 8 or ceo. |
I have been trying to get DS18B20 1-Wire temperature sensors to work with Raspberry Pi 2, with the 1-Wire Pi Plus adapter card installed, as in article https://www.abelectronics.co.uk/p/60/1-wire-pi-plus.
To proceed, I have followed the guidelines in this article https://www.abelectronics.co.uk/kb/article/1/i2c--smbus-and-raspbian-linux.
To get a Python 3 compatible library to read the sensors, I also installed the W1ThermSensor, as in article https://pypi.org/project/w1thermsensor.
Essentially, here I ran the following command: sudo apt-get install python3-w1thermsensor.
However, when I ran the following Python demo script:
import time
from w1thermsensor import W1ThermSensor
sensor = W1ThermSensor()
tempr = sensor.get_temperature()
with the Thonny Python IDE, I end up with the following error message:
Python 3.5.3 (/usr/bin/python3)
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1164, in _execute_prepared_user_code
exec(statements, global_vars)
File "/home/pi/Honka/testi-2018-12a.py", line 3, in
sensor = W1ThermSensor()
File "/usr/lib/python3/dist-packages/w1thermsensor/core.py", line 118, in init
raise NoSensorFoundError("Unknown", "")
w1thermsensor.errors.NoSensorFoundError: No Unknown temperature sensor with id '' found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1141, in execute_source
return self._prepare_hooks_and_execute(bytecode, None, global_vars)
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1156, in _prepare_hooks_and_execute
return self._execute_prepared_user_code(statements, expression, global_vars)
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1173, in _execute_prepared_user_code
return {"user_exception": self._vm._prepare_user_exception()}
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 1029, in _prepare_user_exception
"stack": self._export_stack(last_frame),
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 932, in _export_stack
locals=self.export_variables(system_frame.f_locals),
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 886, in export_variables
result[name] = self.export_value(variables[name], 100)
File "/usr/lib/python3/dist-packages/thonny/backend.py", line 876, in export_value
rep = repr(value)
File "/usr/lib/python3/dist-packages/w1thermsensor/core.py", line 150, in repr
self.class.name, self.type, self.id)
AttributeError: 'W1ThermSensor' object has no attribute 'type'
So it seems that the W1ThermSensor library is unable to enumerate any of the (two) DS18B20 sensors that are connected.
Troubleshooting steps that I did:
When using the (Python2 only) owfs library, as in article https://www.abelectronics.co.uk/kb/article/3/owfs-with-i2c-support-on-raspberry-pi,
and ran the python example code listed in it, both of the DS18B20 sensors enumerate OK.
So it seems that the sensor and adapter card connections are working as intended.
When executed this command: i2cdetect -y 1, as in article https://raspberryblog.de/?p=2293, the "18" is shown as adviced.
This command: lsmod | grep i2c, the listing is as follows:
i2c_bcm2835 16384 0
i2c_dev 16384 0
(so, instead of listing this: "i2c_bcm2708", as in some articles, like here: https://www.abelectronics.co.uk/forums/thread/113/1-wire-plus-is-not-being-seen-with-i2cdetect)
I also reinstalled the RPi from scratch, as in article https://www.imore.com/how-get-started-using-raspberry-pi,
plus installed the guizero, i2c-tools, and python3-w1thermsensor, etc. needed modules (no any owfs installs however), but with same results.
I wouldn't want to switch to owfs library, because AFAIK is is only available for Python2.
For example, the guizero library only works in Python3, so that's why I try to target the Python3.
What to do to get the W1ThermSensor work here?
The text was updated successfully, but these errors were encountered: