Grove Sensors For Raspberry Pi

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.

Prerequisites

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.

Grove base hat
Grove base hat
Connect Grove base hat with Raspberry Pi
Mount Grove base hat on Raspberry Pi

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 -
Grove library installed
Grove library installed

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 grove temperature sensor
Connect Grove temperature sensor

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

grove_temperature_sensor 0
Grove temperature sensor
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
Grove water sensor

To use the water sensor with Raspberry Pi, connect the sensor with 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
Grove air quality sensor

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

grove_air_quality_sensor_v1_3 4
Air quality sensor
Air quality sensor

Touch sensor

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
Grove touch sensor

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

grove_touch_sensor 5
Touch sensor
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 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.

The post Grove Sensors For Raspberry Pi appeared first on LinuxAndUbuntu.



from LinuxAndUbuntu https://ift.tt/2RkAyHP

Post a Comment

0 Comments