Error
vecerapl opened this issue · 11 comments
Traceback (most recent call last):
File "test.py", line 4, in
tsl = tsl2591.Tsl2591() # initialize
File "/python-tsl2591/tsl2591/read_tsl.py", line 73, in init
self.set_timing(self.integration_time)
File "/python-tsl2591/tsl2591/read_tsl.py", line 78, in set_timing
self.enable()
File "/python-tsl2591/tsl2591/read_tsl.py", line 145, in enable
TSL2591_ENABLE_POWERON | TSL2591_ENABLE_AEN | TSL2591_ENABLE_AIEN
File "/usr/local/lib/python2.7/dist-packages/smbus_cffi-0.5.1-py2.7-linux-armv7l.egg/smbus/util.py", line 59, in validator
return fn(_args, *_kwdefaults)
File "/usr/local/lib/python2.7/dist-packages/smbus_cffi-0.5.1-py2.7-linux-armv7l.egg/smbus/smbus.py", line 145, in write_byte_data
raise IOError(ffi.errno)
IOError: 5
context please
I installed the application TSL2591, I had to install:
sudo apt-get install python-dev
sudo apt-get install libffi-dev
Then I made the installation of GIT:
git clone https://github.com/maxlklaxl/python-tsl2591.git
cd python-tsl2591
sudo python setup.py install
Here is an example of the installation: http://www.napajedlaci.cz/python.txt
I created a test.py:
sudo touch test.py
Put your code and save the file.
import tsl2591
tsl = tsl2591.Tsl2591() # initialize
full, ir = tsl.get_full_luminosity() # read raw values (full spectrum and ir spectrum)
lux = tsl.calculate_lux(full, ir) # convert raw values to lux
print lux, full, ir
And this is cmd: "python test.py":
Traceback (most recent call last):
File "test.py", line 3, in
tsl = tsl2591.Tsl2591() # initialize
File "/home/pi/python-tsl2591/tsl2591/read_tsl.py", line 73, in init
self.set_timing(self.integration_time)
File "/home/pi/python-tsl2591/tsl2591/read_tsl.py", line 78, in set_timing
self.enable()
File "/home/pi/python-tsl2591/tsl2591/read_tsl.py", line 145, in enable
TSL2591_ENABLE_POWERON | TSL2591_ENABLE_AEN | TSL2591_ENABLE_AIEN
File "/usr/local/lib/python2.7/dist-packages/smbus_cffi-0.5.1-py2.7-linux-armv7l.egg/smbus/util.py", line 59, in validator
return fn(_args, *_kwdefaults)
File "/usr/local/lib/python2.7/dist-packages/smbus_cffi-0.5.1-py2.7-linux-armv7l.egg/smbus/smbus.py", line 145, in write_byte_data
raise IOError(ffi.errno)
IOError: 5
I installed od Raspbian Jessie (kernel 4.1) and also later on Wheezy (kernel 3.18).
It looks to me that there is no connection to the sensor
do you see the TSL here
sudo i2cdetect -y 1
or
sudo i2cdetect -y 0
Does your user has the right permissions? Can you try to run the Quickstart lines from the console instead of a script?
How to run quickstart? To communicate with Raspberry PI 2 only use Putty.
My involvement: https://ctrlv.cz/shots/2015/12/20/4IUk.png AND https://ctrlv.cz/shots/2015/12/20/efes.png
sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- 29 -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
i2cdump -y 1 0x29 b
0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef
00: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XXXXXXXXXXXXXXXX
10: XX XX XX XX XX XX XX XX XX XX XX XX 1c 1d 1e 1f XXXXXXXXXXXX????
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f !"#$%&'()*+,-./
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f 0123456789:;<=>?
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f @abcdefghijklmno
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f PQRSTUVWXYZ[]^_
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f `abcdefghijklmno
70: 70 71 72 73 74 75 76 77 78 79 7a 7b 7c 7d 7e 7f pqrstuvwxyz{|}~?
80: 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
90: 00 01 50 00 00 00 00 00 1a e0 c0 41 00 00 00 00 .?P.....???A....
a0: 7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ?...............
b0: 00 01 50 00 00 00 00 00 1a e0 c0 41 00 00 00 00 .?P.....???A....
c0: 00 00 00 00 00 7f 00 00 00 00 00 00 00 00 00 44 .....?.........D
d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
Error: Read failed
i2cget -y 1 0x29 0xb4
i2cget -y 1 0x29 0xb6
so I guess you have a general issue with the i2c connection.
did you follow these instructions
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
Oh, and I see you have a raspberry Pi 2, I only tested on the first generation. probably there changed something with the i2c, haven't worked with it jet
I have an raspberry Pi 2 and for me this library works and I can reach the TSL2591 from the comandline.
Just as an Information regarding the Pi2.
Hey did you solve the problem? I have the exact same error message here, except the IOError: 110 in the last line. Please help
never had this problem, can you reach it from commandline?
On 31 October 2016 at 03:19, mjbcncs notifications@github.com wrote:
Hey did you solve the problem? I have the exact same error message here,
except the IOError: 110 in the last line. Please help—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AB91_1xVVIyAzofhwm_oohTN-sPDlzzgks5q5VArgaJpZM4G4p3t
.