Introduction
Hi, in this fourth blog, I would like to test the how of the XIAO SAMD21 works when we connect more than one sensor.
In previous works we have seen how this very small board can manage, ,one by one all 5 sensors included in the contest kit without any problem.
What I wondered from the first moment I saw the XIAO series boards was how such a small board and with so few terminals could be used with several sensors at the same time.
In this work I will use multiple sensors at the same time and I will try to manage them as best as possible.
The project I proposed was to monitor a home to avoid the risk of flooding, alarming the owners so they could save furniture and objects that could be damaged from the water.
The most important sensor in this case is a moisture sensor which will detect the presence of water on the ground and trigger an alarm. As we want our project to solve more than only one problem, we can also add a flame sensor which could be useful for giving an alarm in the event of a fire starting.
Moisture Sensor
This Moisture Senor is based on resistivity meansurement and can be used for detecting the moisture of soil or judge if there is water around the sensor. This sensor is very easy to use, you can just simply insert in into the soil or place it on the floor and read the data.
We will use the example code in sensor Wiki page: Grove-Moisture_Sensor.
int sensorPin = A0; int sensorValue = 0; void setup() { Serial.begin(9600); } void loop() { // read the value from the sensor: sensorValue = analogRead(sensorPin); Serial.print("Moisture = " ); Serial.println(sensorValue); delay(1000); }
As you can see, this sensor is really easy to use.
Seeed Studio Base Shield
To use multiple sensors with the XIAO SAMD21, it is essential, in my opinion, to have a board that allows you to connect many sensors and actuators without making the connections too complicated.
The Seeed XIAO SAMD21 is too small to think of filling it with jumpers, so I thought of using a Seeed Studio Base Shield which allows you to better manage the connections between the Xiao board and the sensors.
{gallery}Seeed Studio Base Shield |
---|
|
|
In the next blog we will see how to use the Seeed Studio Base Shield to easily connect multiple sensors at the same time.