With those turret turn and barrel speeds the stabilization should look perfect.
Vince
Re: Chieftain kit arrival
Posted: Thu Apr 23, 2020 6:49 pm
by John Clarke
Very impressive, love the motor sounds, it'll be great to see it fully stabilized.
But do you think the crew will be issued with vomit bags?
Re: Chieftain kit arrival
Posted: Thu Apr 23, 2020 8:58 pm
by Phil Woollard
Love it very impressive! A question, how or what will you lock the barrel onto? I think you may need a program to create a realistic "search", "aquire", "lock"," engage" etc etc?
This is ground breaking!
I will be interested to see how the buck converter handles changes in battery voltage, as I would have thought it will collapse if the input voltage drops below about 25.5V.
Adrian.
I'm also curious about Adrian's interests.
The stepdown dc-dc converter I purchased should always have a voltage greater than 1V input than the voltage used.
I still don't know at what voltage my lithium battery BMS shuts off the power supply.
So I installed the sensor to display the battery voltage on my flysky transmitter.
The Armortek power distribution system also showed a slight voltage drop.
I am going to check the status of the voltage from time to time by walking all the loads such as the smoke system.
And I am considering applying "AnyVolt 3" step up & down free converter if necessary to keep the output constant regardless of the high or low voltage on the input side.
Youngjae
Re: Chieftain kit arrival
Posted: Sat May 02, 2020 9:27 am
by Youngjae Bae
Re: Chieftain kit arrival
Posted: Thu May 21, 2020 11:19 pm
by Youngjae Bae
Recently, I have been planning a motion test by creating a separate model and attaching a sensor to implement all the processes including stabilization of the main gun and prevention of collision. During the process, I changed the microprocessor from Arduino Uno to Arduino Mega, and now I'm sketching a new program using C language. So far, the RC system, Arduino and motion controller B, ultrasonic sensors to detect collision prevention of artillery and body, color sensors to detect collision area and safety area, and 9-axis sensors to detect XYZ and rotationality have been completed to monitor the values required.
I plan to make model cannons on wooden boards, configure all the hardware in a series of experiments, and modify debugging work to make modules to install on my chieftain and kingtiger if there is no problem. It's slow, but I'll share the progress from time to time.
The source code below is being sent by referring to the open source of each component and will be opened with the annotation after verification.
Youngjae
Re: Chieftain kit arrival
Posted: Fri May 22, 2020 12:20 am
by Vince Cutajar
Best of luck Youngjae. I could not get a good yaw reading with my sketch. Pitch reading was OK. Looking forward to more updates.
Vince
Re: Chieftain kit arrival
Posted: Thu Jun 04, 2020 1:47 am
by Youngjae Bae
Case 1: RC + Arduino + Motion Controller B (Sabertooth) + MPU9250(measurement only)
Case 2: RC + Arduino + SZDLT(L298N) + MPU9250(measurement only)
I completed the sketch of the most basic "RC + Arduino + Motor controller + MPU9250(measurement only)" as follows.
The phenomenon of fine shaking at the neutral point of the transmitter stick was also fixed by setting deadzone.
This is a code that has proven integrated behavior.
This post will continue to be revised and updated in the future.
Youngjae
//////////////////////////////////// Case A: //////////////////////////////////////////
/* Main Control Parameters - The sensitivity or intensity of the test is adjusted here.*/
#define CheckTime 240 // (milliseconds) The shorter the time to check the displacement, the more vibration it can reflect.
#define deadzone 150 // (PWM) Anything between -150 and 150 is stop
#define SerialDebug true
/* File call to use MPU9250 and quadrant formula */
#include "MPU9250.h" // Make sure to upload the first head-up file of Kris Winer.
#include "quaternionFilters.h" // There are many head-up files of the same name, and if this is misselected, it is impossible to compile.
/* MPU9250 setup */
#define SCL 400000 // Pre-defined serial clock rate
#define SDA Wire // Use the built-in Wire Library for I2C communication
#define MPU9250_ADDRESS 0x68 // Address for using MPU9250 as 5V
/* Using MPU9250 named internal classes ad IMU function */
MPU9250 IMU(MPU9250_ADDRESS, SDA, SCL);
/*To use Sabertooth(Motion Controller B) */
#include <Servo.h>
/* Definition of the connection pin between RC receiver and Arduino */
#define THRO_PIN 22 // THRO PIN IN AR610 CONNECTED TO Aduino Mega No.22
#define RUDD_PIN 23 // Can be replaced with your preferred pins
#define AUX1_PIN 52 // A switch that holds the main gun and turret
/* Definition of the connection pin between Sabertooth and Arduino */
#define S1 2 // Arduino Pin 2 -> Sabertooth S1, Arduino GND -> Sabertooth 0V
#define S2 3 // Arduino Pin 3 -> Sabertooth S2, Arduino VIN <- Sabertooth 5V (OPTION)
/* Definition servo channel of Sabertooth */
Servo STS1; // To name the Sabertooth servo channel objects STS1 and STS2
Servo STS2; // Dip switch on are 2, 3, 5 The rest are off
/* Parameters for radio control */
int pulse;
int AUX1;
void setup() {
/* Define a Pin Using Arduino */
pinMode(THRO_PIN, INPUT);
pinMode(RUDD_PIN, INPUT);
pinMode(AUX1_PIN, INPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
/* Attach pulse width value to servo channel */
STS1.attach(S1, 1000, 2000); // Sabertooth accepts servo pulses from 1000us to 2000us.
STS2.attach(S2, 1000, 2000); // I need to specify the pulse widths in attach().
/* Settings for MPU9250 sensor Usage */
IMU.initAK8963(IMU.factoryMagCalibration); // Initialize compass
IMU.initMPU9250(); // Initialize acceleration, gyro, etc.
IMU.getAres(); // Define Acceleration Usage Functions
IMU.getGres(); // Definition of gyro function
IMU.getMres(); // Magnetism Usage Definitions
/* Serial Communications for Debug */
Serial.begin(115200); // Specify serial communication calls and baud rates
}
void loop() {
mpu9250();
/* Convert RC pulse to switch signal (0 and 1) */
AUX1 = constrain(map((pulseIn(AUX1_PIN, HIGH)), 1058, 1887, 0, 1), 0, 1);
if(SerialDebug) {
Serial.print("AUX1 =");
Serial.println(AUX1);
Serial.println();
}
if(AUX1 == 0) { // Tansmitter turned off or switch off
STS1.writeMicroseconds(1500); // Stops the main gun un and down
STS2.writeMicroseconds(1500); // Stops the turret turn
}else{ // Tansmitter turned on and switch on
/* Convert RC pulse and write to servo channel */
STS1.writeMicroseconds(pulseTopulse(pulseIn(THRO_PIN, HIGH)));
STS2.writeMicroseconds(pulseTopulse(pulseIn(RUDD_PIN, HIGH)));
if(SerialDebug) {
Serial.println("THRO PULSE =");
Serial.print(pulseTopulse(pulseIn(THRO_PIN, HIGH)));
Serial.println();
Serial.println("RUDD PULSE =");
Serial.print(pulseTopulse(pulseIn(RUDD_PIN, HIGH)));
Serial.println();
}
}
}
/* Convert DX6 Transmitter pulse to servo pulse*/
int pulseTopulse(int pulse_r) {
if (pulse > 900) {
pulse = constrain(map(pulse_r, 1058, 1887, 1000, 2000), 1000, 2000);
} else {
return pulse = 1500; // Stop and hold position
}
if (abs(pulse - 1500) <= deadzone ) { // Anything in deadzone should stop the motor
return pulse = 1500; // Stop and hold position
} else {
return pulse;
}
}
//////////////////////////////////// Case B: //////////////////////////////////////////
/* Main Control Parameters - The sensitivity or intensity of the test is adjusted here. */
#define CheckTime 240 // (milliseconds) The shorter the time to check the displacement, the more vibration it can reflect.
#define deadzone 50 //(PWM) Anything between -50 and 50 is stop
#define constrainLimit 254 //(PWM) Constrain limits, Maximum of the strength of the motor rotation, usually 255
#define SerialDebug true // Set to true to get Serial output for debugging
/* File call to use MPU9250 and quadrant formula */
#include "MPU9250.h" // Make sure to upload the first head-up file of Kris Winer.
#include "quaternionFilters.h" // There are many head-up files of the same name, and if this is misselected, it is impossible to compile.
/* MPU9250 setup */
#define SCL 400000 // Pre-defined serial clock rate
#define SDA Wire // Use the built-in Wire Library for I2C communication
#define MPU9250_ADDRESS 0x68 // Address for using MPU9250 as 5V
/* Using MPU9250 named internal classes ad IMU function */
MPU9250 IMU(MPU9250_ADDRESS, SDA, SCL);
/* Definition of the connection pin between RC receiver and Arduino */
#define THRO_PIN 22 // THRO PIN IN AR610 CONNECTED TO Aduino Mega No.22
#define RUDD_PIN 23 // Can be replaced with your preferred pins
#define AUX1_PIN 52 // A switch that holds the main gun and turret
/* Definition of the connection pin between SZDLT and Arduino */
#define A1_PIN 3 // Connect to each pin of the Arduino and SZDLT or L298N two-channel driver.
#define A2_PIN 4 // Can be replaced with your preferred pins
#define PA_PIN 2 // Two G's of the driver are connected to the G of the Arduino
#define B1_PIN 5 // and one of the two 5Vs is connected to the VIN of the Arduino later to provide power.
#define B2_PIN 6
#define PB_PIN 7
/* Parameters for radio control */
int AUX1, THRO, RUDD, pulse;
void setup() {
/* Define a Pin Using Arduino */
pinMode(THRO_PIN, INPUT); //Determine the input or output of the pins used by Arduino
pinMode(RUDD_PIN, INPUT);
pinMode(AUX1_PIN, INPUT);
pinMode(A1_PIN, OUTPUT);
pinMode(A2_PIN, OUTPUT);
pinMode(PA_PIN, OUTPUT);
pinMode(B1_PIN, OUTPUT);
pinMode(B2_PIN, OUTPUT);
pinMode(PB_PIN, OUTPUT);
/* Settings for MPU9250 sensor Usage */
IMU.initAK8963(IMU.factoryMagCalibration); // Initialize compass
IMU.initMPU9250(); // Initialize acceleration, gyro, etc.
IMU.getAres(); // Define Acceleration Usage Functions
IMU.getGres(); // Definition of gyro function
IMU.getMres(); // Magnetism Usage Definitions
/* Serial Communications for Debug */
Serial.begin(115200); // Specify serial communication calls and baud rates
}
void loop() {
mpu9250();
/* Convert RC pulse to switch signal (0 and 1) */
AUX1 = constrain(map((pulseIn(AUX1_PIN, HIGH)), 1058, 1887, 0, 1), 0, 1);
if(SerialDebug) {
Serial.print("AUX1 =");
Serial.println(AUX1);
Serial.println();
}
if(AUX1 == 0) { // Tansmitter turned off or switch off
THRO == 0; // Stops the main gun un and down
RUDD == 0; // Stops the turret turn
}else{ // Tansmitter turned on and switch on
/* Convert RC pulse and write to SZDLT */
drive(THRO, RUDD);
if(SerialDebug) {
Serial.println("THRO PULSE =");
Serial.print(pulseTopulse(pulseIn(THRO_PIN, HIGH)));
Serial.println();
Serial.println("RUDD PULSE =");
Serial.print(pulseTopulse(pulseIn(RUDD_PIN, HIGH)));
Serial.println();
}
}
}
void drive(int THRO, int RUDD) { // Positive for forward, negative for reverse
// Limit speed between -ConstrainLimit and ConstrainLimit
THRO = constrain(pulseTopulse(pulseIn(THRO_PIN, HIGH)), -constrainLimit, constrainLimit);
RUDD = constrain(pulseTopulse(pulseIn(RUDD_PIN, HIGH)), -constrainLimit, constrainLimit);
/* Set direction for motor A */
if ( THRO == 0 ) {
digitalWrite(A1_PIN, LOW);
digitalWrite(A2_PIN, LOW);
} else if ( THRO > 0 ) {
digitalWrite(A1_PIN, HIGH);
digitalWrite(A2_PIN, LOW);
} else {
digitalWrite(A1_PIN, LOW);
digitalWrite(A2_PIN, HIGH);
}
/* Set direction for motor B */
if ( RUDD == 0 ) {
digitalWrite(B1_PIN, LOW);
digitalWrite(B2_PIN, LOW);
} else if ( RUDD > 0 ) {
digitalWrite(B1_PIN, HIGH);
digitalWrite(B2_PIN, LOW);
} else {
digitalWrite(B1_PIN, LOW);
digitalWrite(B2_PIN, HIGH);
}
/* Set speed */
analogWrite(PA_PIN, abs(THRO));
analogWrite(PB_PIN, abs(RUDD));
}
/* Convert DX6 Transmitter pulse to servo pulse*/
int pulseTopulse(int pulse_r) {
if (pulse > 900) {
pulse = map(pulse_r, 1058, 1877, -constrainLimit, constrainLimit);
} else {
return pulse = 0; // Stop and hold position
}
if (abs(pulse - 0) <= deadzone ) { // Anything in deadzone should stop the motor
return pulse = 0; // Stop and hold position
} else {
return pulse;
}
}
I installed a vibration-proof mount of a small pneumatic compressor to be installed in the turret.
And I made a servotrigger for the recoil movement.
This week, I'll finally be able to complete a very nice Recoil feature.
I'll share the motion with you in a video.
Youngjae
Re: Chieftain kit arrival
Posted: Sat Jun 06, 2020 3:47 am
by Youngjae Bae
Completion of pneumatic recoil system!
I've finally completed a complete retrofit of the Recoil system.
Next, the main gun smoke will be implemented using recoil exhaust by connecting the electronic cigarette power to the servotrigger.
Youngjae
Re: Chieftain kit arrival
Posted: Sat Jun 06, 2020 9:14 am
by Vince Cutajar
There seems to be a delay between the gun sound and the actual recoil. That blue servo arm takes some time to activate the pneumatic switch.
Vince
Re: Chieftain kit arrival
Posted: Sun Jun 07, 2020 10:27 am
by Youngjae Bae
As Vince points out, there is a slight delay in the sound and motion of the main gun.
This is the result of the incorrect selection of the solenoid valve for pneumatic use and temporary installation.
Today I program the motion angle of the drier servo motor to reduce the difference slightly.
But when the new solenoid valve arrives, it will be replaced.
My Chieftain came back in the morning running about a kilometer through my village.
I was impressed by the way young children liked it very much.
In the afternoon, I implemented various movements in the yard under the summer sun.
I had a great time today because of my chieftain.
Youngjae
Re: Chieftain kit arrival
Posted: Sun Jun 07, 2020 10:44 am
by Vince Cutajar
Synchronization between the sound and recoil looks so much better now.
Always amazed at how fast the turret and barrel moved.
Sent you something via email.
Vince
Re: Chieftain kit arrival
Posted: Mon Jun 08, 2020 1:11 am
by Youngjae Bae
I got a very nice present from Vince.
I'll print it out in the office today and install it in my Chieftain.
Once again, thank Vince.