RasPi 4 + Grove TDS sensor code (No module named grove.adc)

Hi everyone,

I’m really new, so please forgive me if I’m asking a dumb question. I got my Grove Base HAT connected to my RasPi 4 and I’m trying to set up Grove TDS sensor. I’m following this tutorial: https://wiki.seeedstudio.com/Grove-TDS-Sensor/#play-with-raspberry-pi

and I get this error: ModuleNotFoundError: No module named ‘grove.i2c’

I cannot find this module in plug-ins.

P.S. I have a Grove Tem&Humidity sensor running through the HAT and had no problem with that one.

I would appreciate any advice!

Thank you!

Hi @elenfoxx, This is because you don’t’ have the python module named ‘grove/i2c’, and you can install it with the grove py package.

You can install the latest grove.py by

curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -

After installing the grove.py can you try to run your code, if you still have the error, please share the code and error log. Thanks :slightly_smiling_face:

@salman Thank you so much for a quick reply! I will try it Tuesday when I get to my office Pi!

@elenfoxx did you get it working?
if so, did you compare the ppm result with an other TDS meter?

Hi @elenfoxx
I had the same problem with you today, which prompted ModuleNotFoundError: No module named ‘grove.i2c’.
The reason is after I use “git clone https://github.com/Seeed-Studio/grove.py” to clone the grovepy, I forget to use

# Python2
sudo pip install .
# Python3
sudo pip3 install .

I did get it working, but I didn’t compare it to any other probes yet. I can compare the readings to a Vernier TDS probe and see if they match. That would be interesting to see!

hi,

it would be nice if you share the results. i am very curious :slight_smile:

Continuing the discussion from RasPi 4 + Grove TDS sensor code (No module named grove.adc):

hii i am trying to use grove gsr sensor/ raspberry pi with grove raspberry hat. i follow the instruution as given by seed website for connection setup (Grove - GSR Sensor - Seeed Wiki). while running gsr sensor code it always ends with sysargv value <2 and it never reads or detects the sensor what is the solution for a problem.

I’m really new, so please forgive me if I’m asking a dumb question.
I don’t have the Grove Base HAT , I can connect the RasPi 4 with the Gove TDS sensor and using this code :

I was hoping to get some help with my TDS sensor I have tried everything in the comments thus far TDS is plugged into A0

#!/usr/bin/env python3

import math
import sys
import time

from grove.i2c import Bus
from grove.adc import ADC

class GroveTDS:

def __init__(self, channel):
    self.channel = channel
    self.adc = ADC()

@property
def TDS(self):
    value = self.adc.read(self.channel)
    if value != 0:
        voltage = value*5/1024.0
        tdsValue = (133.42/voltage*voltage*voltage-255.86*voltage*voltage+857.39*voltage)*0.5
        return tdsValue
    else:
        return 0

Grove = GroveTDS

def main():
if len(sys.argv) < 2:
print(‘Usage: {} adc_channel’.format(sys.argv[0]))
sys.exit(1)
#else:
# print(sys.argv)

sensor = GroveTDS(int(sys.argv[1]))
print('Detecting TDS on port A{}...'.format(sys.argv[1]))

while True:
    try:
        print('TDS Value: {}'.format(sensor.TDS))
        time.sleep(1)
    except:
        print('Not found')
        time.sleep(1)

if name == ‘main’:
main()

Thanks!

I receive Detecting TDS, check weather i2c is enabled and hat is installed. both are enabled and installed