Go Down

Topic: RC tank phase 1 complete (Read 13653 times) previous topic - next topic


  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() {

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


             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
  LDistance = ultrasonic.Ranging(CM); // read out dist into "LDistance"
  scanservo.write(180);               // scan servo right
  RDistance = ultrasonic.Ranging(CM); // read out dist into RDistance
  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);
analogWrite  (RTMPin, 100);
analogWrite  (LTMPin, 100);
digitalWrite (RTRPin, HIGH);
digitalWrite (LTRPin, LOW);
analogWrite  (RTMPin, 100);
analogWrite  (LTMPin, 100);
digitalWrite (RTRPin, HIGH);
digitalWrite (LTRPin, HIGH);
analogWrite  (RTMPin, 100);
analogWrite  (LTMPin, 100);
digitalWrite (RTRPin, LOW);
digitalWrite (LTRPin, HIGH);

else  {                                                // normal conditions
analogWrite  (RTMPin, constrain (val, 50, 255));       //
analogWrite  (LTMPin, constrain (val, 50, 255));
digitalWrite (RTRPin, LOW);
digitalWrite (LTRPin, LOW);

Serial.print("sensor = " );                      
 Serial.print("\t output = ");      


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!!


Jan 14, 2011, 01:29 pm Last Edit: Jan 14, 2011, 01:29 pm by bld Reason: 1
What we want to see:

And what we want to see, it pictures of this great project :D
captain-slow.dk | non contagious!


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


Jan 14, 2011, 04:55 pm Last Edit: Jan 14, 2011, 04:56 pm by Imahilus Reason: 1
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).


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? :'(


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!


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


Jan 15, 2011, 05:29 pm Last Edit: Jan 15, 2011, 05:31 pm by gavin169 Reason: 1
This is the new "platform I'm going to be using can't wait to get hacking  :P


sorry can't work out how to embed photos and vids they don't show, help??


Jan 16, 2011, 01:43 am Last Edit: Jan 16, 2011, 01:44 am by bld Reason: 1
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...

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...
captain-slow.dk | non contagious!


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!


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 :( 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 :-?    


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 :'(

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131