Our robot is a fully autonomous trash-collector. It has caterpillar tracks, a scoop, an ultrasonic sensor, a breadboard and an arduino. It is orange! It drives around, and when it sees litter (or anything smaller than a certain size), it scoops it into the plastic container at the back.
Team Members in the TechnoCamps in Aberystwyth:
Marley: Technical Supervisor.
Finley: Team Adviser.
Deni: Mechanic/Technician.
Linus: Graphic Designer.
Manu: Mechanic/Technician.
Jonathan1: General Planner/Adviser.
Jonathan2: Team Leader
Part List/Components:
- 2 Servos
- 1 Arduino Leonardo
- 1 Chassis (kindly donated by Team Leader Jonathan)
- 1 Breadboard
- 1 Pack of Jumper Wires (approx)
- 2 Infared Sensors (Separated Sensor)
- Caterpillar Tracks (Made from the caterpillar that we're not supposed to eat!)
- 1 Plastic tub in which to carry the litter
- 1 Scoop
- Faciaboard
Circuit Design
15/05/13
We made the prototype video and this webpage
22/05/13
We updated more to the video and designed the draft for the poster
05/06/13
We updated the video and began programming the robot.
The code (at the moment):
// NOTE! the servo values are guesses, probably inaccurate. CHANGE THEM!
const int pingPin = 3;
const int forwardLM = 4;
const int forwardRM = 5;
const int reverseLM = 6;
const int reverseRM = 7;
const int pingTwo = 10;
const int motorEnable = 11;
int cm = 0;
int duration = 0;
int object = 0;
int readPingOne = 0;
int readPingTwo = 0;
int number = 0;
#include <Servo.h>
Servo scoop;
Servo sweep;
//############################################################################################################################################
// reading=duration/29/2*100 (for centimetres)because sound travels at 29 microseconds per metre, and the pulse has to go there and back again.
void setup()
{
pinMode(pingPin,OUTPUT);
pinMode(readPingOne,INPUT);
pinMode(forwardLM,OUTPUT);// these are the motors.
pinMode(forwardRM,OUTPUT);
pinMode(reverseLM,OUTPUT);
pinMode(reverseRM,OUTPUT);
pinMode(motorEnable,OUTPUT);
pinMode(pingTwo,OUTPUT);// and this is the infrared for the rubbish detector.
pinMode(readPingTwo,INPUT);
}
void loop()
{
scoop.attach(8);
sweep.attach(9);
motorSet();
scoopPrepare();
sweepUp();
Ping();
if(cm > 20)
{
turnRandom();
motorSet();
}
if(object < 4) // change this if 4 is wrong
{
delay(100);
Stop();
scoopDown();
sweepDown();
sweepUp();
scoopUp();
scoopPrepare();
}
}
//############################################################################################################################################
void motorSet()
{
digitalWrite(motorEnable,HIGH);
digitalWrite(forwardLM,HIGH);
digitalWrite(forwardRM,HIGH);
digitalWrite(reverseLM,LOW);
digitalWrite(reverseRM,LOW);
}
void turnLeft()
{
digitalWrite(forwardLM,LOW);// turns bot to left to avoid obstacle
digitalWrite(forwardRM,LOW);
delay(250);
digitalWrite(reverseLM,HIGH);
delay(500);
digitalWrite(forwardRM,HIGH);
delay(600);
}
void turnRight()
{
digitalWrite(forwardLM,LOW);// turns bot to right to avoid obstacle
digitalWrite(forwardRM,LOW);
delay(250);
digitalWrite(reverseRM,HIGH);
delay(500);
digitalWrite(forwardLM,HIGH);
delay(600);
}
void turnRandom()
{
number = random(0,7);
if (number <= 3)
{
turnLeft();
}
if (number >= 4)
{
turnRight();
}
}
void Stop()
{
digitalWrite(forwardLM,LOW);
digitalWrite(forwardRM,LOW);
digitalWrite(reverseLM,LOW);
digitalWrite(reverseRM,LOW);
}
//############################################################################################################################################
void scoopDown()
{
scoop.write(180);
}
void sweepDown()
{
sweep.write(90);
}
void scoopUp()
{
scoop.write(10);
}
void sweepUp()
{
sweep.write(10);
}
void scoopPrepare()
{
scoop.write(160);
}
//############################################################################################################################################
void Ping()
{
delayMicroseconds(2);
digitalWrite(pingPin, HIGH);
delayMicroseconds(5);// change if ultrasound requires it!!
digitalWrite(pingPin, LOW);
pinMode(pingPin, INPUT);
duration = pulseIn(pingPin,HIGH);
cm = duration/29/2;
}
12/06/13
We got Stan to move, and produced drafts for the poster.
This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/stan-the-trash-collector