RPi Grove Base Hat with MM32 - I2C error

This issue has been tracked since 2021-08-19.

Hi, I just got my RPi Grove kit but am stuck at the Nightlight experiment.

I am getting the message Check whether I2C enabled and Grove Base Hat RPi inserted

My hat has the MM32 chip instead of the STM32 chip. I posted on the Seeed forum and they advised changing the I2C address to 0x08 in the adc.py. I did that in the /home/pi/grove/grove.py/grove but still no luck. Suggestions?

Thanks,

-Wes

WesEvern wrote this answer on 2021-08-23

Update.

Changing the address in the adc.py file to 0x08 does in fact work as I can run "python adc.py" and it displays values for the light sensor. So appears the address being used in my Nighlight code is not using address 0x08. Need to figure that out.

WesEvern wrote this answer on 2021-08-24

Update.
Stumbled across that I can run my app.py code, this from IoT-For-Beginners/1-getting-started/lessons/3-sensors-and-actuators/pi-sensor.md, from the Run drop down menu and selecting "Run Without Debugging" which puts a bunch of stuff on the cmd line. It works. Why I am not sure. Perhaps by the end of the course I will know.

jimbobbennett wrote this answer on 2021-08-24

Thanks for the update @WesEvern. I'm going to try to get hold of the new version of this board and put some appropriate instructions in the guide.

jimbobbennett wrote this answer on 2021-08-25

I've got one coming to me, so once that arrives I'll update the instructions.

marty-optum wrote this answer on 2021-09-02

I got it working using the clues in the thread above! This is a bit of a hack, but it works in my environment now, so I'll share my experience here in case it helps others.

Environment - I had installed Raspberry Pi OS in "headless" mode with the smaller install footprint. As a result, I am running VS Code on macOS as my editor, and following the instructions at Remote access to code the Pi.

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):

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

  7. 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.

  8. In the terminal session to the Pi within VS Code, run nightlight app again by typing python3 app.py

Now it works!

pmossel wrote this answer on 2021-10-12

I got the same error message "Check whether I2C enabled..." when I ran the code using a Pi 3 and the just-purchased Base Hat V1.0 with the MM32 chip.

Because not every part of my Grove order had arrived yet, I used the older V1.1 sensor with a CdS cell and the TI LM358 op-amp instead of the suggested grove light sensor v1.2 with photodiode. This did not make a difference since the op-amp just outputs a voltage level to the A0 port.

On a headless Pi 3 with PI OS 10.0 Lite:
Made the change in the base address (0x04 to 0x08) in adc.py proposed by WesEvern.

Pre-test:

  1. connected a light sensor to A0
  2. Run python adc.py

Conclusion: the ADC and drivers work because the light levels output on A0 are converted to digital by the MM32 chip

BUT:
The nightlight code does NOT work in headless mode with the Pi connected to a W10 PC with VS Code. I spent a lot of time investigating but did not get it to work.

Next, I loaded a full desktop OS on a Pi 4 and installed VS Code on the Pi. I followed all instructions including the detailed (Thank you Marty-Optum) to change the base address of the shield to 0x08. And the nightlight code works!!

While I love using VS Code with remote deployment (WSL with Ubuntu on W10), this does not work for the project in this course. I recommend VS Code on the Pi.

Guest wrote this answer on 2021-10-07

Thank you so much for this - please, please, please update the GitHub repo lessons. I've been banging my head against this same issue all afternoon and finally found this while googling the obscure Grove error!

Mike Mitchell wrote this answer on 2022-01-15

I've a new PI4B with the MM32 chip, and I've done all the suggestions (change 3 to 8 in adc.py; enable I2C and SPI) but I still get the message "Check whether I2C enabled and Grove Base Hat RPi inserted”. 

I'm going to continue with IoT for Beginners, but using the CounterFit simulations. Not what I wanted, but hoping that in due time, someone at Seeed will reissue the libraries to resolve this incompatibility. While doing that, they might want to also fix the incompatibility with Bullseye OS (I'm using Buster).

More Details About Repo
Owner Name microsoft
Repo Name IoT-For-Beginners
Full Name microsoft/IoT-For-Beginners
Language C++
Created Date 2021-03-03
Updated Date 2022-08-15
Star Count 10833
Watcher Count 275
Fork Count 1393
Issue Count 30

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date