Comments: Qwiic Kit for Raspberry Pi Hookup Guide

Pages

Looking for answers to technical questions?

We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.

  • DamagedDolphin / about 5 years ago / 1

    This step: sudo pip install sparkfun_qwiic

    returns: sudo: pip: command not found

    I had to run it as: sudo pip3 install sparkfun_qwiic

    Confirmed added to end of ~/.bashrc and rebooted prior to running those commands alias python='/usr/bin/python3' alias pip=pip3

    Not sure if this will break something further down the road

    • I just updated the demo code used in the repo:

      https://github.com/sparkfun/Qwiic-Kit-for-Pi/blob/master/qwiic_kit_for_pi_demo.py
      

      I'll need to update the references in the tutorial sometime tomorrow but you should be able to read the sensor values like it did before being refactored. =)

      • DamagedDolphin / about 5 years ago / 1

        Started over from fresh Raspberry Pi image and now I get the following:

        sudo python qwiic_kit_for_pi_demo.py

        Traceback (most recent call last): File "qwiic_kit_for_pi_demo.py", line 23, in <module> import paho.mqtt.client as mqtt ImportError: No module named paho.mqtt.client

        • Ah, the MQTT is set up when you run the commands in a terminal window for Cayenne. This step is entirely optional if you just want to run the script locally. You'll just need to comment out the line sand references with a # if you are not sending data to the cloud:

          Command Line Option for Setting Up MQTT and Cayenne

          Also, try using the following command to explicitly use Python 3 in case the alias did not work:

          python3 qwiic_kit_for_pi_demo.py
          

          • DamagedDolphin / about 5 years ago / 1

            I did those steps,

            Setting Up MQTT and Cayenne wget https://cayenne.mydevices.com/dl/rpi_******.sh sudo bash rpi_****.sh -v rebooted

            Anyways, I commented out all the mqtt lines and now I get

            sudo python test.py Traceback (most recent call last): File "test.py", line 24, in <module> import qwiic ImportError: No module named qwiic

            or

            sudo python3 test.py Error: Unable to load smbus module. Unable to continue Error connecting to Device: 60, 'NoneType' object has no attribute 'write_byte' Error: Unable to load smbus module. Unable to continue Traceback (most recent call last): File "test.py", line 50, in <module> bme.begin() File "/usr/local/lib/python3.7/dist-packages/qwiic_bme280.py", line 216, in begin chipID = self._i2c.readByte(self.address, self.BME280_CHIP_ID_REG) File "/usr/local/lib/python3.7/dist-packages/qwiic_i2c/linux_i2c.py", line 155, in readByte return self.i2cbus.read_byte_data(address, commandCode) AttributeError: 'NoneType' object has no attribute 'read_byte_data'

            so I ran: sudo apt-get install python3-smbus

            and.....!

            SUCCESS!

            Wed Jul 24 2019 10:33:35PM BME Temperature 92.1 F Humidity 42.0 Pressure 101325.00 Pa Altitude 12205.52 ft Distance 25.00 Ambient Light 74.00 TVOC 0.00 CO2 400.00

            ... or maybe not... those values are wayyyy off

            • Qwiic Modules Not Installed to Correct Path

              I received the issue when the Qwiic module was not installed to the correct paths when running the code.

               Traceback (most recent call last):
                File "./qwiic_kit_for_pi_demo.py", line 24, in <module>
                  import qwiic 
              ImportError: No module named 'qwiic'
              

              After running quick test on the 4th Pi image yesterday afternoon via the command line using the commands python and import qwiic, I received the same error. For some strange reason the alias did not work and required me to explicitly install/use the modules using Python 3 (i.e. pip3 and python3).

              pi@raspberrypi:~ $ python
              Python 3.7.3 (default, Apr  3 2019, 05:39:12) 
              [GCC 8.2.0] on linux
              Type "help", "copyright", "credits" or "license" for more information.
              >>> import qwiic
              Traceback (most recent call last):
                File "<stdin>", line 1, in <module>
              ImportError: No module named qwiic
              

              smbus Error

              I have not seen the smbus error before.

              Error: Unable to load smbus module. Unable to continue Error connecting to Device: 60, 'NoneType' object has no attribute 'write_byte' Error: Unable to load smbus module. Unable to continue Traceback (most recent call last): File "test.py", line 50, in <module> bme.begin() File "/usr/local/lib/python3.7/dist-packages/qwiic_bme280.py", line 216, in begin chipID = self._i2c.readByte(self.address, self.BME280_CHIP_ID_REG) File "/usr/local/lib/python3.7/dist-packages/qwiic_i2c/linux_i2c.py", line 155, in readByte return self.i2cbus.read_byte_data(address, commandCode) AttributeError: 'NoneType' object has no attribute 'read_byte_data'
              

              I'm not sure why you need to run the command to install the smbus with python 3.

              sudo apt-get install python3-smbus
              

              Sensor Output

              Hmm, which values are you referring to that do not seem to be reading correctly?

              Wed Jul 24 2019 10:33:35PM
              BME Temperature 92.1 F
              Humidity 42.0
              Pressure 101325.00 Pa
              Altitude 12205.52 ft
              Distance 25.00
              Ambient Light 74.00
              TVOC 0.00
              CO2 400.00
              

              • DamagedDolphin / about 5 years ago / 2

                The BME280 sensor seems to be reporting the temp about 4ºF too high. I added a calculation in to correct for that. The relative humidity seems to read lower between 8-12% and doesn't seem to be a linear calculation I can correct for being relative humidity I guess.

                The rest look like calculations that I can solve in the code eg: Altitude 12205.52 ft should be 122ft roughly. 101325.00Pa is ok. Distance sensor I will have to check and see what value scale it is using, but it seemed it didn't respond correctly when I cupped my hand over it. It returned a value of 900 something. Ambient light looks to be working ok.

                TVOC and CO2 changed when I breathed on it so that sensor seems to be working.

                Any guides to get the Qwiic VEML6075 going in Python?

                • santaimpersonator / about 5 years ago / 1

                  Hi there, it sounds like you are looking for technical assistance. Please use the link in the banner above, to get started with posting a topic in our forums. Our technical support team will do their best to assist you.

                  That being said, the BME280 will be a little off due to the heating element in the CSC811 sensor.

                  The altitude calculation is based off of the pressure measurement, which can get thrown off by multiple factors including things like storm fronts.

                  We are slowly expanding out I2C/Qwiic Python library (including new, current, and some past products).

                  Otherwise, if you are relatively familiar with Python and C, you can just follow the modifications between the Arduino and Python libraries (that we currently have) to compare the changes. Most of the modifications should be relatively straight forward for a somewhat experienced coder.

    • Hi,

      Sorry about that. The command [ sudo pip install sparkfun_qwiic ] had worked after testing it on three images. The example code was recently refactored and the command seems to install the modules to Python 2.7 paths. With the updated modules for version 0.9.6, the command should now be the following to ensure that they get installed with Python 3.7.

      sudo pip3 install sparkfun-qwiic
      

      The "refactored" modules basically includes "_" between words without any camel casing to adhere to Python standards. I am in the middle of updating and testing the demo code with the changes.


If you've found an issue with this tutorial content, please send us your feedback!