Thursday, April 11, 2019

8 week day 2

LCD code snippet
#include <Wire.h> #include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
const int tleft1 = 2; const int eleft1 = 3; const int tleft2 = 4; const int eleft2 = 5; const int tright1 = 6; const int eright1 = 7; const int tright2 = 8; const int eright2 = 9;
int buz=10; int m1=14; int m2=15; int m3=16; int m4=17;
// defines variables long durl1; int disl1; long durl2; int disl2; long durr1; int disr1; long durr2; int disr2; long duration; int distance;
String pos=""; void setup() { lcd.init(); // initialize the lcd lcd.init(); // Print a message to the LCD. lcd.backlight(); lcd.setCursor(0,0); lcd.print(" Smart "); lcd.setCursor(0,1); lcd.print(" Movable"); lcd.setCursor(0,2); lcd.print(" Road Divider"); lcd.setCursor(0,3); lcd.print(" Project");
pinMode(tleft1, OUTPUT); // Sets the trigPin as an Output pinMode(eleft1, INPUT); // Sets the echoPin as an Input pinMode(tleft2, OUTPUT); // Sets the trigPin as an Output pinMode(eleft2, INPUT); // Sets the echoPin as an Input pinMode(tright1, OUTPUT); // Sets the trigPin as an Output pinMode(eright1, INPUT); // Sets the echoPin as an Input pinMode(tright2, OUTPUT); // Sets the trigPin as an Output pinMode(eright2, INPUT); // Sets the echoPin as an Input pinMode(m1, OUTPUT); pinMode(m2, OUTPUT); pinMode(m3, OUTPUT); pinMode(m4, OUTPUT); pinMode(buz, OUTPUT); digitalWrite(m1,HIGH); digitalWrite(m2,HIGH); digitalWrite(m3,HIGH); digitalWrite(m4,HIGH); delay(2000); lcd.clear(); Serial.begin(9600); // Starts the serial communication } void loop() { // Clears the trigPin lcd.setCursor(0,0); lcd.print("Traffic Density:"); int disl1=ultrasonic(tleft1,eleft1); int disl2=ultrasonic(tleft2,eleft2); int disr1=ultrasonic(tright1,eright1); int disr2=ultrasonic(tright2,eright2); lcd.setCursor(0,1); lcd.print("L1"+String(disl1)+" || R1"+String(disr1)); lcd.setCursor(0,2); lcd.print("L2"+String(disl2)+" || R2"+String(disr2)); Serial.print("Left Side 1:"); Serial.println(disl1); Serial.print("Left Side 2:"); Serial.println(disl2); Serial.print("Right Side 1:"); Serial.println(disr1); Serial.print("Right Side 2:"); Serial.println(disr2); if(disl1<10&&disl2<10) { if(pos!="RIGHT") { Serial.println("Traffic detected on left side"); digitalWrite(buz,HIGH); delay(300); digitalWrite(buz,LOW); lcd.setCursor(0,3); lcd.print("Waiting.."); if(disr1>10&& disr2>10) {
digitalWrite(buz,HIGH);
delay(1000);
digitalWrite(buz,LOW);
Serial.println("Right Side is Free");
Serial.println("Moving Right");
lcd.setCursor(0,3);
lcd.print("Moving Right");
digitalWrite(m1,LOW);
digitalWrite(m2,LOW);
digitalWrite(m3,LOW);
digitalWrite(m4,LOW);

pos="RIGHT";
delay(1000);
}
} else { Serial.println("Already in Right!!!"); }
} if(disr1<10&&disr2<10) { if(pos!="LEFT") { Serial.println("Traffic detected on right side"); digitalWrite(buz,HIGH); delay(300); digitalWrite(buz,LOW); lcd.setCursor(0,3); lcd.print("Waiting.."); if(disl1>10&& disl2>10) {
digitalWrite(buz,HIGH);
lcd.setCursor(0,3);
lcd.print("Waiting..");
delay(1000); digitalWrite(buz,LOW); Serial.println("Left Side is Free"); Serial.println("Moving Left"); lcd.setCursor(0,3); lcd.print("Moving Left"); digitalWrite(m1,HIGH); digitalWrite(m2,HIGH); digitalWrite(m3,HIGH); digitalWrite(m4,HIGH);
pos="LEFT";
delay(1000);
}
}
else
{ Serial.println("Already in Left!!!"); }
} if(disr1<10&&disl2<10) { if(pos!="LEFT TILT") { Serial.println("Traffic detected on right side");
digitalWrite(buz,HIGH);
delay(300);
digitalWrite(buz,LOW);
lcd.setCursor(0,3);
lcd.print("Waiting..");
if(disl1>10&& disr2>10) {
digitalWrite(buz,HIGH);
delay(1000); digitalWrite(buz,LOW); Serial.println("Left Side is Free"); Serial.println("tilting Left"); lcd.setCursor(0,3); lcd.print("Tilting Left"); digitalWrite(m1,HIGH); digitalWrite(m2,HIGH); digitalWrite(m3,LOW); digitalWrite(m4,LOW); pos="LEFT TILT"; delay(1000); } } else { Serial.println("Already in Left Tilted!!!"); }
} if(disl1<10&&disr2<10) { if(pos!="RIGHT TILT") { Serial.println("Traffic detected on right side"); digitalWrite(buz,HIGH); delay(300); digitalWrite(buz,LOW); lcd.setCursor(0,3); lcd.print("Waiting.."); if(disr1>10&& disl2>10) {
digitalWrite(buz,HIGH);
delay(1000); digitalWrite(buz,LOW); Serial.println("Right Side is Free"); Serial.println("Tilting Right"); lcd.setCursor(0,3); lcd.print("Tilting Right"); digitalWrite(m1,LOW); digitalWrite(m2,LOW); digitalWrite(m3,HIGH); digitalWrite(m4,HIGH); pos="RIGHT TILT"; delay(1000); } } else { Serial.println("Already tilted right!!!"); }
} lcd.setCursor(0,3); lcd.print(" "); lcd.setCursor(7,3); lcd.print(pos); delay(1000); Serial.println(pos); Serial.println("<=================>"); lcd.clear(); }
int ultrasonic(int trigPin,int echoPin) { digitalWrite(trigPin, LOW); delayMicroseconds(2); // Sets the trigPin on HIGH state for 10 micro seconds digitalWrite(trigPin, HIGH); delayMicroseconds(10); digitalWrite(trigPin, LOW); // Reads the echoPin, returns the sound wave travel time in microseconds duration = pulseIn(echoPin, HIGH); // Calculating the distance distance= duration*0.034/2; // Prints the distance on the Serial Monitor //Serial.print("Distance: "); //Serial.println(distance); return distance; }

8 weeks day 1

LCD
LCD (liquid crystal display) is the technology used for displays in notebook and other smaller computers. Like light-emitting diode (LED) and gas-plasma technologies, LCDs allow displays to be much thinner than cathode ray tube (CRT) technology.They use the same basic technology, except that arbitrary images are made up of a large number of small pixels, while other displays have larger elements. LCDs can either be normally on (positive) or off (negative), depending on the polarizer arrangement. For example, a character positive LCD with a backlight will have black lettering on a background that is the color of the backlight, and a character negative LCD will have a black background with the letters being of the same color as the backlight. Optical filters are added to white on blue LCDs to give them their characteristic appearance.

Thursday, April 4, 2019

7th weeks 1 days

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);
 
const int tleft1 = 2;
const int eleft1 = 3;
const int tleft2 = 4;
const int eleft2 = 5;
const int tright1 = 6;
const int eright1 = 7;
const int tright2 = 8;
const int eright2 = 9;

int buz=10;
int m1=14;
int m2=15;
int m3=16;
int m4=17;

// defines variables
long durl1;
int disl1;
long durl2;
int disl2;
long durr1;
int disr1;
long durr2;
int disr2;
long duration;
int distance;

String pos="";
void setup() {
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("    Smart ");
  lcd.setCursor(0,1);
  lcd.print("   Movable");
   lcd.setCursor(0,2);
  lcd.print(" Road Divider");
   lcd.setCursor(0,3);
  lcd.print(" Project");

pinMode(tleft1, OUTPUT); // Sets the trigPin as an Output
pinMode(eleft1, INPUT); // Sets the echoPin as an Input
pinMode(tleft2, OUTPUT); // Sets the trigPin as an Output
pinMode(eleft2, INPUT); // Sets the echoPin as an Input
pinMode(tright1, OUTPUT); // Sets the trigPin as an Output
pinMode(eright1, INPUT); // Sets the echoPin as an Input
pinMode(tright2, OUTPUT); // Sets the trigPin as an Output
pinMode(eright2, INPUT); // Sets the echoPin as an Input
pinMode(m1, OUTPUT);
pinMode(m2, OUTPUT);
pinMode(m3, OUTPUT);
pinMode(m4, OUTPUT);
pinMode(buz, OUTPUT);
digitalWrite(m1,HIGH);
digitalWrite(m2,HIGH);
digitalWrite(m3,HIGH);
digitalWrite(m4,HIGH);
delay(2000);
lcd.clear();
Serial.begin(9600); // Starts the serial communication
}
void loop() {
// Clears the trigPin
lcd.setCursor(0,0);
lcd.print("Traffic Density:");
int disl1=ultrasonic(tleft1,eleft1);
int disl2=ultrasonic(tleft2,eleft2);
int disr1=ultrasonic(tright1,eright1);
int disr2=ultrasonic(tright2,eright2);
lcd.setCursor(0,1);
lcd.print("L1"+String(disl1)+" || R1"+String(disr1));
lcd.setCursor(0,2);
lcd.print("L2"+String(disl2)+" || R2"+String(disr2));
Serial.print("Left Side 1:");
Serial.println(disl1);
Serial.print("Left Side 2:");
Serial.println(disl2);
Serial.print("Right Side 1:");
Serial.println(disr1);
Serial.print("Right Side 2:");
Serial.println(disr2);
if(disl1<10&&disl2<10)
{
  if(pos!="RIGHT")
    {
  Serial.println("Traffic detected on left side");
    digitalWrite(buz,HIGH);
    delay(300);
    digitalWrite(buz,LOW);
    lcd.setCursor(0,3);
    lcd.print("Waiting..");
  if(disr1>10&& disr2>10)
  {
   
    digitalWrite(buz,HIGH);
    delay(1000);
    digitalWrite(buz,LOW);
    Serial.println("Right Side is Free");
    Serial.println("Moving Right");
    lcd.setCursor(0,3);
    lcd.print("Moving Right");
    digitalWrite(m1,LOW);
    digitalWrite(m2,LOW);
    digitalWrite(m3,LOW);
    digitalWrite(m4,LOW);
   
    pos="RIGHT";
    delay(1000);
    }
  }
  else
  {
    Serial.println("Already in Right!!!");
  }
 
}
if(disr1<10&&disr2<10)
{
  if(pos!="LEFT")
    {
  Serial.println("Traffic detected on right side");
    digitalWrite(buz,HIGH);
    delay(300);
    digitalWrite(buz,LOW);
    lcd.setCursor(0,3);
    lcd.print("Waiting..");
  if(disl1>10&& disl2>10)
  {
   
    digitalWrite(buz,HIGH);
    lcd.setCursor(0,3);
    lcd.print("Waiting..");
  delay(1000);
  digitalWrite(buz,LOW);
    Serial.println("Left Side is Free");
    Serial.println("Moving Left");
    lcd.setCursor(0,3);
    lcd.print("Moving Left");
    digitalWrite(m1,HIGH);
    digitalWrite(m2,HIGH);
    digitalWrite(m3,HIGH);
    digitalWrite(m4,HIGH);
   
    pos="LEFT";
    delay(1000);
    }
    }
    else
  {
    Serial.println("Already in Left!!!");
  }
 
}
if(disr1<10&&disl2<10)
{
  if(pos!="LEFT TILT")
    {
  Serial.println("Traffic detected on right side");

    digitalWrite(buz,HIGH);
    delay(300);
    digitalWrite(buz,LOW);
    lcd.setCursor(0,3);
    lcd.print("Waiting..");
  if(disl1>10&& disr2>10)
  {
   
    digitalWrite(buz,HIGH);
  delay(1000);
  digitalWrite(buz,LOW);
    Serial.println("Left Side is Free");
    Serial.println("tilting Left");
    lcd.setCursor(0,3);
    lcd.print("Tilting Left");
    digitalWrite(m1,HIGH);
    digitalWrite(m2,HIGH);
    digitalWrite(m3,LOW);
    digitalWrite(m4,LOW);
    pos="LEFT TILT";
    delay(1000);
    }
    }
    else
  {
    Serial.println("Already in Left Tilted!!!");
  }
 
}
if(disl1<10&&disr2<10)
{
  if(pos!="RIGHT TILT")
    {
  Serial.println("Traffic detected on right side");
    digitalWrite(buz,HIGH);
    delay(300);
    digitalWrite(buz,LOW);
    lcd.setCursor(0,3);
    lcd.print("Waiting..");
  if(disr1>10&& disl2>10)
  {
   
    digitalWrite(buz,HIGH);
  delay(1000);
  digitalWrite(buz,LOW);
    Serial.println("Right Side is Free");
    Serial.println("Tilting Right");
    lcd.setCursor(0,3);
    lcd.print("Tilting Right");
    digitalWrite(m1,LOW);
    digitalWrite(m2,LOW);
    digitalWrite(m3,HIGH);
    digitalWrite(m4,HIGH);
pos="RIGHT TILT";
    delay(1000);
    }
    }
    else
  {
    Serial.println("Already tilted right!!!");
  }
 
}
lcd.setCursor(0,3);
lcd.print("           ");
lcd.setCursor(7,3);
lcd.print(pos);
delay(1000);
Serial.println(pos);
Serial.println("<=================>");
lcd.clear();
}

int ultrasonic(int trigPin,int echoPin)
{
  digitalWrite(trigPin, LOW);
delayMicroseconds(2);
// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);
// Calculating the distance
distance= duration*0.034/2;
// Prints the distance on the Serial Monitor
//Serial.print("Distance: ");

Thursday, March 21, 2019

week 6 day 1

LINEAR ACTUATOR

 A linear actuator is an actuator that creates motion in a straight line, in contrast to the circular motion of a conventional electric motor. Linear actuators are used in machine tools and industrial machinery, in computer peripherals such as disk drives and printers, in valves and dampers, and in many other places where linear motion is required.Hydraulic or pneumatic cylinders inherently produce linear motion. Many other mechanisms are used to generate linear motion from a rotating motor.



Thursday, March 14, 2019

5th week day 2

home/root123/Pictures/Screenshot from 2019-03-15 09-42-44.png

To reduce the hold up, we end to propose our plan of dominant the road divider for an additional lane as per would  like with the assistance of IOT.
1. As per the holdup ascertained in our lifestyle through the time period cameras.

2. We gather the info collected from the cameras and send them to cloud for analysing the traffic.

3.In analysis half, the info are going  to  be analysed mistreatment raspberry  pi through image process.

4. After analysing, the required action is performed whether or not to  push/pop the divider.

5. To build the higher than aforesaid proposal we tend to need ton of funds and time.

6. So, for nonce we tend to square measure coming up with our paradigm in Movable Mechanism (left/right) rather than push/pop mistreatment Arduino. The main advantage in the system is No human power is required.

code for push and pop of the line divider .




5th week 1 day



WORKING OF ULTRASONIC SENSOR

Ultrasonic sensors work by emitting sound waves at a frequency too high for humans to hear. They then wait for the sound to be reflected back, calculating distance based on the time required. This is similar to how radar measures the time it takes a radio wave to return after hitting an object.

While some sensors use a separate sound emitter and receiver, it’s also possible to combine these into one package device, having an ultrasonic element alternate between emitting and receiving signals. This type of sensor can be manufactured in a smaller package than with separate elements, which is convenient for applications where size is at a premium.

While radar and ultrasonic sensors can be used for some of the same purposes, sound-based sensors are readily available—they can be had for just a couple dollars in some cases—and in certain situations, they may detect objects more effectively than radar.


ARDUNIO CODE

const int pingPin = 7; // Trigger Pin of Ultrasonic Sensor
const int echoPin = 6; // Echo Pin of Ultrasonic Sensor

void setup() {
   Serial.begin(9600); // Starting Serial Terminal
}

void loop() {
   long duration, inches, cm;
   pinMode(pingPin, OUTPUT);
   digitalWrite(pingPin, LOW);
   delayMicroseconds(2);
   digitalWrite(pingPin, HIGH);
   delayMicroseconds(10);
   digitalWrite(pingPin, LOW);
   pinMode(echoPin, INPUT);
   duration = pulseIn(echoPin, HIGH);
   inches = microsecondsToInches(duration);
   cm = microsecondsToCentimeters(duration);
   Serial.print(inches);
   Serial.print("in, ");
   Serial.print(cm);
   Serial.print("cm");
   Serial.println();
   delay(100);
}

long microsecondsToInches(long microseconds) {
   return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds) {
   return microseconds / 29 / 2;
}

Thursday, March 7, 2019

week 4 day 2

The background of this project is to reduce traffic  by smartly sensing the traffic flow on either sides of the  divider and  move the divider accordingly ,hence saving time and fuel and also providers safety measures

LITERATURE SURVEY

  •  K.Vidhya, A.Bazila Banu,[1]  Has proposed  Traffic Signal system is based on density on the amount of vehicles travelling on daily basis . by going through the above mentioned paper we understand present traffic signal system                                   
  •   Priyanka Khanke, Prof. P. S. Kulkarni , [2]  Has proposed A  Technique on road trance analysis using  image processing .this paper tells us a about the image processing  and implementation of it to analyze traffic
 REFERENCES

[1] K. Vidhya, A. BazilaBanu, "Density Based Traffic Signal System", Special, vol. 3, no. 3, March 2014.
PriyankaKhanke, P. S. Kulkarni, A Technique on Road Tranc Analysis using Image
Processing, vol. 3, no. 2, February 2015

PROBLEM STATEMENT
 
  •  In present scenario we have fixed road dividers which allows only limited number of vechicles in ongoing and incoming traffic , in order to have a flexible road space  depending vehicle density on road . hence to overcome this we design  a movable road divider .

SOFTWARE Required

  • Arduino IDE
  • MIT App Inventor 2(website)

HARDWARE Required

  • Arduino
  • Node MCU
  • IR Sensors 
  • motors 
  • Liquid Crystal Display -LCD 
  • Power supply (battery)
  • GSM /Bluetooth for wireless  connectivity 
  • basic electronic components such as wires ,solder,glue etc