How to find a sensor is connected to particular port in GrovePi?


Hi Everyone,

I am a new bee to Raspberry Pi and GrovePi. Is there any functions that can help me to find whether a sensor is connected to a particular port in grovepi or not? Function that can return 1 or 0.

Thank you and Regards


Hey Vino,
Most of the sensors are digital or analog and either return a 0 or a value reading between 0-5V, so it’s not possible to detect if they are connected or where they are connected. However there are a few sensors which are I2C, which can at-least tell the pi if they are connected, but they cannot say where they are connected. Can you give a little more information about what you are trying to do ans what sensors you are using.



HI Karan,

Thank you for the information. I have different sets of sensors (Temperature, Alcohol, CO2, Color). I need to find out when a sensor is connected whether a sensor is connected or not? Also what type of sensor is connected to the individual port?



I don’t think for most of those sensors it would be possible to use something like autodetect. You’ll have to make sure before starting the program that the sensors are connected properly.

This shows the what various ports do on the GrovePi: For each of the sensors, the example codes do mention where the sensors can be connected. There are some serial and I2C sensors which have to connected to particular ports.



Hi Karan, Any suggestion on what port and how to Connect Liquid Flow Meter- Plastic 1/2" to GroveP1+? The connectors Liquid Flow Meter connectors don’t match up with the GOPi+ port connection.

Question1 : What GOPi+ port(Sensor/feature) (analog), (digital) or (12c-1) do I connect the Liquid Flow Meter to?

Listed below the Connect Liquid Flow Meter- Plastic 1/2" Product Description

Measure liquid/water flow for your solar, computer cooling, or gardening project using this handy basic flow meter. This sensor sit in line with your water line, and uses a pinwheel sensor to measure how much liquid has moved through it. The pinwheel has a little magnet attached, and there’s a hall effect magnetic sensor on the other side of the plastic tube that can measure how many spins the pinwheel has made through the plastic wall. This method allows the sensor to stay safe and dry. The sensor comes with three wires: red (5-24VDC power), black (ground) and yellow (Hall effect pulse output). By counting the pulses from the output of the sensor, you can easily track fluid movement: each pulse is approximately 2.25 milliliters. Note this isn’t a precision sensor, and the pulse rate does vary a bit depending on the flow rate, fluid pressure and sensor orientation. It will need careful calibration if better than 10% precision is required.

Question 2: Do you know of any GOPi+ python code to complete basic measurement tasks! Adafruit has an example Arduino sketch that can be used to quickly test the sensor- it will calculate the approximate quantity of fluid in liters and display on an LCD or the serial monitor.


Hi @billh,

You will have to connect the Flow sensor to the Digital Port D2 to read its value from GrovePi+.
We are using a different flow sensor flow sensor . However looking at the specifications you have provided, it looks like both the sensors are similar.

We will have a look if there would be an easy way to convert the readings to liter count, but this might take time. You can try [this example] ( which we have for our sensor and you would have to find out the conversion factor from here to translate the results.

Do let us know if this works for you,