Raspberry Pi Sensor
Raspberry Pi News
Raspberry Pi sensors and modules introduced
Quick overview Raspberry Pi Sensors Kits:
Raspberry Pi Sensors Kit with 37 Sensors SunFounder (Link)*.
Raspberry Pi Sensors Kit with 39 Sensors from Quimat (Link)*
Raspberry Pi Sensor: Moisture Module
To connect the soil moisture sensor to the Raspberry Pi, we need a total of five cables and a translation chip to make the incoming data readable.
First, I connect two cables to the soil moisture sensor. These are simply plugged on as shown here. Then I connect the other end to the chip. So the sensor is already connected to the translation chip.
Raspberry Pi humidity sensor connections
Now three more cables follow, which we find on the backside of the translation chip. Once VCC, GND, DO and AO. VCC is the power connection. GND is the ground and DO is the digital output, AO is the analog output. For a better understanding of the cable connections I recommend to watch the video in the login area at www.raspi-config.de/mitgliederbereich now.
Now we need the digital output (DO). That's why I connect the three cables directly next to each other and if you turn the chip over, the right pin remains free. Now we take the end of the cables and plug them into the Raspberry Pi. At the top right I connect the first pin, because this is the connector with 3.3 volts voltage, which we need for the translation chip or sensor.
Now we connect the ground to the Raspberry Pi and directly below DO, the cable for the digital output. With this we have connected the Raspberry Pi sensor and we still need a Python script with which we can pick up the data.
Now you can turn on the Raspberry Pi. At this point you can find a pinout diagram on different sites on the internet. Link to the Raspberry Pi pin assignment plan: www.elektronik-kompendium.de/sites/raspberry-pi/1907101.htm
On the Raspberry Pi pinout diagram you can see how the pins are used on the Raspberry Pi. So at the top the power is connected and next to it the VCC connector with the 3.3 volts voltage. At the fifth pin from the top we have the ground connection, i.e. GND. Then directly below that on pin number 17 we have the data that we need to read out.
To read out the data I have prepared a script which you can download at www.raspi-config.de/mitgliederbereich. The script is relatively simple. At this point maybe a short explanation. At the top there is a library embedded, which allows to access the GPIO pins.
Then there is a time library that allows to set a timer. We'll look at what that's important for later. And then I added a callback function which is always called when a new value is measured at the sensor. For this the output "No water detected" appears when the LED is off.
Raspberry Pi Sensor Humidity Module Script
And if the LED is on, then water was detected at the sensor. So then 'water detected' is output. Then we still define the mode from which we pass the numbering. Then we define the chanel of pin 17 and get the data from there.
Then we define some functions and the timer in the script. That means, pin 17 is monitored continuously and if a new measured value is measured, then the callback function is executed. Now let's have a look at the script in action.
To test the script, I will use a cup with water in which I will carefully dip the sensor 2x and take it out again. Above you have already seen the output of the script that monitors the sensor.
What can you use the whole thing for now? One possibility would be to link this to an email output and thus monitor your favorite flower or flower pot to see if the potting soil is still moist enough. Of course, the same goes for the lawn in your backyard. You can also use this soil moisture sensor very well for that.
By the way, there are also soil moisture sensors with which you can measure even more filigree. These sensors give even more delicate values than mine. This sensor in the example at least recognizes whether it is damp or not.
What would you like to measure with it now?
Raspberry Pi Sensor: Light Module
We want to connect the light sensitivity sensor to the Raspberry Pi. For this we need three connection cables. We need the connections VCC, GND and DO. There is nothing more.
So once connect the power supply, ground and the digital output for the data. Now connect the Raspberry Pi to power and then let's see the module in action once.
For the light sensitivity module I wrote a Python script that reads the data at PIN 21 of the Raspberry Pi and looks what value it has. You can find the script in the login area at www.raspi-config.de/mitgliederbereich. If the script has the value 0, then the light is on. If it has the value 1, then the light is off.
This script runs all the time on the Raspberry Pi and monitors if there is a change on the PIN's 21 value. We have the power LED on one side of the Raspberry Pi sensor, which simply indicates that power is being supplied to the module. The other is a sort of control diode where you can see the state that is being transmitted.
When executing the script via Thonny, you can see the output from the script in the lower half of the screen.
Raspberry Pi Sensor Light Module Script
This is a practical option if you have lights that are not internet-enabled. Then you can easily check that with this. But there are also many other different variants for using this Raspberry Pi Sensor practically in everyday and professional life.
Raspberry Pi Sensor: Laser Module
I assembled the design from both modules to make a light barrier. On one side on the wooden rod is the laser diode, which is pointed at the light sensitivity sensor on the other side. The idea is that the light sensitivity sensor detects when someone passes through the light barrier.
Raspberry Pi Sensor Laser and Light Module
It's best to watch the video at www.raspi-config.com to better understand how to connect the cables. We attached the light sensitivity sensor to the wooden stick as shown in the picture. We connect the light sensitivity sensor again normally.
Then we attached the light emitting diode to the wooden stick. The light emitting diode has two cables that need to be connected to the Raspberry Pi. One cable for the power supply and one cable for the ground connection. Now you have to connect these two cables.
For this I connect the 3,3 Volt (not 5 Volt). After that the ground for the light emitting diode. If you now connect the Raspberry Pi to the power, the light emitting diode would be on directly, because the power pins have a continuous power supply.
Now let's take a look at the photoelectric sensor in action. For this, I'll again use the Python script, which I already used for the light sensitivity sensor. You can download the script at www.raspi-config.de/mitgliederbereich. Because we read the data from the light sensitivity sensor again.
In this example, of course, it's only built on a very short distance. Theoretically you could also use the laser across a room or over a distance of one meter or more. However, the further away you get, the harder it is to hit the small sensor on the module.
In my setup I hold a wooden stick between the light barrier. You see in the video now the output from the Python script that the whole thing was detected. And if I go up again with the wooden stick, then the light at the sensor is there again.
So you could build a light barrier with this laser diode in combination with the light sensitivity sensor. This is just another example for the use of Raspberry Pi sensors.
Do you have any ideas what you want to do with Raspberry Pi sensors?
Quick Overview Raspberry Pi Sensor Kits:
Raspberry Pi Sensors Kit with 39 sensors from Quimat (Link)*.
What would you like to do next?
Raspberry Pi News