GrovePi+: Trouble getting Grove Sensors working with Grove Python Library

Hey,

I’m trying to learn IoT by working through this tutorial https://github.com/microsoft/IoT-For-Beginners.

I work with a GrovePi+ Starter Kit on a Raspberri 2 and installed Raspbian Buster. I installed the Python libraries from Seed by following the instructions given in the tutorial

sudo apt install git python3-dev python3-pip --yes

git clone https://github.com/Seeed-Studio/grove.py
cd grove.py
sudo pip3 install .

sudo raspi-config nonint do_i2c 0

I followed the instructions at DexterIndustries as well. Everything seemed to work fine.

I ran into some problems using the Python library from Seeed-Studio. When I run the example provided https://github.com/Seeed-Studio/grove.py/blob/master/grove/grove_light_sensor_v1_2.py

I always get the same results, while covering the sensor and uncovering…
The Output is:

Hat Name = ‘None’
Unknown hat, assuming Grove Base Hat RPi
Detecting light…
Light value: 65280
Light value: 65280
Light value: 65280

When using following code, the sensor seems to work properly:

light_sensor = 0
led = 5
while True:
     light = grovepi.analogWrite(led, 100)
     print("light level: ", light)
     if light < 300:
          grovepi.analogWrite(led, 100)
     else:
          grovepi.analogWrite(led, 0)
     time.sleep(1)

The LED turns on and off als intended. Again when using the library from Seeed to turn the LED on and off with following code:

from grove.grove_led import GroveLed
led = GroveLed(5)
led.on()

nothing happens.

Has anybody an idea how to get the Seeed library to work? Been struggling to get it working for a few days now and have no idea what else to try!

Thank you very much!

1 Like

Did you install the Legacy OS?

Did you try the Dexter light sensor program?

1 Like

Yes, the one with a desktop environment, if that matters.

Do you mean this one? https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grove_light_sensor.py

I’ve tried and everything seems to work properly.

But I just don’t get the examples from Seeed-Studio to work… :confused:
I’d like to use libs from Seeed-Studio because of the more object-oriented approach.

2 Likes