Grove Sensors For Raspberry Pi

Raspberry Pi is a great invention that ever happened. We can use the little $35 computer to build from a cam kit to the future of kids in rural India. To learn more about what this little device can do or has done, read this article I wrote a while back.

You can also visit Raspberry Pi’s official page and see how Raspberry Pi is being used for research and education.

In this article, I will also use Raspberry Pi to create something exciting and useful. I will use Grove Sensors with Raspberry Pi and monitor the environment around the device, for example, temperature, air pollution, water, etc.

Prerequisites

What is Grove?

Grove provides extremely easy-to-use modules for Arduino, Raspberry Pi, and many more development platforms. Grove sensors that I will use in this article are straightforward to connect with Raspberry Pi using Grove base hat.

All grove modules come with a small plug to easily connect with Raspberry pi. We can connect Grove base hat with the Raspberry Pi and connect Grove modules to the Grove base hat.

Grove base hat
Mount Grove base hat on Raspberry Pi

Setup Grove Library

For all grove modules, Grove has written easy to use python library. We can easily install it from their Github repository on the Raspberry pi device.

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

The above command will download and install the Grove library on Raspberry Pi. Once the library is set up, we are ready to use Grove modules.

Grove Temperature sensor

Using any of their modules is the same. Just connect one end of the plug with the module and the other with the base hat.

Connect Grove temperature sensor

Connect temperature sensor to the A0 port of the base hat. Now execute the following command in the terminal –

grove_temperature_sensor 0
Grove temperature sensor

As you can see, the above command outputs the current temperature of the room. If you know Python, you can also modify the script.

Water sensor

Grove water sensor can detect if the sensor is dry or it has water on the surface.

Grove water sensor

To use the water sensor with Raspberry Pi, connect the sensor with the A2 port of Grove base hat and execute the following command –

grove_water_sensor 2

If there is water on the sensor, the command will output ‘Water detected’; otherwise, it’ll output ‘Dry’.

Air Quality Sensor

Grove air quality sensor detects gases in the environment and outputs the result.

Grove air quality sensor

Connect the sensor in the A4 port of the base hat and type the following command to output the air quality –

grove_air_quality_sensor_v1_3 4
Air quality sensor

Touch sensor

The touch sensor can detect if the sensor was touched or not. The python script is available to modify, so you can also change the message based on the output from the sensor.

Grove touch sensor

To use the touch sensor, connect the sensor in the D5 port of the base hat and type the following command in the terminal –

grove_touch_sensor 5
Touch sensor

As you can see, by default, the script outputs ‘Pressed’ if the sensor is touched and outputs ‘Released’ if the touch is released.

Conclusion

There are many more Grove sensors available to buy. We can use these sensors in various projects. One project I am going to create is to host a server on Raspberry Pi and monitor the environment around the device on the dashboard. I think it will be advantageous to have the environment information of the device on the server dashboard.