BLOG · 12/4/2023
the post is about the report of the provided any 9 common task out of 15 is available here
Arduino is an open-source electronic platform based on the ATmega328 8-bit microcontroller. It can read input from various sensors and send instructions to control outputs. The Arduino IDE allows us to write code and interface hardware like Arduino boards and sensors.
An ultrasonic sensor measures the distance between the sensor and an object without physical contact. It uses time-to-distance conversion based on the speed of sound.
Ultrasonic sensors work by emitting sound waves and receiving the echo from a reflected surface.
Distance = Speed × Time
The speed of sound in air is approximately 344 m/s.
In the code:
duration
stores the total time for the sound wave to travel to the object and back.Distance = (Speed of Sound × Time) / 2
#include
LiquidCrystal_I2C lcd(0x20, 16, 2);
#define echoPin 2
#define trigPin 3
long duration;
int distance;
void setup() {
lcd.init();
lcd.backlight();
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
Serial.begin(9600);
Serial.println("Distance measurement using Arduino Uno");
delay(500);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.0344 / 2;
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Distance:");
lcd.setCursor(0, 1);
lcd.print(distance);
lcd.setCursor(4, 1);
lcd.print("cm");
delay(100);
}
We can control the speed of a DC motor by varying its input voltage using Arduino and L298N Motor Driver.
The L298N is a dual H-bridge driver allowing control of speed and direction of two DC motors.
#define enA 9
#define in1 6
#define in2 7
#define button 4
int rotDirection = 0;
bool pressed = false;
void setup() {
pinMode(enA, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(button, INPUT);
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
}
void loop() {
int potValue = analogRead(A0);
int pwmOutput = map(potValue, 0, 1023, 0, 255);
analogWrite(enA, pwmOutput);
if (digitalRead(button)) {
pressed = !pressed;
while (digitalRead(button));
delay(20);
}
if (pressed && rotDirection == 0) {
digitalWrite(in1, HIGH);
digitalWrite(in2, LOW);
rotDirection = 1;
delay(20);
}
if (!pressed && rotDirection == 1) {
digitalWrite(in1, LOW);
digitalWrite(in2, HIGH);
rotDirection = 0;
delay(20);
}
}
3D printing is a process of creating a physical object from a digital model by depositing layers of material.
The process of converting STL into GCODE using slicer software like Ultimaker Cura or Creality Slicer.
A 555 Astable Multivibrator generates continuous pulses. It acts as a basic timer oscillator.
Duty Cycle = (R1 + R2) / (R1 + 2R2) * 100%
T1 = 0.693 × (R1 + R2) × C
T2 = 0.693 × R2 × C
Soldering is a method to join two metal surfaces using a melted alloy called solder.
⚠️ Caution: Do not touch tip when hot!