3 Days college workshop
The first workshop for college was held from 15th Sept 2022 to 17th Sept 2022 in which 12 students of Jawaharlal Institute of Technology, Borawan participated.
These students were from different departments. In this batch there were 2 students from Mechanical branch, 5 students of Electrical branch, 5 students of Electronic branch.
We made three different groups of students. There were 4 students in each group.
It was a three day workshop. In this, on the first day, information about the machines were given to the students and all the software related to it were taught to the students.
PROJECTS
This batch created three projects - 1. HOME AUTOMATION In this project we operated a bulb by motion. component Required 1.Arduino uno 2.PIR motion detector 3.Relay 4.2 LEDs 5. Bulb holder and Bulb Circuit Diagram
Code
int relay = 8; // the pin that the LED is atteched to
int sensor = 2; // the pin that the sensor is atteched to
int state = LOW; // by default, no motion detected
int val = 0; // variable to store the sensor status (value)
void setup() {
pinMode(relay, OUTPUT); // initalize LED as an output
pinMode(sensor, INPUT); // initialize sensor as an input
Serial.begin(9600); // initialize serial
}
void loop(){
val = digitalRead(sensor); // read sensor value
if (val == HIGH) { // check if the sensor is HIGH
digitalWrite(relay, HIGH); // turn LED ON
delay(500); // delay 100 milliseconds
if (state == LOW) {
Serial.println("Motion detected!");
state = HIGH; // update variable state to HIGH
}
}
else {
digitalWrite(relay, LOW); // turn LED OFF
delay(500); // delay 200 milliseconds
if (state == HIGH){
Serial.println("Motion stopped!");
state = LOW; // update variable state to LOW
}
}
}
2. Robot following Human
This robot follows our hand. its simple
Component Required
1.Arduino UNO
2. 2 IR Sensor
3. 2 BO Motor
4. Motor driver
5. Wheels x4
6.plywood piece
7.Ultrasonic Sensor
Circuit Diagram
Code
#include<NewPing.h>
#define MAX_FORWARD_MOTOR_SPEED 75
#define MAX_MOTOR_TURN_SPEED_ADJUSTMENT 50
#define MIN_DISTANCE 10
#define MAX_DISTANCE 30
#define IR_SENSOR_RIGHT 2
#define IR_SENSOR_LEFT 3
//Right motor
int enableRightMotor=5;
int rightMotorPin1=7;
int rightMotorPin2=8;
//Left motor
int enableLeftMotor=6;
int leftMotorPin1=9;
int leftMotorPin2=10;
NewPing mySensor(ULTRASONIC_SENSOR_TRIG, ULTRASONIC_SENSOR_ECHO, 400);
void setup()
{
// put your setup code here, to run once:
pinMode(enableRightMotor, OUTPUT);
pinMode(rightMotorPin1, OUTPUT);
pinMode(rightMotorPin2, OUTPUT);
pinMode(enableLeftMotor, OUTPUT);
pinMode(leftMotorPin1, OUTPUT);
pinMode(leftMotorPin2, OUTPUT);
pinMode(IR_SENSOR_RIGHT, INPUT);
pinMode(IR_SENSOR_LEFT, INPUT);
rotateMotor(0,0);
}
void loop()
{
int distance = mySensor.ping_cm();
int rightIRSensorValue = digitalRead(IR_SENSOR_RIGHT);
int leftIRSensorValue = digitalRead(IR_SENSOR_LEFT);
//NOTE: If IR sensor detects the hand then its value will be LOW else the value will be HIGH
//If right sensor detects hand, then turn right. We increase left motor speed and decrease the right motor speed to turn towards right
if (rightIRSensorValue == LOW && leftIRSensorValue == HIGH )
{
rotateMotor(MAX_FORWARD_MOTOR_SPEED – MAX_MOTOR_TURN_SPEED_ADJUSTMENT, MAX_FORWARD_MOTOR_SPEED + MAX_MOTOR_TURN_SPEED_ADJUSTMENT );
}
//If left sensor detects hand, then turn left. We increase right motor speed and decrease the left motor speed to turn towards left
else if (rightIRSensorValue == HIGH && leftIRSensorValue == LOW )
{
rotateMotor(MAX_FORWARD_MOTOR_SPEED + MAX_MOTOR_TURN_SPEED_ADJUSTMENT, MAX_FORWARD_MOTOR_SPEED – MAX_MOTOR_TURN_SPEED_ADJUSTMENT);
}
//If distance is between min and max then go straight
else if (distance >= MIN_DISTANCE && distance <= MAX_DISTANCE)
{
rotateMotor(MAX_FORWARD_MOTOR_SPEED, MAX_FORWARD_MOTOR_SPEED);
}
//stop the motors
else
{
rotateMotor(0, 0);
}
}
void rotateMotor(int rightMotorSpeed, int leftMotorSpeed)
{
if (rightMotorSpeed < 0) { digitalWrite(rightMotorPin1,LOW); digitalWrite(rightMotorPin2,HIGH); } else if (rightMotorSpeed > 0)
{
digitalWrite(rightMotorPin1,HIGH);
digitalWrite(rightMotorPin2,LOW);
}
else
{
digitalWrite(rightMotorPin1,LOW);
digitalWrite(rightMotorPin2,LOW);
}
if (leftMotorSpeed < 0) { digitalWrite(leftMotorPin1,LOW); digitalWrite(leftMotorPin2,HIGH); } else if (leftMotorSpeed > 0)
{
digitalWrite(leftMotorPin1,HIGH);
digitalWrite(leftMotorPin2,LOW);
}
else
{
digitalWrite(leftMotorPin1,LOW);
digitalWrite(leftMotorPin2,LOW);
}
analogWrite(enableRightMotor, abs(rightMotorSpeed));
analogWrite(enableLeftMotor, abs(leftMotorSpeed));
}
3. Water level detector
- Arduino UNO
- 5 Leds (2 red , 2 green , 1 yellow)
- 220 ohm resistor x5
- Ultrasonic Sensor
- Transistor 2N2222
- Jumper wire
Circuit Diagram
Code
#define trigpin 7
#define echopin 6
int led1 = A0;
int led2 = A1;
int led3 = A2;
int led4 = A3;
int led5 = A4;
void setup()
{
Serial.begin(9600);
pinMode(trigpin, OUTPUT);
pinMode(echopin, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
delay(1000);
}
void loop()
{
int duration, distance;
digitalWrite(trigpin, HIGH);
delayMicroseconds(1000);
digitalWrite(trigpin, LOW);
duration = pulseIn(echopin,HIGH);
distance = ( duration / 2) / 29.1;
Serial.println(“cm:”);
Serial.println(distance);
if( (distance > 0) && (distance <= 10) ) { digitalWrite(led1, HIGH); digitalWrite(led2, HIGH); digitalWrite(led3, HIGH); digitalWrite(led4, HIGH); digitalWrite(led5, HIGH); } else if( (distance > 10) && (distance <= 20) )
{
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
} else
if( (distance > 20) && (distance <= 30) )
{
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
} else
if( (distance > 30) && (distance <= 40) )
{
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
digitalWrite(led5, HIGH);
} else
if( (distance > 50) && (distance <= 60) )
{
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
} else
if( distance > 60 )
{
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
}
}
Photo Gallery