Python library for Seeedstudio Grove Devices on embeded Linux platform, especially good on below platforms:
To operate grove sensors, the grove.py depends on the smbus2 hardware interface library.
For beginner or library user only, please install with online method.
For developer or advanced user, please install dependencies
and then install grove.py with source code.
Here is the compatibility of grove.py with Python2 and Python3 on each releases of Raspbian/Raspberry Pi OS.
Raspberry Pi OS Releases | grove.py for Python2 | grove.py for Python3 |
---|---|---|
9 (Stretch) | √ | √ |
10 (Buster) until 2020-08-20 | √ | √ |
10 (Buster) after 2020-08-20 | × | √ |
11 (Bullseye) | × | √ |
12 (bookworm) | × | √ |
Because Python2 is obsolete and APT repository does not provide python-pip
, so the Raspberry Pi OS releases which after 10 (Buster) 2020-08-20
cannot use Online install
command. We also recommend using Python3 to all the users and developers.
git clone https://github.com/kmchord9/grove.py.git
cd grove.py
python -m venv vgrove
source vgrove/bin/activate
pip install .
Grove Base Hat for Raspberry Piのピン配置は上記の画像のようになっており、
センサーの仕様によってDigital,Analog,I2C,PWM,UARTの接続先が異なるので注意する。
接続先 Digital
Gravity- DHT22 温湿度センサ — スイッチサイエンス
sudo apt-get install libgpiod2
pip install adafruit-circuitpython-dht
cd grove.py/code
python grove_temperature_dht22.py 18
D18に接続した場合には引数に18を入れる
接続先 Digital
GROVE - 超音波距離センサモジュール — スイッチサイエンス
cd grove.py/code
python grove_ultrasonic_ranger.py 18
D18に接続した場合には引数に18を入れる
接続先 Digital
GROVE - 振動センサ(SW-420) — スイッチサイエンス
pip install pigpio
pip install gpiozero
cd grove.py/code
python grove_vibration_sw420.py 18
D18に接続した場合には引数に18を入れる
接続先 I2C
GROVE - 6軸加速度・ジャイロセンサ(BMI088) — スイッチサイエンス
sudo apt-get install debhelper dh-make debmake devscripts fakeroot
cd ~
git clone https://github.com/turmary/bmi088-python.git
cd bmi088-python
git submodule init
git submodule update
./tools/packaging_deb.sh
cd ~/bmi088-python/deobj
sudo dpkg -i libbmi088_0.0.2-1_arm64.deb
bmi088-python/ at master · turmary/bmi088-python
cd grove.py/code
python grove_6_axis_accel_gyro_bmi088.py
Gravity- DHT22 温湿度センサ — スイッチサイエンス
cd grove.py/code
python grove_sound_sensor.py 0
A0に接続した場合には引数に0を入れる
click here
Check list for adding a new grove device, for simple, take grove_led as a example.
- Add a Class in the python source file, and export with
__all__ =
- Code sytle PEP8 is recommanded
- The python source could run directly with
python <file>
andpython3 <file>
- Add demo code at the near top of source file
- The demo code could run directly with someone python/python3 IDE.
- Add document to class and it's member and show the result by refering to API document
- Add a command item in setup.py
console_scripts
list, take effect by install again - Add a item to command table in Usage Doc
- If the command need argument but not specified, please list available arguments.
- If specified invalid argument, also output usage document then exit.