BLOG · 12/4/2023
the post is about the report of the provided any 9 common task out of 15 is available here
c++\n#include \nLiquidCrystal_I2C lcd(0x20, 16, 2); // Format -> (Addres Widt Height )\n#define echoPin 2 // attach pin D2 Arduino to Echo pin of Sensor module\n#define trigPin 3 // attach pin D3 Arduino to Trig pin of Sensor module\nlong duration; // Declare variable to store echo time duration\nint distance; // Declare variable to store the result (distance)\nvoid setup()\n{\nlcd.init(); // initialize the lcd\nlcd.backlight(); // Turn on the Backlight\npinMode(trigPi OUTPUT); // Sets the trigPin as an OUTPUT\npinMode(echoPin, INPUT); // Sets the echoPin as an INPUT\n// Serial Communication is starting with 9600 of baudrate speed\nSerial.begin(9600);\n// The text to be printed in serial monitor\nSerial.println(\Distance measurement using Arduino Uno\");\ndelay(500);\n}\nvoid loop()\n{\ndigitalWrite(trigPin, LOW);\ndelayMicroseconds(2);\ndigitalWrite(trigPin, HIGH);\ndelayMicroseconds(10);\ndigitalWrite(trigPin, LOW);\nduration = pulseIn(echoPin, HIGH);\ndistance = duration * 0.0344 / 2;\nSerial.print(\"Distance: \");\nSerial.print(distance);\nSerial.println(\" cm\");\nlcd.clear(); // Clear the display buffer\nlcd.setCursor(0, 0); // Set cursor for \"Distance:\" (Column, Row)\nlcd.print(\"Distance:\"); // print \"Distance:\" at (0, 0)\nlcd.setCursor( 1); // Set cursor for output value (0, 1)\nlcd.print(distance); // print Output in cm at (0, 1)\nlcd.setCursor(4, 1); // move cursor to (4, 1)\nlcd.print(\"cm\"); // print \"cm\" at (4, 1)\ndelay(100);\n} \n
\n## APPLICATION ULTRASONIC DISTANCE MEASURMENT SYSTEM :\n1. Used in RADAR system\n2. To measure distance without physical contact\nwith measuring instruments\n3. Used in object detection in security system\n\n\n\n\n\n### TASK- 2\n# SPEED CONTROL OF DC MOTOR\n\n## \nWe can control the speed of the DC motor by simply\ncontrolling its input voltage to the motor\n\n# SPEED CONTROL USING ARDUINO AND L298N MOTOR DRIVER :\n\n## Materials required\n1. 12V DC Motor\n2. L298N Motor deiver \n3. Power Supply\n4. Arduino\n5. Push BUtton\n6. Potentiometer\n\n## L298N MOTOR DRIVER :\n###\nThis is a dual H bridge motor driver which allows\nspeed direction control of two DC motors at the\nsame time .\nThe module can drive motor that have voltage\nbetween 5 and 35 V ,with a peak of current upto 2A\n\n\n c \n/* Arduino DC Motor Control - PWM | H-Bridge | L298N - \n*/\n#define enA 9\n#define in1 6\n#define in2 7\n#define button 4\nint rotDirection = 0;\nint pressed = false;\nvoid setup() {\npinMode(enA, OUTPUT);\npinMode(in1, OUTPUT);\npinMode(in2, OUTPUT);\npinMode(button, INPUT);\n// Set initial rotation direction\ndigitalWrite(in1, LOW);\ndigitalWrite(in2, HIGH);\n}\nvoid loop() {\nint potValue = analogRead(A0); // Read potentiometer value\nint pwmOutput = map(potValue, 0, 1023, 0 , 255); // Map the\npotentiometer value from 0 to 255\nanalogWrite(enA, pwmOutput); // Send PWM signal to L298N Enable\npin\n// Read button - Debounce\nif (digitalRead(button) == true) {\npressed = !pressed;\n}\nwhile (digitalRead(button) == true);\ndelay(20);\n// If button is pressed - change rotation direction\nif (pressed == true & rotDirection == 0) {\ndigitalWrite(in1, HIGH);\ndigitalWrite(in2, LOW);\nrotDirection = 1;\ndelay(20);\n}\n// If button is pressed - change rotation direction\nif (pressed == false & rotDirection == 1) {\ndigitalWrite(in1, LOW);\ndigitalWrite(in2, HIGH);\nrotDirection = 0;\ndelay(20);\n}\n}\n
\n## APPLICATION OF SPEED CONTROLLING OF DC MOTOR : \n1. Controlling the movement of robotic vehicle\n2. Movement of motors in paper mills\n3. Movement of the motors in escalators\n4. Other industrial use\n\n