Airquality sensor on grove pi at facing::::Check whether I2C enabled and Grove Base Hat RPi or Grove Base Hat RPi Zero inserted

This is thread is copied from the following website. It works.
https://issueexplorer.com/issue/microsoft/IoT-For-Beginners/287

Here are the steps I took for my workaround:

  1. In the terminal session to the Pi within VS Code, make a backup of adc.py by typing:
    sudo cp /usr/local/lib/python3.7/dist-packages/grove/adc.py /usr/local/lib/python3.7/dist-packages/grove/adc.py.bak (because… safety)

  2. In the terminal session to the Pi within VS Code, change the permissions on adc.py so that you can edit the file from within VS Code by typing
    sudo chmod 666 /usr/local/lib/python3.7/dist-packages/grove/adc.py (This assumes you installed the python distribution patches in the same location as python3. Your mileage may vary depending on where you installed these Python packages).

  3. Go to the File > Open… menu to open up the Open File Or Folder dialog box.

  4. Enter in /usr/local/lib/python3.7/dist-packages/grove/adc.py, then press the OK button.

  5. In the adc.py file, go to approximately line 57, and change the 0x04 to 0x08 as shown below from:

def __init__(self, address = 0x04):to: def __init__(self, address = 0x08):

  1. Go to the File > Save menu to Save the adc.py file.

  2. In the terminal session to the Pi within VS Code, change the permissions back on adc.py by typing:
    sudo chmod 644 /usr/local/lib/python3.7/dist-packages/grove/adc.py.

Now it works!

1 Like