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.
- 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 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.
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 -
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 temperature sensor to the 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 the 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 the A4 port of the base hat and type the following command to output the air quality –
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.
To use the touch sensor, connect the sensor in the 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 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.