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
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 .
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 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:
print('TDS Value: {}'.format(sensor.TDS))
time.sleep(1)
except:
print('Not found')
time.sleep(1)
if name == ‘main’:
main()
Thanks!