INPUT DEVICES
GROUP ASSIGNMENTINDIVIDUAL ASSIGNMENT
MOISTURE SENSOR
For this week's assignment we were tasked to measure something, to plug in a sensor to a PCB we have previously designed. For this one I decided to use a moisture sensor which is normally used testing moisture content in the soil.

COMPONENTS USED
- PCB (DESIGNED ON WEEK 6)
- JUMPER WIRES
- SOIL MOISTURE SENSOR
I started off by connecting the sensor to analog pins in my board,

Then Arduino IDE was launched and then programmed the moisture to start taking readings and print them on the serial monitor. The code I used is shown below:
int sensorPin = A0;
int sensorValue;
void setup() {
Serial.begin(9600);
pinMode(sensorPin, INPUT); // Optional; analog pins default to INPUT
}
void loop() {
sensorValue = analogRead(sensorPin); // Read the analog value from the sensor
Serial.print("Moisture Reading: ");
Serial.println(sensorValue); // Print the value to Serial Monitor
delay(1000); // Optional: wait 1 second before next read
}
The moisture readings were printed in the serial monitor as shown below:
FILES