Community
Search
Notices
RC Tanks Discuss all aspects of rc tank building and driving here!

New board

Thread Tools
 
Search this Thread
 
Old 08-09-2013, 11:09 AM
  #1  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default New board

A few years back I started working on a shield for an arduino mega to make an open source tank controller. It got shelved several times but i recently started working on it again then i found this.

http://www.sainsmart.com/arduino-com...no-uno-r3.html

it has 3 pin rc style outputs built into the board and could control an entire tank. I have written and tested alot of the software that would be needed already on the mega that i have. It would be fairly simple to tweak the code to go onto one (or two connected via I2C and a telephone cable spinner as turret slip ring) of these.

Would just need a serial or I2C controlled sound board and some ESCs to drive the various motors. IR led and sensors could be connected directly to it for battle system and outputs would be standard rc servo. Custom but open source software could be written and distributed freely to adjust most of the features of the various models. Speed limits, Acceleration/Deceleration ramps, weapons types, armor levels, battle system performance, etc. With this it could be programmed to act exactly like a tamiya or any other way you would like. A simple tamiya RC system or a complex IR system with various gun types and armor types. Its all just code.

Simply uploading existing code to an arduino is easy enough for most anyone.

Anyone else on here have any Arduino programing (C) experience? what do you guys think?
Old 08-09-2013, 03:40 PM
  #2  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default


here is how it could be wired
Attached Thumbnails Click image for larger version

Name:	RCVCS.jpg
Views:	719
Size:	253.8 KB
ID:	1906585  
Old 08-10-2013, 10:48 AM
  #3  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

no arduino coders?
Old 08-11-2013, 01:38 AM
  #4  
Strato50
 
Strato50's Avatar
 
Join Date: Jan 2006
Location: Hamilton, ON, CANADA
Posts: 1,422
Likes: 0
Received 7 Likes on 7 Posts
Default

That's pretty sleek looking, have you physically been testing it?

Unfortunately I do not code
Old 08-11-2013, 04:54 AM
  #5  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

I have been writing and testing on a bigger Arduino mega board. traction, elevation, azimuth, recoil, channel mixing, acceleration ramps, deceleration ramps, braking ramps, ir input, I2c communications are all pretty much figured out and written. Battle system, IR output, vehicle selection, serial out to a sound system all need written. I want to continue down the road of having free and open source software with a group collaboration. With cheap, existing, well supported, and available Arduino boards, this would give us a chance to have free reign on features such as sounds, IR battle system characteristics (not limited to tamiya), controls (advanced pivoting), armor levels/characteristics, speeds, etc. It could be written in a modular fashion were tankers with specific requirements could swap out a section of code for the piece they need. We as a group would control and write the software. If someone comes up with a great idea it could be written and implemented instead of hopeing that clark or slu or tamiya or whomever adds it to their next design. It really isn't that hard to learn.
Old 08-12-2013, 12:32 PM
  #6  
rgallant
Member
 
Join Date: Jan 2009
Location: Mission, BC, CANADA
Posts: 72
Likes: 0
Received 0 Likes on 0 Posts
Default

Cool, I do fair bit of work the arduino and was going to run my sherman that way, are will to share the code ?

I am currently testing with a VS tank leopard and sabertooth motor controller.

Opps forgot turret tests are with a spare complete panzer 4 upper hull (airsoft) but same general idea.

I want to run everything possible from standard rc so to that end I am using spectrum 2.4 and receiver attached to the Arduino. with arduino doing the grunt work.

I will post some images when I get the chance

Last edited by rgallant; 08-12-2013 at 01:36 PM. Reason: missed a few things
Old 08-13-2013, 02:38 AM
  #7  
chris3BK
Senior Member
 
Join Date: Jan 2011
Location: Bochum, GERMANY
Posts: 492
Likes: 0
Received 0 Likes on 0 Posts
Default

hi

im completly new to the topic , how can i imagine the funktion prinzip of these bord in the tank, are thay going to be like a robot, folowing thair programming or is the bord somethink like the existing bords just you are able to program them by yourself?

the only thin i need is a servo wich will folow a IR light so my truck can folow my tank itself lol.

cu christian
Old 08-13-2013, 07:01 AM
  #8  
rgallant
Member
 
Join Date: Jan 2009
Location: Mission, BC, CANADA
Posts: 72
Likes: 0
Received 0 Likes on 0 Posts
Default

In response to Chris3bk, I would think a pretty simple graphical windows/android/ios front end could be added so people could change basic things. As for the functions it would just replace the existing electronics, but in theory give you an unlimited ability to change things.
Old 08-13-2013, 11:42 AM
  #9  
aceisback
Senior Member
My Feedback: (1)
 
Join Date: Apr 2002
Location: West Terre Haute, IN
Posts: 114
Likes: 0
Received 0 Likes on 0 Posts
Default

Been working with Arduino's for a couple of years now. I started thinking out the processes on the same thing a while back but stopped because I could not get any information on Tamiya code for the battle units. I am into pretty much everything RC and was going to use gyros for turret and gun stabilization. This is something I plan on eventually doing, but for me, it will probably be a winter project.

If anyone can shed some light on code for TBU compatibility, that would be great.
Old 08-13-2013, 12:13 PM
  #10  
rgallant
Member
 
Join Date: Jan 2009
Location: Mission, BC, CANADA
Posts: 72
Likes: 0
Received 0 Likes on 0 Posts
Default

I think coding the apples will be a hit or miss thing. I have a HL apple and some wiring notes I will see if I can see it and how it reacts. The Tamiya would work basically the same, the nice thing is we can see the return values and get a better feel.

Currently I am trying to simulate more realistic movement and speeds

Sherman's slow reverse, and faked gear shifting. 1st attempt was just awful. Hope to have some video later this week.

The real issue with all of this is while it is fun, cost it kind of high. I have a motor controller for the drive motors, Arduino, sound board coming and I may have to add a couple of cheap brushed ESC's for the turret. But the flexibility is great.
Old 08-13-2013, 12:21 PM
  #11  
DeadTom
 
DeadTom's Avatar
 
Join Date: Feb 2007
Location: Reno, NV
Posts: 183
Likes: 0
Received 0 Likes on 0 Posts
Default

THE_BREED

You mentioned above that you were in need of a serial sound board, check out the link.
The breakout board even has an SD slot, the down side is it is $20. But the cheapest so far that I have seen.
https://www.sparkfun.com/products/11125

DT
Old 08-13-2013, 12:33 PM
  #12  
rgallant
Member
 
Join Date: Jan 2009
Location: Mission, BC, CANADA
Posts: 72
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by DeadTom
THE_BREED

You mentioned above that you were in need of a serial sound board, check out the link.
The breakout board even has an SD slot, the down side is it is $20. But the cheapest so far that I have seen.
https://www.sparkfun.com/products/11125

DT

The problem Tom is we need something where we can choose the file to play to get all the sounds at the right place, there are some nice ones for 150+ but I am still looking sound is low on my list right now. Everything else needs to work 1st. I can mimic sound with LED's for the short term. It is reading all the data sheets that takes the time.
Old 08-13-2013, 01:33 PM
  #13  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

When I first started working on it back in 2010, I designed and built this board http://www.rcuniverse.com/forum/rc-t...-system-2.html which i been developing on with a mega 1280. I have 2 extra boards if someone wants one to develop on but it was the first revision so there is at least one mistake it that I've found. The code on page one of above post is out of date and most of it didnt work.

I absolutely will share my code. Its split up into several sketches at the moment. Had it all consolidated into one but found some better ways of doing some of the things. i had been using pulsein() command to read the receiver inputs until i found out that this function sits idle until it finds a pulse, 20ms refresh rate per channel times 6 or 8 channels takes a long time. I been studying an writing a piece of code to use interrupt 0 to read and demux the PPM signal directly out of a Turnigy 6X/XR7000 http://www.hobbyking.com/hobbyking/s...r_Mode_2_.html. It would only use one pin for all 6 channels instead of 6 pins.

I found/modified/wrote a little piece of IR code that reads Sony IR signals and moves a servo as well as outputs the value to the serial monitor. I dont know which code type the tamiya uses (sony, rx-5, rx-6, nec) but shouldn't be too hard to write.

I wrote acceleration/deceleration/braking code that uses a curve (may be over kill) rather than a linear line for the acceleration ramp, a linear ramp for coasting and a variable angle linear ramp for braking. I want to either re-write the acceleration code to be linear like the braking code or at least put a multiplier to vary the acceleration ramp with throttle value. Speed limiting is done on my development board through a pot and works however I would like to code this value as a variable.

Mixing code is written but not fully tested.

Azimuth code uses a ramp similar to throttle with a linear acceleration, coast, and brake. Speed is also limited by a pot but I propose coding it as a variable.

Recoil in my scheme is as a servo or a motor with timing controlled by a pot. I propose to also code this as a variable.

Elevation with a servo works just like in a real tank. The further you move the tiller the faster the elevation moves. Centering the tiller leaves the elevation wherever it is.

I'm using I2C to read the switch inputs from a PCA9555 I/O expander that i was intending on using as vehicle selection but, I intend to code this as variables as well. Possibly in future develop an expansion board to add extra features such as I2C traction motor controller with switch based vehicle selection and adding pots back in to simplify speed setups.

My intentions are to develop code where the Sainsmart Arduino compatible UNO board with some escs and a sound board can be used to replace tamiya, clark, dbc3, rx18, etc. and be customizable, free and open source to anyone. This would allow us to develop new ways of doing things and have better control over how our tanks function and battle. Im also working on a new battle system configuration with would be less arcade like. Ill post my existing code and some wiring schematics for each later tonight or tomorrow evening. Im gonna be especially busy the next week or so as I just started a new job monday and wont have a day off for a few weeks.
Old 08-13-2013, 01:43 PM
  #14  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

Oh, i forgot. My pivoting code is done differently from any other system ive seen. Channel 5 is used to put the tank into pivot mode just like on a real tank. To do a full skid steer pivot channel five is held and the steering input determines the speed of the pivot. The vehicle speed has to be below a certain value before a pivot can be initiated. Without channel five switched only a partial pivot(one track forward one stopped) can be done. This is just like it is on the abrams which is what it is modeled on. Russian tanks like the t-34, t-55, t-72 and other tanks which cant do a full pivot this function can be eliminated.
Old 08-13-2013, 02:32 PM
  #15  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

Here is the IR code I got. You will have to download the IRremote.h library. Just do a google search.

#include <IRremote.h>
#include <Servo.h>

int RECV_PIN = 46;
const int LeftTrackOut = 13;
int LeftTrackVal = 1500;
Servo LeftTrackServo;
int codeValue;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
LeftTrackServo.attach(LeftTrackOut);
}

void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
codeValue = results.value;
irrecv.resume(); // Receive the next value

if(codeValue == 0x490){
LeftTrackVal = LeftTrackVal + 1;
}

if(codeValue == 0x290){
LeftTrackVal = 1507;
}

if(codeValue == 0xC90){
LeftTrackVal = LeftTrackVal - 1;
}

LeftTrackServo.writeMicroseconds(LeftTrackVal);

Serial.print(LeftTrackVal, DEC);
Serial.print("\t");

Serial.println(codeValue, HEX);
}
}
Old 08-13-2013, 02:33 PM
  #16  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

The PPM code I'm developing



volatile long Pulsewidth; //pulsewidth of current channel in microseconds
volatile long channel1;
volatile long channel2;
volatile long channel3;
volatile long channel4;
volatile long channel5;
volatile long channel6;
volatile long microsCount; //first rising edge micros value
int count = 1;
int NumChan = 4; //number of receiver channels

#define int0 (PINE & 0b00010000) // Faster than digitalRead

void handleInterrupt(){
if(int0)
microsCount=micros(); // we got a positive edge
else
Pulsewidth=micros()-microsCount; // second positive edge: get pulsewidth
}

void setup(){
Serial.begin(9600);
pinMode(2,INPUT);
attachInterrupt(0,handleInterrupt,RISING); // Catch rising edge
}

void loop(){
if(count == NumChan + 1){
count = 1; //reset channel count back to 1 after last channel outputed
}
if(Pulsewidth > 800 && Pulsewidth < 2200){ // make sure its a real channel value
if(count == 1 ){
channel1 = Pulsewidth;
count++;
}
if(count == 2 ){
channel2 = Pulsewidth;
count++;
}
if(count == 3 ){
channel3 = Pulsewidth;
count++;
}
if(count == 4 ){
channel4 = Pulsewidth;
count++;
}
if(count == 5 ){
channel5 = Pulsewidth;
count++;
}
if(count == 6 ){
channel6 = Pulsewidth;
count++;
}
}

Serial.println(channel1,DEC); // Pulsewidth in microseconds
Serial.println(channel2,DEC); // Pulsewidth in microseconds
Serial.println(channel3,DEC); // Pulsewidth in microseconds
Serial.println(channel4,DEC); // Pulsewidth in microseconds
Serial.println(channel5,DEC); // Pulsewidth in microseconds
Serial.println(channel6,DEC); // Pulsewidth in microseconds
}
Old 08-13-2013, 02:34 PM
  #17  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

The recoil code. This uses a pot to set value for recoil.

#include <Servo.h>
const int RawMGMaingunMissleIn = 33;
const int RecoilPotIn = 0;
const int RecoilOut = 9;

Servo RecoilServo;
int MGMainGunMissileVal;
int RecoilPotVal;
int RecoilOutVal = 1000;

int RecoilCountDelay = 0;
int Fire = 0;
int Firing = 0;
int RecoilNeutral = 1000;
int PulseInCount = 0;

int ReceiverCenter = 1500;
int ReceiverMax = 2300;
int ReceiverMin = 700;
int ServoCenter = 1500;
int ServoMax = 2000;
int ServoMin = 1000;
int UpperDeadBand = 1510;
int LowerDeadBand = 1490;


void setup()
{

Serial.begin(9600); //Serial library start

pinMode(RawMGMaingunMissleIn, INPUT);
pinMode(RecoilPotIn, INPUT);

RecoilServo.attach(RecoilOut);
}

void loop()
{

PulseInCount++;
if(PulseInCount > 7){
PulseInCount = 0;
}

if(PulseInCount == 5){
MGMainGunMissileVal = pulseIn(RawMGMaingunMissleIn, HIGH, 20000);
}
RecoilPotVal = analogRead(RecoilPotIn);
RecoilPotVal = map(RecoilPotVal, 0, 1023, 0, 1000);

MGMainGunMissileVal = map(MGMainGunMissileVal, ReceiverMin, ReceiverMax, 500, 2500);

if(RecoilCountDelay > 30){
if(MGMainGunMissileVal > 2000){
RecoilCountDelay = 0;
Fire = 2;
}}

RecoilCountDelay++;
if(RecoilCountDelay > 50){
RecoilCountDelay = 31;
}

if(Fire > 1){
Firing = 2;
}

if(Fire > 1){
if(Firing > 1){
RecoilOutVal = 2200;
Fire = 0;
}}


if(Firing > 1){
if(RecoilPotVal < 100){
RecoilOutVal = RecoilOutVal - 10;
if(RecoilOutVal < RecoilNeutral){
Firing = 0;
}}}

if(Firing > 1){
if(RecoilPotVal >= 100){
RecoilOutVal = 2500;
if(RecoilCountDelay > RecoilPotVal / 10){
RecoilOutVal = 1000;
Firing = 0;
}}}

if(Firing == 0){
RecoilOutVal = RecoilNeutral;
}

RecoilServo.writeMicroseconds(RecoilOutVal);

Serial.print(MGMainGunMissileVal, DEC);
Serial.print("\t");
Serial.print(RecoilCountDelay, DEC);
Serial.print("\t");
Serial.print(Fire, DEC);
Serial.print("\t");
Serial.print(Firing, DEC);
Serial.print("\t");
Serial.println(RecoilOutVal, DEC);

//delay(1000);
//delay(200);
}
Old 08-13-2013, 02:35 PM
  #18  
rgallant
Member
 
Join Date: Jan 2009
Location: Mission, BC, CANADA
Posts: 72
Likes: 0
Received 0 Likes on 0 Posts
Default

Well we started down the same path, Modern gear works fairly different from WW II era equipment, safety gear was minimal, speeds were pretty low all round. The Sherman could go a whole 5 mph in reverse in a single gear. A lot of the turrets were a simple PTO from the main engine and pretty slow to turn in comparison to modern stuff. But I like your overall though process, and it always good to go with what you are familiar with.

Should be fun though, it is much easier to build things in modules you can test and debug with out interference. I have been working on movement 1st, but if you have that pretty solid I can move over and work on hit detection.
Old 08-13-2013, 02:40 PM
  #19  
rgallant
Member
 
Join Date: Jan 2009
Location: Mission, BC, CANADA
Posts: 72
Likes: 0
Received 0 Likes on 0 Posts
Default

You could deal with recoil by using servo speed instead, most servos have the ability to move at a range of speeds. So max speed for firing then a slower speed as the gun moves forward. I will write up a demo from my Hexapod code. It has the advantage of using a simple variable to change the return speed.
Old 08-13-2013, 02:41 PM
  #20  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

PM me for the overall code its too big to paste i guess.
Old 08-13-2013, 02:59 PM
  #21  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default



also drew this up yesterday. Its an enclosure for the sainsmart uno board that im gonna 3d print in abs. Might add some draft to the model and make a simple mold to cast abs or urethane. Gonna work on it some more.
Attached Thumbnails Click image for larger version

Name:	TANKDUINO 1.JPG
Views:	108
Size:	29.6 KB
ID:	1907816  
Old 08-13-2013, 03:06 PM
  #22  
THE_BREED
Senior Member
Thread Starter
 
Join Date: Apr 2007
Location: , OH
Posts: 152
Likes: 0
Received 0 Likes on 0 Posts
Default

Attached Thumbnails Click image for larger version

Name:	TANKDUINO 15.JPG
Views:	42
Size:	69.6 KB
ID:	1907817   Click image for larger version

Name:	TANKDUINO 7.JPG
Views:	94
Size:	48.8 KB
ID:	1907818  
Old 08-14-2013, 09:50 AM
  #23  
DeadTom
 
DeadTom's Avatar
 
Join Date: Feb 2007
Location: Reno, NV
Posts: 183
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by rgallant
The problem Tom is we need something where we can choose the file to play to get all the sounds at the right place, there are some nice ones for 150+ but I am still looking sound is low on my list right now. Everything else needs to work 1st. I can mimic sound with LED's for the short term. It is reading all the data sheets that takes the time.

Not being an idiot I do understand the problem, the breakout board in the link does use some weird compression on the .wav files but the files are named sequentially and can be accessed and played at the "right place".
I have been writing code in different languages for many years. This is just another language to write in with a small micro, which is very neat indeed.
I have an ProMini Arduino in the nose of my Cobra helicopter that control the lights and a servo that slews the chain gun and the TSU back and forth in a random pattern, pretty cool.
Anyways, I am sure you did not mean to sound condescending to someone you do not know.
Good luck with your project,
DT
Old 08-14-2013, 10:04 AM
  #24  
rgallant
Member
 
Join Date: Jan 2009
Location: Mission, BC, CANADA
Posts: 72
Likes: 0
Received 0 Likes on 0 Posts
Default

My apologies, I did not mean to come across as an idiot or imply you were one. The fault is mine I did not express myself well.

I was looking more for something a basic user could replace the sound files on with basic tools in Windows. I have found the odd ball compression or formats do not always work well with simpler tools.

Originally Posted by DeadTom
Not being an idiot I do understand the problem, the breakout board in the link does use some weird compression on the .wav files but the files are named sequentially and can be accessed and played at the "right place".
I have been writing code in different languages for many years. This is just another language to write in with a small micro, which is very neat indeed.
I have an ProMini Arduino in the nose of my Cobra helicopter that control the lights and a servo that slews the chain gun and the TSU back and forth in a random pattern, pretty cool.
Anyways, I am sure you did not mean to sound condescending to someone you do not know.
Good luck with your project,
DT
Old 08-14-2013, 10:17 AM
  #25  
DeadTom
 
DeadTom's Avatar
 
Join Date: Feb 2007
Location: Reno, NV
Posts: 183
Likes: 0
Received 0 Likes on 0 Posts
Default

No harm no foul, I do understand making things easier for basic user to utilize. Those darn sound boards are very pricey.
DT


Contact Us - Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service -

Copyright © 2024 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.