Close
0%
0%

ScrapTrack

Robots scrounged from various toys, with hobby controllers.

Similar projects worth following
Update: I've gifted this robot to a friend, and began collecting various other "toy grade" RC chassis since. Deathbots is the result, and in time promises to have at least two starting competitors.

------------------------------------
Something was said about an interest in robotics. Being the typical geek/hoarder, I had almost everything on hand to build a tracked bot. Meet ScrapTrack, a tracked Tamiya RC toy tank hull with a NewBrite 9.6V Lithium pack, an Arduino UNO, and a seeedstudio motor shield.

He may not win any beauty contests, but he moves under his own power based on what information he can gather from his surroundings. In my book, that makes him a great little robot.

Update: ScrapTrack was a holiday gift for someone close to me. She is currently deciding what direction to take its development.


Scrap track will be reborn as deathbots.

Coming soon, a terrible yet entertaining idea.

If you look closely in the picture, there is a LOT more on this robot than is coded yet. I've included a PIR sensor, a microphone, and what's not seen is the little Radioshack IR reflection detector. The plan, once I learn how to use that last sensor, is to use it for cliff detection.

The basic code reads two photocells on A4 and A0 to determine motor speeds. It's cheap, ugly, and kinda works... it's ScrapTrack!

PS: yes, those are laptop speakers... no, he cannot sing, yet.

View all 6 components

  • code change, PIR and microphone

    Floz12/25/2014 at 11:06 0 comments

    Got some basic stuff worked out for the PIR and microphone. Right now, he (not sure why I picked male gender, maybe the cool camo look?) makes two different beeps for the sensors, and reports a noteworthy sensor value over serial at 57600 baud.

    //. Motor driver shield- 2012 Copyright (c) Seeed Technology Inc.
    // 
    //  Original Author: Jimbo.we
    //  Contribution: LG
    //  
    //  This library is free software; you can redistribute it and/or
    //  modify it under the terms of the GNU Lesser General Public
    //  License as published by the Free Software Foundation; either
    //  version 2.1 of the License, or (at your option) any later version.
    //
    //  This library is distributed in the hope that it will be useful,
    //  but WITHOUT ANY WARRANTY; without even the implied warranty of
    //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    //  Lesser General Public License for more details.
    //
    //  You should have received a copy of the GNU Lesser General Public
    //  License along with this library; if not, write to the Free Software
    //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    //
    //
    //  Basic motion based on A0 A4 sensor input by Aaron "Floz" Casper
    //  for TankBot
    //
    // set up variables 
    // name pins
    // 
    int pinI1=8;//define I1 interface
    int pinI2=11;//define I2 interface 
    int speedpinA=9;//enable motor A
    int pinI3=12;//define I3 interface 
    int pinI4=13;//define I4 interface 
    int speedpinB=10;//enable motor B
    int SpeakerPin = A5;
    int speed_A =0;//define the speed of motor_A
    int speed_B =0;//define the speed of motor_B
    const int photoCell_A = A4; // light sensor_A pin
    const int photoCell_B = A0; // light sensor_B pin
    const int PIR_signal_pin = A3;
    const int MIC_signal_pin = A2;
    int sensor_value_A = 0;// zero all our math
    int sensor_value_B = 0;// variables and sensors
    int sensor_value_PIR = 0;
    int sensor_value_MIC = 0;
    int output_value_A = 0;
    int output_value_B = 0;
    
    void setup()
    {
       // tell the arduino which pins are input and
       // which ones are output
      pinMode(MIC_signal_pin, INPUT);
      pinMode(PIR_signal_pin, INPUT);
      pinMode(photoCell_A, INPUT);
      pinMode(photoCell_B, INPUT);
      pinMode(pinI1,OUTPUT);
      pinMode(pinI2,OUTPUT);
      pinMode(speedpinA,OUTPUT);
      pinMode(pinI3,OUTPUT);
      pinMode(pinI4,OUTPUT);
      pinMode(speedpinB,OUTPUT);
      Serial.begin(57600);
    }
     
    void forward()
    {
      
      //This is really the only movement function used to begin with
      //it enables the motor to a speed determined by the photocell
      //this configuration should chase bright light.
      //
      
         analogWrite(speedpinA,speed_A);//input a simulation value to set the speed
         analogWrite(speedpinB,speed_B);
         digitalWrite(pinI4,LOW);//turn DC Motor B move clockwise
         digitalWrite(pinI3,HIGH);
         digitalWrite(pinI2,LOW);//turn DC Motor A move anticlockwise
         digitalWrite(pinI1,HIGH);
    }
    void stop()
    {
         // shuts the motors down by setting both speed-pins
         // to LOW
         digitalWrite(speedpinA,LOW);// Unenble the pin, to stop the motor. this should be done to avid damaging the motor. 
         digitalWrite(speedpinB,LOW);
         delay(1000);
     
    }
    
    void loop()
    {
      // read sensor values
      sensor_value_A= analogRead(photoCell_A);
      sensor_value_B = analogRead(photoCell_B);
      sensor_value_PIR = analogRead(PIR_signal_pin);
      sensor_value_MIC = analogRead(MIC_signal_pin);
      // map sensor readings to 0-255 range
      sensor_value_MIC = map(sensor_value_MIC, 924, 1024, 0, 255);
      output_value_A = map(sensor_value_A, 0, 30, 0, 255);
      output_value_B = map(sensor_value_B, 0, 30, 0, 255);
     
       if (sensor_value_PIR <= 5){
        tone(SpeakerPin, 200,50);
       Serial.println("motion detected!");
      }
       if (sensor_value_MIC >= 75){
        tone(SpeakerPin, 500,25);
       Serial.println("loud noise detected!");
      
     }  
     
      // normalize Mic input to 0-255
      if (sensor_value_MIC >= 255){
        sensor_value_MIC = 255;
      }
      if (sensor_value_MIC <= 0){
        sensor_value_MIC = 0;
      }
     
      // don't pass values beyond what the motor controller
      // can handle for speed.  
      if (output_value_A >= 255){
        output_value_A = 255;
      }
        if (output_value_B >= 255){
        output_value_B = 255;
      }
      //...
    Read more »

View project log

  • 1
    Step 1
    //. Motor driver shield- 2012 Copyright (c) Seeed Technology Inc.
    // 
    //  Original Author: Jimbo.we
    //  Contribution: LG
    //  
    //  This library is free software; you can redistribute it and/or
    //  modify it under the terms of the GNU Lesser General Public
    //  License as published by the Free Software Foundation; either
    //  version 2.1 of the License, or (at your option) any later version.
    //
    //  This library is distributed in the hope that it will be useful,
    //  but WITHOUT ANY WARRANTY; without even the implied warranty of
    //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    //  Lesser General Public License for more details.
    //
    //  You should have received a copy of the GNU Lesser General Public
    //  License along with this library; if not, write to the Free Software
    //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    //
    //
    //  Basic motion based on A0 A4 sensor input by Aaron "Floz" Casper
    //  for ScrapTrack
    //
    // set up variables 
    // name pins
    // 
    int pinI1=8;//define I1 interface
    int pinI2=11;//define I2 interface 
    int speedpinA=9;//enable motor A
    int pinI3=12;//define I3 interface 
    int pinI4=13;//define I4 interface 
    int speedpinB=10;//enable motor B
    int speed_A =0;//define the speed of motor_A
    int speed_B =0;//define the speed of motor_B
    const int photoCell_A = A4; // light sensor_A pin
    const int photoCell_B = A0; // light sensor_B pin
    int sensor_value_A = 0;// zero all our math
    int sensor_value_B = 0;// variables and sensors
    int output_value_A = 0;
    int output_value_B = 0;
    
    void setup()
    {
       // tell the arduino which pins are input and
       // which ones are output
       
      pinMode(photoCell_A, INPUT);
      pinMode(photoCell_B, INPUT);
      pinMode(pinI1,OUTPUT);
      pinMode(pinI2,OUTPUT);
      pinMode(speedpinA,OUTPUT);
      pinMode(pinI3,OUTPUT);
      pinMode(pinI4,OUTPUT);
      pinMode(speedpinB,OUTPUT);
      Serial.begin(57600);
    }
     
    void forward()
    {
      
      //This is really the only movement function used to begin with
      //it enables the motor to a speed determined by the photocell
      //this configuration should chase bright light.
      //
      
         analogWrite(speedpinA,speed_A);//input a simulation value to set the speed
         analogWrite(speedpinB,speed_B);
         digitalWrite(pinI4,LOW);//turn DC Motor B move clockwise
         digitalWrite(pinI3,HIGH);
         digitalWrite(pinI2,LOW);//turn DC Motor A move anticlockwise
         digitalWrite(pinI1,HIGH);
    }
    void stop()
    {
         // shuts the motors down by setting both speed-pins
         // to LOW
         digitalWrite(speedpinA,LOW);// Unenble the pin, to stop the motor. this should be done to avid damaging the motor. 
         digitalWrite(speedpinB,LOW);
         delay(1000);
     
    }
    
    void loop()
    {
      // read sensor values to figure motor speeds
      sensor_value_A= analogRead(photoCell_A);
      sensor_value_B = analogRead(photoCell_B);
      
      // map sensor readings to 0-255 range
      output_value_A = map(sensor_value_A, 0, 30, 0, 255);
      output_value_B = map(sensor_value_B, 0, 30, 0, 255);
     
      //serial debugging output
      Serial.print(analogRead(photoCell_A));
      Serial.print(" ");
      Serial.print(output_value_A);
      Serial.print(" ");
      Serial.print(analogRead(photoCell_B));
      Serial.print(" ");
      Serial.print(output_value_B);
      Serial.println(" ");
    
      // don't pass values beyond what the motor controller
      // can handle for speed.  
      if (output_value_A >= 255){
        output_value_A = 255;
      }
        if (output_value_B >= 255){
        output_value_B = 255;
      }
      // don't overwork the controllers trying to make tiny movements
      // chances are they won't turn on the motor enough to move, and
      // just get hot.
      
      if (output_value_A <= 128){
        output_value_A = 0;
      }
        if (output_value_B <= 128){
        output_value_B = 0;
      }
      
      // set the speed pin values for each motor controller
      speed_A= (output_value_A);
      speed_B= (output_value_B);
      //Serial.println(speed_A); 
    
      // move forward with speed_A and speed_B
      forward();
      delay(100);
       // delay to help jitter/freakouts
        
    }
  • 2
    Step 2

    How to build a scraptrack:

    Step1 find an RC toy you like, but want to make autonomous.

    Step2 buy an Arduino (I like the Uno dev board)

    Step3 buy a motor sheild, or build your own.

    Step4 wiring!

    Step5 programming

    Step6 sensors!

    Step7 more programming

    Step8 frantic cursing at a 7th grade math error that makes the robot run in circles

    Step9 even more programming

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates