Pages: [1]   Go Down
Author Topic: RC tank phase 1 complete  (Read 7676 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

   Hi this is my first project,
      I started with and ebay found transit damaged 1/24 rc tank and due to no glue on the joints had dissasembled in transit. And for the electronics i dicied upon a DFRobot MEGA, motor shield, and io expantion shield.

  That got me so far as this was my first time using the arduino and in fact any microcontroller, with many nights spent trawling through code
adding bump sensors, leds and an arm fasioned from foamex i hit a wall so i headed over to ebay and bought myself 2 ultrasonic sensors and a 16x2 lcd, I finally got to a stage that i was happy with then **** broken track, so i made a quick bodge (staples and superglue) it worked but it took adjusting the motor speed to counteract the drift, then i encountered "cellbots" and the "robots anywhere" system, time for a change whch i will be documenting, more on it at the end of the post.
Anyway enough with the chat heres the code from it:

//
//
// Tank bot work in progress 30/12/10 version 0.4:

// by Overclock

#include "Ultrasonic.h"

#include <Servo.h>

//turret and servo(s)

Ultrasonic ultrasonic  (11,12);
Servo scanservo;

long LDistance = 0;
long RDistance = 0;

//motor pins and reverse

const int RTMPin     = 5 ;
const int RTRPin     = 4 ;
const int LTMPin     = 6 ;
const int LTRPin     = 7 ;

int val = 0;
// timers
long scantimer = 1000;

unsigned long currentmillis   = 0;
unsigned long previousmillis  = 0;
/////////////////////////////////////////////////////////////

              void setup() {
  Serial.begin(9600);

pinMode (RTMPin, OUTPUT);
pinMode (RTRPin, OUTPUT);
pinMode (LTMPin, OUTPUT);
pinMode (LTRPin, OUTPUT);


scanservo.attach(9);


}
//////////////////////////////////////////////////////////////
              void loop()
{

val = map (ultrasonic.Ranging(CM),0 ,60, 0, 255);                  //map 0-60 cm to 0-255 in order to enable more control and to bring the bot to a controlled stop


if   (ultrasonic.Ranging(CM)<10) {   // switch condition reads ranging ditance
                                     // checks if Us reads lower than 10cm
analogWrite  (RTMPin, 0);            //stop
analogWrite  (LTMPin, 0);
digitalWrite (RTRPin, LOW);
digitalWrite (LTRPin, LOW);
   scanservo.write(0);                 // scan servo left
   delay(150);
   LDistance = ultrasonic.Ranging(CM); // read out dist into "LDistance"
   delay(1000);
   scanservo.write(180);               // scan servo right
   delay(150);
   RDistance = ultrasonic.Ranging(CM); // read out dist into RDistance
   delay(1000);
   scanservo.write(90);               // center servo
  
  if (LDistance<RDistance){            // decides if left distance is larger than right distance
analogWrite  (RTMPin, 100);            // then reverses and makes a turn
analogWrite  (LTMPin, 100);            // 70% sucess rate
digitalWrite (RTRPin, HIGH);
digitalWrite (LTRPin, HIGH);
  delay(750);
analogWrite  (RTMPin, 100);
analogWrite  (LTMPin, 100);
digitalWrite (RTRPin, HIGH);
digitalWrite (LTRPin, LOW);
delay(1000);
  }
  else{
 analogWrite  (RTMPin, 100);
analogWrite  (LTMPin, 100);
digitalWrite (RTRPin, HIGH);
digitalWrite (LTRPin, HIGH);
  delay(750);
analogWrite  (RTMPin, 100);
analogWrite  (LTMPin, 100);
digitalWrite (RTRPin, LOW);
digitalWrite (LTRPin, HIGH);
delay(1000);
  }  
}


else  {                                                // normal conditions
  scanservo.write(90);
analogWrite  (RTMPin, constrain (val, 50, 255));       //
analogWrite  (LTMPin, constrain (val, 50, 255));
digitalWrite (RTRPin, LOW);
digitalWrite (LTRPin, LOW);
}
 
 
 
 Serial.print("sensor = " );                      
  Serial.print(ultrasonic.Ranging(CM));      
  Serial.print("\t output = ");      
  Serial.println(val);  

  
}


Next time, 1/12 scale, bb firing 2 foot monster.

  What we want to see:
motor encoders (turret and tracks)
various sensors
2nd arduino to read sensor values and to offlload calculations
android phone for the remote video and control link!! dell streak ;D
laser targeting, with rangefinding and auto aim (distance compensation)
deployable arms
ability to recharge remote
remote PC (brain) with dedicated software (mapping, vision, ect.)
some huge destruction when it decides humans are its enemy

Lets get some more bots built its easier than you think!!


Logged

Vejen, Denmark
Offline Offline
Edison Member
*
Karma: 7
Posts: 1178
RAWR! ^,..,^
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What we want to see:
And what we want to see, it pictures of this great project smiley-grin
« Last Edit: January 14, 2011, 07:29:36 am by bld » Logged

captain-slow.dk | non contagious!

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


I've dissasembled this project already smiley-sad
I have a couple if photos and vids from testing, how do i go about uploading videos an photos to the forum??
Logged

Holland
Offline Offline
Sr. Member
****
Karma: 0
Posts: 439
Arduino likes cookies too
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Videos can be uploaded to youtube.
As for pictures, there are MANY picture hosts out there... first one that comes to mind is photobucket, but there are so many.. (note: I've never used photobucket myself, as I have my own webspace).

PS: code goes best in between [ code]your arduino sketch here[ /code] tags, this will make a nice block for us to view the code, as opposed to regular text which is sort of a pain to read (for code).
« Last Edit: January 14, 2011, 10:56:50 am by Imahilus » Logged

Canton, Connecticut, United States, Planet Earth, SOL Galaxy, 3rd star on the left.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 67
To Infinity, And BEYOND!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Likewise, photos can be put up on a hosting site like www.photobucket.com , and linked to the same way.

I'm still trying to find tome to go back to a tank-bot I've been trying to resurrect. (originally based on the original VEX platform.)  Main problems, are time, work, time, finding all the parts again (misplaced the RC transmitter. ARGH!) getting a working sketch for the RC receiver (appears to be a simple serial signal.)  time.. Did I forget to mention time? :'(
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok see below for the link to some photos of my "Test Bed" i reassembled as my kind delivery driver decided to not use the doorbell and leaving a card saying he was going to re-deliver on monday. Thanks Parcelforce!

http://picasaweb.google.com/105306264011913034414/Bot502?feat=directlink

Let me know what you think, It was a good start but now its time to go big!!  ;D
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is the new "platform I'm going to be using can't wait to get hacking  smiley-razz



sorry can't work out how to embed photos and vids they don't show, help??
« Last Edit: January 15, 2011, 11:31:22 am by gavin169 » Logged

Vejen, Denmark
Offline Offline
Edison Member
*
Karma: 7
Posts: 1178
RAWR! ^,..,^
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Same platform I used for my old tank...

use the button to insert youtube movies, and I think picasa is blocking linking directly to the images...

[media]http://www.youtube.com/watch?v=a2YMYmYldQM[/media]
But I got tired of the sound from it, and wanted a platform I could easier make new parts for, and put things on without using hot glue, so I ordered a new...
[media]http://www.youtube.com/watch?v=m3pgGqTjFwo[/media]
« Last Edit: January 15, 2011, 07:44:59 pm by bld » Logged

captain-slow.dk | non contagious!

Canton, Connecticut, United States, Planet Earth, SOL Galaxy, 3rd star on the left.
Offline Offline
Jr. Member
**
Karma: 0
Posts: 67
To Infinity, And BEYOND!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This is as far as I've gotten on a resurrected VEX tank I made a few years ago. I'm trying to find what I did with the RC transmitter, as someone out on the net has found the pattern for the RC receiver, which should be easy enough to incorporate to the design.

In these photos, the AVR is a ATMEGA328, running just the positioning servo, and the stock VEX Ultrasonic range finder.  (Yes, the PING))) example code will work with the VEX USRF.. Simply set one digital pin as the output (the USRF's Input) and one as Input (the USRF's output.), the code works the same.  ;D )





I'm trying to also add a simple line-follower (the three sensors on the front) to follow the white line around a running track, but might have problems.. (the rest of the track is a brick red.) so this might be scrapped form the idea. Otherwise, yes, that is a 7805 voltage regulator being used to power the servo off the 9V.. Still looking at a 7.2V battery from the old project. (already made the adapter.)   Simply plug into the Arduino, hit reset, and let it run!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

cool its nice to see I've stirred the bot builder in you.
I have my new base and have been playing about for a few days using the transmitter and receiver that came with the tank, that was until me being careless smiley-sad had the battery jumper leads switched during testing, I only let the magic smoke escape from the RX ic :-[

Anyway I have some photos I am just about to set a new flickr and youtube account so I'll get something posted.

Anybody know any good H-bridge designs using IRF3205 NPN MOSFETS, or cheap designs that will handle at least 20A just to be safe :-?    
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ok on second thoughts I wont be posting anything more on this forum I shall wait until we have our nice shiny new one, look out "RC Tankbot MKII"

RIP Forum you have done us proud :'(
Logged

Pages: [1]   Go Up
Jump to: