diff --git a/How to Interface Arduino with an Ultrasonic Sensor/Code/UltrasonicSensor/UltrasonicSensor.ino b/How to Interface Arduino with an Ultrasonic Sensor/Code/UltrasonicSensor/UltrasonicSensor.ino new file mode 100644 index 0000000..79af39b --- /dev/null +++ b/How to Interface Arduino with an Ultrasonic Sensor/Code/UltrasonicSensor/UltrasonicSensor.ino @@ -0,0 +1,26 @@ +const int trigPin = 4; // Trigger pin of the ultrasonic sensor (connected to Arduino digital pin 2) +const int echoPin = 5; // Echo pin of the ultrasonic sensor (connected to Arduino digital pin 3) +void setup() { + Serial.begin(9600); // Initialize serial communication for debugging + pinMode(trigPin, OUTPUT); + pinMode(echoPin, INPUT); +} +void loop() { + // Trigger the ultrasonic sensor by sending a 10us pulse + digitalWrite(trigPin, LOW); + delayMicroseconds(2); + digitalWrite(trigPin, HIGH); + delayMicroseconds(10); + digitalWrite(trigPin, LOW); + // Measure the time it takes for the echo to return + long duration = pulseIn(echoPin, HIGH); + // Calculate the distance in centimeters + // Speed of sound in air at room temperature is approximately 343 meters/second or 0.0343 cm/microsecond + // Divide the duration by 2 to account for the time it takes for the sound pulse to travel to the object and back + int distance = duration * 0.0343 / 2; + // Print the distance to the Serial Monitor + Serial.print("Distance: "); + Serial.print(distance); + Serial.println(" cm"); + delay(1000); // Delay for readability (adjust as needed) +} diff --git a/How to Interface Arduino with an Ultrasonic Sensor/Code/UltrasonicSensorLCD/UltrasonicSensorLCD.ino b/How to Interface Arduino with an Ultrasonic Sensor/Code/UltrasonicSensorLCD/UltrasonicSensorLCD.ino new file mode 100644 index 0000000..2c75cab --- /dev/null +++ b/How to Interface Arduino with an Ultrasonic Sensor/Code/UltrasonicSensorLCD/UltrasonicSensorLCD.ino @@ -0,0 +1,32 @@ +#include +#include +LiquidCrystal_I2C lcd(0x27,16,2); +const int trig=4; +const int echo=5; +void setup() { + // put your setup code here, to run once: + lcd.begin(); + lcd.backlight(); + lcd.print("Distance : "); + pinMode(trig,OUTPUT); + pinMode(echo,INPUT); + Serial.begin(9600); +} +void loop() { + // put your main code here, to run repeatedly: + digitalWrite(trig,LOW); + delay(2); + digitalWrite(trig,HIGH); + delay(10); + digitalWrite(trig,LOW); + long duration = pulseIn(echo,HIGH); + long distance=duration*0.034/2; //speed of sound=340 m/s =0.034 cm/microsecond. + lcd.setCursor(10,0); + lcd.print(" "); + lcd.setCursor(10,0); + lcd.print(distance); + Serial.print("Distance : "); + Serial.println(distance); + Serial.print(" cm") + delay(10); +} diff --git a/How to Interface Arduino with an Ultrasonic Sensor/Images/Arduino Ultrasonics Sensor.png b/How to Interface Arduino with an Ultrasonic Sensor/Images/Arduino Ultrasonics Sensor.png new file mode 100644 index 0000000..c9f267e Binary files /dev/null and b/How to Interface Arduino with an Ultrasonic Sensor/Images/Arduino Ultrasonics Sensor.png differ diff --git a/How to Interface Arduino with an Ultrasonic Sensor/Readme.md b/How to Interface Arduino with an Ultrasonic Sensor/Readme.md new file mode 100644 index 0000000..0811757 --- /dev/null +++ b/How to Interface Arduino with an Ultrasonic Sensor/Readme.md @@ -0,0 +1,24 @@ +# [Interfacing Ultrasonic Sensor with Arduino](https://circuitdigest.com/microcontroller-projects/interface-arduino-with-ultrasonic-sensor) +alt_text + +
+ +
+circuitdigest +
+ +[

Click here](https://circuitdigest.com/tags/arduino) for the complete tutorials on Arduino basics.

+ + +
+
+ +n this tutorial, we'll guide you through interfacing an Arduino with an ultrasonic sensor to measure distance and show it on the Serial monitor. We'll start by explaining how to interface the ultrasonic sensor, and then we'll add the I2C LCD display to the project at the end. + +
+
+[Note: As this projects are very simple we are only providing the code, schemaitic, and a few essential images if you want to get the images or code explanations do check out the Circuit Digest website. +
+
+ + diff --git a/Interfacing Contactless Liquid-Level Sensor with Arduino/Artboard 1.jpg b/Interfacing Contactless Liquid-Level Sensor with Arduino/Artboard 1.jpg new file mode 100644 index 0000000..e8a1eee Binary files /dev/null and b/Interfacing Contactless Liquid-Level Sensor with Arduino/Artboard 1.jpg differ diff --git a/Interfacing Contactless Liquid-Level Sensor with Arduino/Contactless_Liquid_Level_Sensor/Contactless_Liquid_Level_Sensor.ino b/Interfacing Contactless Liquid-Level Sensor with Arduino/Contactless_Liquid_Level_Sensor/Contactless_Liquid_Level_Sensor.ino new file mode 100644 index 0000000..5f62a69 --- /dev/null +++ b/Interfacing Contactless Liquid-Level Sensor with Arduino/Contactless_Liquid_Level_Sensor/Contactless_Liquid_Level_Sensor.ino @@ -0,0 +1,16 @@ +int SensePin = 2; //Sensor input +void setup() { + Serial.begin(9600); + pinMode(SensePin, INPUT); +} + +void loop() { + if(digitalRead(SensePin)) { + Serial.println("Liquid Detected"); + } + else { + Serial.println("No Liquid Available"); + } + + delay(1000); +} diff --git a/Interfacing Contactless Liquid-Level Sensor with Arduino/GIF-(Contactless-liquid-sensor).gif b/Interfacing Contactless Liquid-Level Sensor with Arduino/GIF-(Contactless-liquid-sensor).gif new file mode 100644 index 0000000..51d460d Binary files /dev/null and b/Interfacing Contactless Liquid-Level Sensor with Arduino/GIF-(Contactless-liquid-sensor).gif differ diff --git a/Interfacing Contactless Liquid-Level Sensor with Arduino/README.md b/Interfacing Contactless Liquid-Level Sensor with Arduino/README.md new file mode 100644 index 0000000..9ac78bf --- /dev/null +++ b/Interfacing Contactless Liquid-Level Sensor with Arduino/README.md @@ -0,0 +1,21 @@ +# [Interfacing Contactless Liquid Level Sensor with Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-contactless-liquid-level-sensor-with-arduino) + +alt_text +
+ +
+circuitdigest +
+ +[

Click here](https://circuitdigest.com/tags/arduino) for the complete tutorials on Arduino basics.

+ + +
+
+
+You might have seen there are many types of liquid-level sensors available on the market. They are mostly used in automatic pump controls and industrial applications. The most common type of sensors that were used were the float switch type sensor or the conductive sensors. Even though they were used commercially each type comes with its own problems. For example, the float-type sensor can get stuck and give a false reading, and the major issues faced by the conductive-type sensor are corrosion corrosion and electrical interference. This is where the contactless sensors come in handy. Since they don’t have any moving parts, we don’t need to worry about them getting stuck and since they are contactless we don’t need to worry about corrotion. There are many types of contactless sensors available in the market, including capacitive sensors, ultrasonic sensors, radar sensors and optical sensors. In this article, we are going to look at a capacitive contactless liquid-level sensor XKC-Y26-V. We will go through its features and we will also see how to interface it with an Arduino. +
+[Note: As this projects are very simple we are only providing the code, schemaitic, and a few essential images if you want to get the images or code explanations do check out the Circuit Digest website. +
+
+ diff --git a/Interfacing Contactless Liquid-Level Sensor with Arduino/Schematics.png b/Interfacing Contactless Liquid-Level Sensor with Arduino/Schematics.png new file mode 100644 index 0000000..876425b Binary files /dev/null and b/Interfacing Contactless Liquid-Level Sensor with Arduino/Schematics.png differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Code/MAX4466/MAX4466.ino b/Interfacing MAX4466 microphone amplifier module with Arduino/Code/MAX4466/MAX4466.ino new file mode 100644 index 0000000..1fd6877 --- /dev/null +++ b/Interfacing MAX4466 microphone amplifier module with Arduino/Code/MAX4466/MAX4466.ino @@ -0,0 +1,31 @@ +const int sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz) +int const Input_Pin = A0; // Preamp output pin connected to A0 +unsigned int ADC_Value; +void setup() { + Serial.begin(9600); +} + +void loop() { + unsigned long startMillis = millis(); // Start of sample window + + unsigned int PeakValue = 0; // peak-to-peak level + unsigned int InMax = 0; + unsigned int InMin = 1024; + // collect data for 50 mS and then plot data + while (millis() - startMillis < sampleWindow) { + ADC_Value = analogRead(Input_Pin); + if (ADC_Value < 1024) // toss out spurious readings + { + if (ADC_Value > InMax) { + InMax = ADC_Value; // save just the max levels + } else if (ADC_Value < InMin) { + InMin = ADC_Value; // save just the min levels + } + } + } + PeakValue = InMax - InMin; // max - min = peak-peak amplitude + if (PeakValue < 30) { + PeakValue = 0; + } + Serial.println(PeakValue); +} diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Images/GIF.gif b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/GIF.gif new file mode 100644 index 0000000..c715527 Binary files /dev/null and b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/GIF.gif differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 ( PartsMarking).jpg b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 ( PartsMarking).jpg new file mode 100644 index 0000000..10eaeb3 Binary files /dev/null and b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 ( PartsMarking).jpg differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Arduino connection.png b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Arduino connection.png new file mode 100644 index 0000000..5c427e9 Binary files /dev/null and b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Arduino connection.png differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Mic Amp Schematics.png b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Mic Amp Schematics.png new file mode 100644 index 0000000..fa5aa37 Binary files /dev/null and b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Mic Amp Schematics.png differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Module.png b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Module.png new file mode 100644 index 0000000..a13da99 Binary files /dev/null and b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/MAX4466 Module.png differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Images/Max4466 Module ( Pinout)-01.jpg b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/Max4466 Module ( Pinout)-01.jpg new file mode 100644 index 0000000..785504c Binary files /dev/null and b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/Max4466 Module ( Pinout)-01.jpg differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/Images/Title Image.png b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/Title Image.png new file mode 100644 index 0000000..5b94ccd Binary files /dev/null and b/Interfacing MAX4466 microphone amplifier module with Arduino/Images/Title Image.png differ diff --git a/Interfacing MAX4466 microphone amplifier module with Arduino/README.md b/Interfacing MAX4466 microphone amplifier module with Arduino/README.md new file mode 100644 index 0000000..4bfdae5 --- /dev/null +++ b/Interfacing MAX4466 microphone amplifier module with Arduino/README.md @@ -0,0 +1,21 @@ +# [Interfacing MAX4466 microphone amplifier module with Arduino](https://circuitdigest.com/microcontroller-projects/) + +alt_text +
+ +
+circuitdigest +
+ +[

Click here](https://circuitdigest.com/tags/arduino) for the complete tutorials on Arduino basics.

+ + +
+
+ +As you may know many of our everyday appliances or devices such as smartphones, home automation systems, smart speakers, headphones and many others have their own built-in microphones to capture the audio data. And if we look at them there are different types of microphones available, such as condenser, ribbon, dynamic and MEMS. The most modern devices like smartphones use MEMS microphones for better sensitivity. But the problem with them is that they are digital and will need digital processing to get the audio out of them. The analog-type microphones have been there for decades and they can be found from cheap toys to high-end studio setups. Among the analog type microphones, the most popular one would be the condenser microphone, they are cheap and easy to interface. But since their output signal is very weak we will need to do some amplification to the signal before using it. That's where microphone amplifiers come into play. So in this article, we will look into such a microphone amplifier module mashed on the MAX4466 IC, which offers an adjustable gain, and how to interface it with an Arduino. +
+[Note: As this projects are very simple we are only providing the code, schemaitic, and a few essential images if you want to get the images or code explanations do check out the Circuit Digest website. +
+
+ diff --git a/Interfacing OLED Display with Arduino/Code/Arduino_OLED/Arduino_OLED.ino b/Interfacing OLED Display with Arduino/Code/Arduino_OLED/Arduino_OLED.ino new file mode 100644 index 0000000..27c40ed --- /dev/null +++ b/Interfacing OLED Display with Arduino/Code/Arduino_OLED/Arduino_OLED.ino @@ -0,0 +1,168 @@ +#include +#include +#include +#include + +#define SCREEN_WIDTH 128 // OLED display width, in pixels +#define SCREEN_HEIGHT 64 // OLED display height, in pixels + +// Declaration for SSD1306 display connected using I2C +#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin) +#define SCREEN_ADDRESS 0x3C +Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET); + +// Declaration for SSD1306 display connected using software SPI: +//#define OLED_MOSI 9 +//#define OLED_CLK 10 +//#define OLED_DC 11 +//#define OLED_CS 12 +//#define OLED_RESET 13 +//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); + +void setup() +{ + Serial.begin(9600); + + // initialize the OLED object + if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { + Serial.println(F("SSD1306 allocation failed")); + for(;;); // Don't proceed, loop forever + } + + // Uncomment this if you are using SPI + //if(!display.begin(SSD1306_SWITCHCAPVCC)) { + // Serial.println(F("SSD1306 allocation failed")); + // for(;;); // Don't proceed, loop forever + //} + +// Clear the buffer. + display.clearDisplay(); + // Display Text + display.setTextSize(1); + display.setTextColor(WHITE); + display.setCursor(0, 28); + display.println("Hello world!"); + display.display(); + delay(2000); + display.clearDisplay(); + // Display Inverted Text + display.setTextColor(BLACK, WHITE); // 'inverted' text + display.setCursor(0, 28); + display.println("Hello world!"); + display.display(); + delay(2000); + display.clearDisplay(); + // Changing Font Size + display.setTextColor(WHITE); + display.setCursor(0, 24); + display.setTextSize(2); + display.println("Hello!"); + display.display(); + delay(2000); + display.clearDisplay(); + // Display Numbers + display.setTextSize(1); + display.setCursor(0, 28); + display.println(123456789); + display.display(); + delay(2000); + display.clearDisplay(); + // Specifying Base For Numbers + display.setCursor(0, 28); + display.print("0x"); display.print(0xFF, HEX); + display.print("(HEX) = "); + display.print(0xFF, DEC); + display.println("(DEC)"); + display.display(); + delay(2000); + display.clearDisplay(); + // Display ASCII Characters + display.setCursor(0, 24); + display.setTextSize(2); + display.write(1); + display.display(); + delay(2000); + display.clearDisplay(); + // Scroll full screen + display.setCursor(0, 0); + display.setTextSize(1); + display.println("Full"); + display.println("screen"); + display.println("scrolling!"); + display.display(); + display.startscrollright(0x00, 0x07); + delay(4500); + display.stopscroll(); + delay(1000); + display.startscrollleft(0x00, 0x07); + delay(4500); + display.stopscroll(); + delay(1000); + display.startscrolldiagright(0x00, 0x07); + delay(4500); + display.startscrolldiagleft(0x00, 0x07); + delay(4500); + display.stopscroll(); + display.clearDisplay(); + //draw rectangle + display.setTextSize(1); + display.setTextColor(WHITE); + display.setCursor(0, 0); + display.println("Rectangle"); + display.drawRect(0, 15, 60, 40, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); + //draw filled rectangle + display.setCursor(0, 0); + display.println("Filled Rectangle"); + display.fillRect(0, 15, 60, 40, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); + //draw rectangle with rounded corners + display.setCursor(0, 0); + display.println("Round Rectangle"); + display.drawRoundRect(0, 15, 60, 40, 8, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); + //draw filled rectangle with rounded corners + display.setCursor(0, 0); + display.println("Filled Round Rectangle"); + display.fillRoundRect(0, 15, 60, 40, 8, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); + //draw circle + display.setCursor(0, 0); + display.println("Circle"); + display.drawCircle(20, 35, 20, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); + //draw filled circle + display.setCursor(0, 0); + display.println("Filled Circle"); + display.fillCircle(20, 35, 20, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); + //draw triangle + display.setCursor(0, 0); + display.println("Triangle"); + display.drawTriangle(30, 15, 0, 60, 60, 60, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); + //draw filled triangle + display.setCursor(0, 0); + display.println("Filled Triangle"); + display.fillTriangle(30, 15, 0, 60, 60, 60, WHITE); + display.display(); + delay(2000); + display.clearDisplay(); +} + +void loop() { +} \ No newline at end of file diff --git a/Interfacing OLED Display with Arduino/Images/Arduino-interfacing-with-Monochrome-SSD1306-OLED-display.jpg b/Interfacing OLED Display with Arduino/Images/Arduino-interfacing-with-Monochrome-SSD1306-OLED-display.jpg new file mode 100644 index 0000000..f9e22a1 Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/Arduino-interfacing-with-Monochrome-SSD1306-OLED-display.jpg differ diff --git a/Interfacing OLED Display with Arduino/Images/I2C OLED Module Parts Marking.png b/Interfacing OLED Display with Arduino/Images/I2C OLED Module Parts Marking.png new file mode 100644 index 0000000..378be79 Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/I2C OLED Module Parts Marking.png differ diff --git a/Interfacing OLED Display with Arduino/Images/I2C OLED Module Pinout.png b/Interfacing OLED Display with Arduino/Images/I2C OLED Module Pinout.png new file mode 100644 index 0000000..32542bd Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/I2C OLED Module Pinout.png differ diff --git a/Interfacing OLED Display with Arduino/Images/I2C OLED Module Schematic.png b/Interfacing OLED Display with Arduino/Images/I2C OLED Module Schematic.png new file mode 100644 index 0000000..c8863ea Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/I2C OLED Module Schematic.png differ diff --git a/Interfacing OLED Display with Arduino/Images/SPI OLED Module Circuit.png b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Circuit.png new file mode 100644 index 0000000..c880093 Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Circuit.png differ diff --git a/Interfacing OLED Display with Arduino/Images/SPI OLED Module Parts Marking.png b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Parts Marking.png new file mode 100644 index 0000000..f2a0c65 Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Parts Marking.png differ diff --git a/Interfacing OLED Display with Arduino/Images/SPI OLED Module Pinout.png b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Pinout.png new file mode 100644 index 0000000..58b87a3 Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Pinout.png differ diff --git a/Interfacing OLED Display with Arduino/Images/SPI OLED Module Schematic.png b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Schematic.png new file mode 100644 index 0000000..7db568b Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/SPI OLED Module Schematic.png differ diff --git a/Interfacing OLED Display with Arduino/Images/batman-logo-on-Monochrome-7-pin-SSD1306-0.96-OLED-display.jpg b/Interfacing OLED Display with Arduino/Images/batman-logo-on-Monochrome-7-pin-SSD1306-0.96-OLED-display.jpg new file mode 100644 index 0000000..9ad09ea Binary files /dev/null and b/Interfacing OLED Display with Arduino/Images/batman-logo-on-Monochrome-7-pin-SSD1306-0.96-OLED-display.jpg differ diff --git a/Interfacing Soil Moisture Sensor with Arduino/README.md b/Interfacing Soil Moisture Sensor with Arduino/README.md index 4770069..ee18555 100644 --- a/Interfacing Soil Moisture Sensor with Arduino/README.md +++ b/Interfacing Soil Moisture Sensor with Arduino/README.md @@ -1,23 +1,13 @@ -# [ How Does a Soil Moisture Sensor Work and how to use it with Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-soil-moisture-sensor-with-arduino-uno) +# [How Does a Soil Moisture Sensor Work and how to use it with Arduino](https://circuitdigest.com/microcontroller-projects/interfacing-soil-moisture-sensor-with-arduino-uno) -alt_text -
+![Soil Moisture Sensor with Arduino](https://github.com/Circuit-Digest/Basic-Arduino-Tutorials-for-Beginners-/blob/main/Interfacing%20Soil%20Moisture%20Sensor%20with%20Arduino/images/interfacing_soil_moisture_sensor_modue_with_arduino.png) -
-circuitdigest -
+[![circuitdigest](https://img.shields.io/static/v1?label=&labelColor=505050&message=Arduino%20Soil%20Moisture%20Sensor%20Working&color=%230076D6&style=social&logo=google-chrome&logoColor=%230076D6)](https://circuitdigest.com/microcontroller-projects/interfacing-soil-moisture-sensor-with-arduino-uno) -[

Click here](https://circuitdigest.com/tags/arduino) for the complete tutorials on Arduino basics.

+[Click here](https://circuitdigest.com/tags/arduino) for the complete tutorials on Arduino basics. - -
-
The soil moisture sensor is the first thing that springs to mind when it comes to building your smart irrigation system or automatic plant watering system. With this sensor in place and a little Arduino support, we can design a system that can water your plants when it's needed, avoiding overwatering and underwatering. -In this article, we are going to interface the soil moisture sensor with an arduino and measure the volumetric concentration of water inside the soil. This sensor is designed in a way that it can output data in both digital and analog modes. We will read this data and display the output status with an LED for digital output and we will use the serial monitor or an LED with PWM for analog output. So without further ado let's get right into it. -
-
-Note: As this projects are very simple we are only providing the code, schemaitic, and a few essential images if you want to get the images or code explanations do check out the Circuit Digest website. -
-
+In this article, we are going to interface the soil moisture sensor with an Arduino and measure the volumetric concentration of water inside the soil. This sensor is designed in a way that it can output data in both digital and analog modes. We will read this data and display the output status with an LED for digital output and we will use the serial monitor or an LED with PWM for analog output. So without further ado let's get right into it. +Note: As these projects are very simple, we are only providing the code, schematic, and a few essential images. If you want to get the images or code explanations, do check out the Circuit Digest website. diff --git a/MAX30102 Heart Rate Sensor/README.md b/MAX30102 Heart Rate Sensor/README.md index e69de29..f4427a4 100644 --- a/MAX30102 Heart Rate Sensor/README.md +++ b/MAX30102 Heart Rate Sensor/README.md @@ -0,0 +1,2 @@ +![image](https://github.com/Circuit-Digest/Basic-Arduino-Tutorials-for-Beginners-/assets/65025308/d147a6a7-bbec-434b-8033-45b1d39d1c88) +Full Tutorial: https://circuitdigest.com/microcontroller-projects/how-max30102-pulse-oximeter-and-heart-rate-sensor-works-and-how-to-interface-with-arduino diff --git a/Rain Detection Sensor with Arduino/README.md b/Rain Detection Sensor with Arduino/README.md index e69de29..19b4be9 100644 --- a/Rain Detection Sensor with Arduino/README.md +++ b/Rain Detection Sensor with Arduino/README.md @@ -0,0 +1,7 @@ +![image](https://github.com/Circuit-Digest/Basic-Arduino-Tutorials-for-Beginners-/assets/65025308/03854575-6320-4f82-ab2f-0a4e805c7c89) + +Full Tutorial: https://circuitdigest.com/microcontroller-projects/interfacing-flex-sensor-with-arduino + +A flex sensor is a low-cost, easy-to-use variable resistor that is designed to measure the amount of deflection it experiences when bent. The sensor's resistance is lowest when it's flat on the surface, increases when we bend it slowly and reaches its maximum when it's at a 90-degree angle. + +![image](https://github.com/Circuit-Digest/Basic-Arduino-Tutorials-for-Beginners-/assets/65025308/35d45d95-0c26-4f99-aa57-2fd66b727328) diff --git a/Remote Plant Watering System via Mobile App/Arduino UNO R4 WiFi.jpg b/Remote Plant Watering System via Mobile App/Arduino UNO R4 WiFi.jpg new file mode 100644 index 0000000..7c6e83e Binary files /dev/null and b/Remote Plant Watering System via Mobile App/Arduino UNO R4 WiFi.jpg differ diff --git a/Remote Plant Watering System via Mobile App/README.MD b/Remote Plant Watering System via Mobile App/README.MD new file mode 100644 index 0000000..b832b0b --- /dev/null +++ b/Remote Plant Watering System via Mobile App/README.MD @@ -0,0 +1,27 @@ +Remote Plant Watering System via Mobile App +# [Remote Plant Watering System via Mobile App with Arduino Uno R4 WiFi](https://circuitdigest.com/microcontroller-projects/) + +alt_text +
+ +
+circuitdigest +
+ +[

Click here](https://circuitdigest.com/tags/arduino) for the complete tutorials on Arduino basics.

+ + +
+
+In our busy day-to-day life, sometimes we may forget to water the plants in our garden. After leaving home only we came to know about that, Oh no! We forgot to water our plants. Most of the time, I made this mistake and later I blamed myself and it makes me think about, how it feels if we water our plants from anywhere in the world. After brainstorming and surfing the internet, I found it almost easy to water our plants remotely in this modern IoT era. The revolution of IoT gave life to our imaginary thoughts and made them live in the real world. + +So, in order to convert my thoughts into action. I created a checklist to determine what things I need for this project. Most obviously I need an electric pump to water the plants, to control the pump, I need a microcontroller. For Microcontroller I decided to pick Arduino UNO R4 WIFI because it has the most powerful RA4M1 microprocessor from Renesas with the ESP32-S3 from Espressif. With its wifi capability, we can provide internet access to the microcontroller, which is mandatory in order to access the microcontroller remotely. + +Later this microcontroller had an inbuilt 12*8 led matrix, so I could display the plant's expressions on it. Finally, I need an analog soil moisture sensor, so that I can monitor the soil moisture and based on that I can able to switch on/off the water pump remotely through the Blynk app. + +
+
+[Note: As this project is very simple we are only providing the code, schematics, and a few essential images if you want to get the images or code explanations do check out the Circuit Digest website. +
+
+ diff --git a/Remote Plant Watering System via Mobile App/Remote Plant Watering System via Mobile App.ino b/Remote Plant Watering System via Mobile App/Remote Plant Watering System via Mobile App.ino new file mode 100644 index 0000000..400592c --- /dev/null +++ b/Remote Plant Watering System via Mobile App/Remote Plant Watering System via Mobile App.ino @@ -0,0 +1,147 @@ +/************************************************************* + Blynk is a platform with iOS and Android apps to control + ESP32, Arduino, Raspberry Pi and the likes over the Internet. + You can easily build mobile and web interfaces for any + projects by simply dragging and dropping widgets. + + Downloads, docs, tutorials: https://www.blynk.io + Sketch generator: https://examples.blynk.cc + Blynk community: https://community.blynk.cc + Follow us: https://www.fb.com/blynkapp + https://twitter.com/blynk_app + + Blynk library is licensed under MIT license + This example code is in public domain. + + ************************************************************* + This example shows how to use Arduino WiFi shield + to connect your project to Blynk. + + Please update your shield firmware: + https://www.arduino.cc/en/Hacking/WiFiShieldFirmwareUpgrading + + Feel free to apply it to any other example. It's simple! + *************************************************************/ + +/* Comment this out to disable prints and save space */ +//#define BLYNK_PRINT Serial + +/* Fill in information from Blynk Device Info here */ +#define BLYNK_TEMPLATE_ID "TMPL395_vACHb" +#define BLYNK_TEMPLATE_NAME "IOT WATERING APP" +#define BLYNK_AUTH_TOKEN "FobMj5rwZ9iHdBIWlOVeu2JosNcl-lDh" + +#include +#include +#include +#include "Arduino_LED_Matrix.h" +#include + +#define moisture_sensor A0 +#define relay 7 + +BlynkTimer timer; +ArduinoLEDMatrix matrix; //Create an led matrix object + +// Your WiFi credentials. +// Set password to "" for open networks. +char ssid[] = "Semicon Media"; +char pass[] = "cracksen1605"; + +int eeprom_addr = 0; //eeprom address +int sensorValue = 0; // variable to store the value coming from the sensor +int prev_pump_status = 0; +int pump_status = 0; +float moist_percent = 0.00; + + + +const uint32_t HAPPY_LED[] = { + 0x3fc48a95, + 0x58019fd9, + 0x5889871 +}; + +const uint32_t NORMAL_LED[] = { + 0x3fc40298, + 0xd98d8019, + 0x5889871 +}; + +const uint32_t SAD_LED[] = { + 0x3fc48a9d, + 0xd8898018, + 0x71889905 +}; + + +BLYNK_WRITE(V1){ //read data from Blynk cloud + pump_status = param.asInt(); + EEPROM.write(eeprom_addr,pump_status); + prev_pump_status = EEPROM.read(eeprom_addr); + Serial.println(prev_pump_status); + Serial.println(pump_status); +} + +void sendSensor(){ //send data to Blynk cloud + Blynk.virtualWrite(V0,moist_percent); +} + +void init_renesas_MCU_IO(){ + pinMode(relay, OUTPUT); + pinMode(moisture_sensor, INPUT); + analogReadResolution(12); //change to 12-bit resolution + matrix.begin(); //initialise the led matrix*/ +} + +void track_soil_moisture(){ + + // read the value from the sensor: + sensorValue = analogRead(moisture_sensor); + moist_percent = 100 - ((float)sensorValue / 4096.0) * 100; + + if(moist_percent >= 0 && moist_percent < 33.33){ + Serial.println("DRY"); + matrix.loadFrame(SAD_LED); + } + else if(moist_percent >= 33.33 && moist_percent < 66.66){ + Serial.println("MODERATE"); + matrix.loadFrame(NORMAL_LED); + } + else if(moist_percent >= 66.66 && moist_percent <= 100){ + Serial.println("WET"); + matrix.loadFrame(HAPPY_LED); + } +} + +void setup() +{ + // Debug console + Serial.begin(9600); + + Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass); + + init_renesas_MCU_IO(); + + timer.setInterval(1000L,sendSensor); + + prev_pump_status = EEPROM.read(eeprom_addr); + pump_status = prev_pump_status; +} + +void loop() +{ + Blynk.run(); + timer.run(); + + track_soil_moisture(); + if(pump_status == 0){ + Serial.println("Water pump is off"); + digitalWrite(relay, LOW); + } + else if(pump_status == 1){ + Serial.println("Water pump is on"); + digitalWrite(relay,HIGH); + } + delay(500); +} diff --git a/Remote Plant Watering System via Mobile App/Remote Plant Watering System via Mobile AppCircuit diagram.jpg b/Remote Plant Watering System via Mobile App/Remote Plant Watering System via Mobile AppCircuit diagram.jpg new file mode 100644 index 0000000..5529cb0 Binary files /dev/null and b/Remote Plant Watering System via Mobile App/Remote Plant Watering System via Mobile AppCircuit diagram.jpg differ diff --git a/Remote Plant Watering System via Mobile App/Title Image.jpg b/Remote Plant Watering System via Mobile App/Title Image.jpg new file mode 100644 index 0000000..88e6e5a Binary files /dev/null and b/Remote Plant Watering System via Mobile App/Title Image.jpg differ