0% found this document useful (0 votes)
106 views12 pages

UTA014-Engineering Design-II: Bronze Challenge

The document describes the requirements and code implementation for the Bronze Challenge engineering design project. The Bronze Challenge requires a buggy to follow a line around a track twice, detect obstacles using ultrasonic sensors, detect gantries, and safely park. The code uses IR sensors for line following, ultrasonic sensors for obstacle detection, XBee for wireless communication, and various functions for gantry detection, parking, and printing the buggy's state at each stop.

Uploaded by

Tania CE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views12 pages

UTA014-Engineering Design-II: Bronze Challenge

The document describes the requirements and code implementation for the Bronze Challenge engineering design project. The Bronze Challenge requires a buggy to follow a line around a track twice, detect obstacles using ultrasonic sensors, detect gantries, and safely park. The code uses IR sensors for line following, ultrasonic sensors for obstacle detection, XBee for wireless communication, and various functions for gantry detection, parking, and printing the buggy's state at each stop.

Uploaded by

Tania CE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 12

UTA014-Engineering Design-II

Bronze Challenge
What is Bronze Challenge ?
Single buggy move around track at least twice in clockwise
direction, under full supervisory control (wireless
communication). Buggy Can detect an obstacle. Parks safely.
Prints state of the track and buggy at each gantry stop.
Functionality required for Bronze
Normal line following on buggy track through wireless
communication using Zig-bee-communication
Normal line follow using IR-sensor.
Detection of obstacle through ultrasonic sensor.
(buggy should stop at each gantry for 1-second and
then continues its motion along the path).
Gantry detection through receiver.
Cover at least two circular path along the outer buggy
track.
Parking the buggy into parking zone.
Hardware Structure
Code for Normal Line following using IR-Sensor
 void gantry()
 {
 int r1=digitalRead(t1);
 int r2=digitalRead(t2);
 if(r1==LOW&&r2==LOW)
 {
 digitalWrite(pin5,HIGH);
 digitalWrite(pin6,LOW);
 digitalWrite(pin7,LOW);
 digitalWrite(pin8,HIGH);
 }
 if(r1==LOW&&r2==HIGH)
 {
 digitalWrite(pin5,LOW);
 digitalWrite(pin6,LOW);
 digitalWrite(pin7,HIGH);
 digitalWrite(pin8,LOW);
 }
 if(r1==HIGH&&r2==LOW)
 {
 digitalWrite(pin5,HIGH);
 digitalWrite(pin6,LOW);
 digitalWrite(pin7,LOW);
 digitalWrite(pin8,LOW);
 }
 if(r1==HIGH&&r2==HIGH)
 {
 digitalWrite(pin5,HIGH);
 digitalWrite(pin6,LOW);
 digitalWrite(pin7,LOW);
 digitalWrite(pin8,HIGH);
  
 }
Code for Ultrasonic

 void detectObstacle()
 {
 delay(50);
 unsigned int uS = sonar.ping_cm();
 unsigned int distanceCm;
 pinMode(ECHO_PIN,OUTPUT);
 digitalWrite(ECHO_PIN,LOW);
 pinMode(ECHO_PIN,INPUT);
  
 //Serial.print("Ping: ");
 //Serial.print(distanceCm);
 //Serial.println("cm");
 if((distanceCm<15) && (distanceCm>0))
 {
 stopBuggy();
 delay(1000);
 }
 }
Code for Xbee

if(flag==0)
{
 if (Serial.available() > 0)
{
 char s = Serial.read();
 switch (s) {
 case 'G':
 {
 flag=1;
 }
}
Gantry detection code
 if (digitalRead(irPin)==HIGH)
 {
 StartTime = millis();
 d = pulseIn(irPin,HIGH);
 if(d > 500 and d < 1500)
 {
 //Serial.println(d);
 Serial.println("Gantry: 1");
 stopBuggy();
 delay(1000);
 }
 else if (d> 1500 and d < 2500)
 {
 // Serial.println(d);
 Serial.println("Gantry: 2");
 stopBuggy();
 delay(1000);
 }
 else if (d > 2500 and d < 3500)
 {
 // Serial.println(d);

 Serial.println("Gantry: 3");
 gantryCounter=gantryCounter+1;
 Serial.print("The gantry Counter is: ");
 Serial.println(gantryCounter);
 stopBuggy();
 delay(1000);
  
 }
 else {
 //Serial.println(d);
 Serial.println("Gantry: Unknown");

 }
leftBlind () for Parking
 void leftBlind()
 {

 int r2=digitalRead(t2);
  
 if(r2==LOW)
 {
 digitalWrite(pin5,LOW);
 digitalWrite(pin6,LOW);
 digitalWrite(pin7,HIGH);
 digitalWrite(pin8,LOW);

 }
 if(2==HIGH)
 {
 digitalWrite(pin5,HIGH);
 digitalWrite(pin6,LOW);
 digitalWrite(pin7,LOW);
 digitalWrite(pin8,HIGH);

 }
Code for Parking
 if (flag==3)
 {
 //gantryParking();
 CurrentTimeG=millis();
 ElapsedTimeG = CurrentTimeG-StartTimeG;

 if(ElapsedTimeG<2500)
 {
 flag=3;
 leftBlind();
 }
 if(ElapsedTimeG>2500 && ElapsedTimeG<6500)
 {
 flag=3;
 normalLineFollow();
 }
 if(ElapsedTimeG>6500)
 {
 stopBuggy();
 Serial.print("Buggy:1 Parked");
 //Serial.println(ElapsedTimeG);
 delay(2000);
 flag=-1;
 }

 }
 }
Bronze code

Code link: it will shared through Google drive link


Bronze link: provide on course website
Thanks

You might also like