Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
1,858 Views

i2c smbus not working on edsion

Hi ,

https://github.com/ControlEverythingCommunity/HTS221/tree/master/Python HTS221/Python at master · ControlEverythingCommunity/HTS221 · GitHub

I was using above python code for HTS221.

Error :

python hts221.py

Traceback (most recent call last):

File "hts221.py", line 2, in

import smbus

ImportError: No module named smbus

Please provide the steps to resolve above issue.

import smbusimport time# Get I2C busbus = smbus.SMBus(1)# HTS221 address, 0x5F(95)# Select average configuration register, 0x10(16)<td class="blob-num js-line-number" data-line-number="15" style="box-sizing: border-box; padding: 0px 10px; width: 50px; min-width: 50px; font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 12px; line-height: 20px; color: rg...
0 Kudos
4 Replies
Highlighted
Community Manager
8 Views

Hi Srinivas,

I would like to know some more about your project so we can help you better.

 

Which image are you using?

 

Also, did you attach the log for some reason? I'm not sure why you attached it. If you could explain us I would really appreciate it.

 

Now, regarding the error, first try to install i2c-tools from the AlexT repository using opkg. Then try to install smbus with these instructions:

pip install cffi

 

pip install smbus-cffi

 

You can check some more discussion on this following this link, /thread/61160 https://communities.intel.com/thread/61160.

Regards,

 

-Pablo
0 Kudos
Highlighted
New Contributor II
8 Views

Hi Pablo ,

I was unable to install ccfii and smbus-cffi

I was getting below error

root@edison:~# pip install cffi

-sh: pip: command not found

root@edison:~# pip install smbus-cffi

-sh: pip: command not found

Please do need full.

0 Kudos
Highlighted
Community Manager
8 Views

Hi Srinivas,

 

 

This is due to pip not being installed on your Edison. You should avoid the error if you install it.

 

Here are the steps to do so:

 

1. Setup the Edison repo by replacing anything you have in the /etc/opkg/base-feeds.conf file with the following:src/gz all http://repo.opkg.net/edison/repo/all http://repo.opkg.net/edison/repo/all

 

src/gz edison http://repo.opkg.net/edison/repo/edison http://repo.opkg.net/edison/repo/edison

 

src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32 http://repo.opkg.net/edison/repo/core2-322. Setup the IoT repo by running the following commands:echo "src intel-iotdk http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586 http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586" > /etc/opkg/intel-iotdk.conf3. Run the following command: opkg update4. Install pip by running the following commands:wget https://bootstrap.pypa.io/get-pip.py https://bootstrap.pypa.io/get-pip.py --no-check-certificate python get-pip.py

 

 

Regards,

 

-Pablo
0 Kudos
Highlighted
Community Manager
8 Views

Hi Srinivas,

 

 

Any updates on this case?

 

 

Regards,

 

-Pablo
0 Kudos