Large Pi-based Thermometer and Clock

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
tcichowicz
 
Posts: 3
Joined: Sun Mar 15, 2015 12:01 pm

Large Pi-based Thermometer and Clock

Post by tcichowicz »

Trying to build this project ..

ordered everthing I'm missing ... but thought I would get the software built .. / installed...

I'm getting the following after I try and run the program ./ I also showed a listing of the folder/files....
pi@rpi2 ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack $ sudo python thermo_clock.py
Traceback (most recent call last):
File "thermo_clock.py", line 5, in <module>
from Adafruit_7Segment import SevenSegment
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack/Adafruit_7Segment.py", line 5, in <module>
from Adafruit_LEDBackpack import LEDBackpack
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack/Adafruit_LEDBackpack.py", line 92, in <module>
led = LEDBackpack(0x70)
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack/Adafruit_LEDBackpack.py", line 31, in __init__
self.i2c = Adafruit_I2C(address)
File "/home/pi/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack/Adafruit_I2C.py", line 43, in __init__
self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory
pi@rpi2 ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack $ ls -l
total 56
-rwxrwxr-x 1 pi pi 1693 Mar 15 11:33 Adafruit_7Segment.py
-rw-r--r-- 1 root root 2084 Mar 15 11:38 Adafruit_7Segment.pyc
-rwxrwxr-x 1 pi pi 2405 Mar 15 11:33 Adafruit_8x8.py
-rw-r--r-- 1 root root 2948 Mar 15 11:46 Adafruit_8x8.pyc
-rwxrwxr-x 1 pi pi 1345 Mar 15 11:33 Adafruit_Bargraph.py
lrwxrwxrwx 1 pi pi 31 Mar 15 11:33 Adafruit_I2C.py -> ../Adafruit_I2C/Adafruit_I2C.py
-rw-r--r-- 1 root root 6579 Mar 15 11:38 Adafruit_I2C.pyc
-rwxrwxr-x 1 pi pi 2676 Mar 15 11:33 Adafruit_LEDBackpack.py
-rw-r--r-- 1 root root 3708 Mar 15 11:38 Adafruit_LEDBackpack.pyc
-rwxrwxr-x 1 pi pi 852 Mar 15 11:33 ex_7segment_clock.py
-rwxrwxr-x 1 pi pi 540 Mar 15 11:33 ex_8x8_color_pixels.py
-rwxrwxr-x 1 pi pi 547 Mar 15 11:33 ex_8x8_pixels.py
-rwxrwxr-x 1 pi pi 474 Mar 15 11:33 ex_bargraph.py
-rwxrwxr-x 1 pi pi 2230 Mar 15 11:38 thermo_clock.py
pi@rpi2 ~/Adafruit-Raspberry-Pi-Python-Code/Adafruit_LEDBackpack $

User avatar
tcichowicz
 
Posts: 3
Joined: Sun Mar 15, 2015 12:01 pm

Re: Large Pi-based Thermometer and Clock

Post by tcichowicz »

I've built this whole this from scratch on a different Pi (Pi2) -- with the same results...

I still don't have any hardware connected to the GPIO I don't see how that could be causing the problem? but could it?

User avatar
tcichowicz
 
Posts: 3
Joined: Sun Mar 15, 2015 12:01 pm

Re: Large Pi-based Thermometer and Clock

Post by tcichowicz »

Still REALLY trying to get some HELP on this project...


can anyone comment?

quamenzullo
 
Posts: 19
Joined: Thu May 15, 2014 11:42 am

Re: Large Pi-based Thermometer and Clock

Post by quamenzullo »

Shortly: the doc says
If you are running a recent Raspberry Pi (3.18 kernel or higher) you will also need to update the /boot/config.txt file. Edit it with sudo nano /boot/config.txt and add the text

dtparam=i2c1=on
dtparam=i2c_arm=on

at the bottom. note that the "1" in "i2c1" is a one not an L!

Once this is all done, reboot!

Long answer: how I found how to correct the problem (I wrote this down while I was searching):

After an update (didn't have updated the raspi since some months...) I get the very same error, although everything worked perfectly before:

Code: Select all

/Adafruit_I2C.py", line 43, in __init__
self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
IOError: [Errno 2] No such file or directory
I must say that I'm stuck at first because I don't see where there's a file or directory at all in this line...
I've checked getPiI2CBusNumber() though the python error should have indicated the problem came from there; there is obviously no problem there. One file is opened but it does exist and it is called inside a try...except that should have catched any error.

Excerpt from the code around the error:

Code: Select all

# By default, the correct I2C bus is auto-detected using /proc/cpuinfo
    # Alternatively, you can hard-code the bus version below:
    # self.bus = smbus.SMBus(0); # Force I2C0 (early 256MB Pi's)
    # self.bus = smbus.SMBus(1); # Force I2C1 (512MB Pi's)
    self.bus = smbus.SMBus(busnum if busnum >= 0 else Adafruit_I2C.getPiI2CBusNumber())
    self.debug = debug
Now I've uncommented the line before and commented the original line. (My raspi is a 512 MB). Just to see. I get the same error.

Code: Select all

File "/home/pi/pilberry/bin/lib/hardware_drivers/Adafruit_I2C.py", line 35, in __init__
    self.bus = smbus.SMBus(1); # Force I2C1 (512MB Pi's)
IOError: [Errno 2] No such file or directory
Tried to check this from python3:

Code: Select all

# python3
Python 3.2.3 (default, Mar  1 2013, 11:53:50) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import smbus
>>> a = smbus.SMBus(1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory
>>> 
Looking for some more informations about smbus, I remember this has something to do with i2c directly and that there were some informations about i2c's configuration here: https://learn.adafruit.com/adafruits-ra ... guring-i2c

I check everything quickly and discover that /boot/config.txt has to be updated if running linux kernel 3.18+
I check that...

Code: Select all

# uname -a
Linux pilimtec 3.18.11+ #781 PREEMPT Tue Apr 21 18:02:18 BST 2015 armv6l GNU/Linux
So I guess the linux kernel has been updated in the recent update I have done.

I add the two lines mentioned in the doc and reboot.

It works!

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”