Raspberry Pi is a great invention that ever happened. The little $35 computer can be used 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 very interesting and useful. I am going to use Grove Sensors with Raspberry Pi and monitor the environment around the device, for example, temperature, air pollution, and water, etc.
- Raspberry Pi – You can buy any Raspberry Pi 3 or Raspberry Pi 4 for this project.
- Grove Base Hat
- Grove Temperature sensor
- Grove Air Pollution sensor
- Grove Water sensor
- Grove Touch sensor
What is Grove?
Grove provides extremely easy to use modules for Arduino, Raspberry Pi, and many more development platforms. Grove sensors that I am going to use in this article are extremely easy 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 then connect Grove modules to the Grove base hat.
Setup Grove Library
For all grove modules, Grove has written easy to use python library. It can be easily installed 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 -
The above command will download and install the Grove library on Raspberry Pi. Once the library is setup, 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 temperature sensor to A0 port of the base hat. Now execute the following command in the terminal –
As you can see the above command outputs the current temperature of the room. If you know Python, you can also modify the script.
Grove water sensor can detect if the sensor is dry or it has water on the surface.
To use the water sensor with Raspberry Pi, connect the sensor with A2 port of Grove base hat and execute the following command –
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.
Connect the sensor in A4 port of the base hat and type the following command to ouput the air quality –
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.
To use touch sensor, connect the sensor in D5 port of the base hat and type the following command in the terminal –
As you can see, by default the script outputs ‘Pressed’ if the sensor is touched and outputs ‘Released’ if the touch is released.
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 be able to monitor the environment around the device on the dashboard. I think it is going to be very useful to have the environment information of the device on the server dashboard.