It looks to me as though the actuator operates much faster when controlled by the receiver than by the Arduino. Do you think that is the case ?
I don't think Google understood what you said here: "I found that sensors are more sensitive than raw giggles"
Adrian.
Adrian has a very good eye.
As you can see, the speed that the receiver controls is the maximum speed.
The control speed of the Arduino receiving the signal from the sensor was reduced to 35% of the speed controlled by the transmitter.
Sensitivity of the sensor is sensitive, increasing the control output of the Arduino results in very harsh stabilization. I'm in the process of adjusting the variables little by little.
And the word Google couldn't find was an error in my keyboard.
Yougjae, you’ll get there in the end, great test rig. Looks like you’re experiencing the real challenge of developing an effective stabiliser, which is to make sure the stabilization remains in phase with the movement of the hull. If they get out of phase, the system becomes dynamicall unstable and you get divergent oscillations. Funny for those watching from a distance!
I know that you wish to crack the stabilization thing, but have you had a look at this , "GSU 2 Axis Gun Stabilize Unit - 35 RC Tank".
Or the recently seen "K12 - 35 RC Tank"- RC Conversion Kit for TAMIYA 1/35 Challenger 2, with MTC-2, ACU and GSU"
Could they be adapted? It has 2 axis control and deck sensing to raise gun all in one package.
I got this information at the end of last year and purchased a set earlier this year and completed the analysis.
And I found it difficult to apply it on a scale of 1/6 without servo motors.
After I finish stabilizing the current main gun and turret, I will apply ultrasonic and color sensors to Arduino to apply the anti-collision system.
The 1/35 Chally 2 Stabilizer. Tiny thing just needs scaling up a bit
Chieftain Main Gun Stabilizer using my Arduino found a much more stable condition than yesterday.
I will apply this result to my chieftain about this weekend, which perfectly fits the center of gravity, to get practical results.
And I will make changes if necessary.
And...... there's another interesting challenge.
As John Clarke said, I'm going to build a new controller by amplifying the capacity of the kits I've previously purchased at 35RC.
If I take advantage of the characteristics of Arduino that I learned for two months, I think I can integrate all signals from this control unit into Arduino to create a control system for 24V.
Of course, I may fail, but I've concluded that the theoretical review that I've been thinking about all day will be possible.
My new challenge continues.
Youngjae
Attachments
Last edited by Youngjae Bae on Wed Jun 24, 2020 7:56 am, edited 10 times in total.
It would be good to see your system working under slow conditions, maybe with a glass of water on the end of the barrel...
Chieftain only had a cross country performance of about 18mph, which is roughly walking pace at our scale, and probably wouldn't be travelling over the worst contours at full speed, so I feel smoothness and accuracy of the stabilisation is probably more important than raw speed of response.
Adrian, it’s remarkable what a spot of superglue under the stein and some cling film over the beer will do to prevent spillage. But you’re right about smoothness over speed. The Chieftain stabilization system was by far the best system on any tank during the early days. I was able to watch T-64B firing on the move in East Germany and the Russians were able to frighten the targets firing on the move. With Chieftain, up to about 1200m, we aimed to kill the target and usually did.
It is not difficult to operate slowly because it has handled the rapid response.
Someone could refer to this source code and Hardware.
The variables obtained through the experiment were modified in the code that was previously uploaded.
The measurement speed of the MPU9250 has been increased to the maximum value expressed.
And I changed the attachment position of the sensor.
The direction of rotation of the motor may be used by the individual who needs to change the code himself.
"PMAC2A PC/104 - Delta Tau Data Systems," a more dedicated motion controller than Arduino, deviates from the price of hardware and the price of the program and That's more than a hobby's price.
I'm satisfied with the cost-effectiveness.
Above all, it is a great pleasure to do what you want to realize.
I have changed my control method as below while searching for a lot of data over the past few days.
I focused on writing the source code a little while ago with the control method, also known as feedback(PID) control.
First, when I go home today, I will compile this code and try to improve the problem.
I will explain the interpretation consistently when the program is perfect.
/* 2020-07-06
* This source code was written by Youngjae Bae to reduce unnecessary elements and stabilize
* the main gun and turret of the big-scale model tank by referring to the code of
* Kris Winer and the condition statement of Vince Cutajar.
* I have introduced feedback(PID) control because I want the device to be a little softer.
*
* Based on the Arduino Mega, the power of the transmitter must be turned on by dust and
* supplied by the receiver and Arduino, and when switched off,
* the power of the transmitter must be shut off at the end.
*
* The transmitters and receivers for RC use spectrum DX6 and AR610.
* The motor driver used the SZDLT two-channel driver.
*/
// Main Control Parameters - The sensitivity or intensity of the test is adjusted here.
#define CheckTime 120 // (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
double kpPitch = 1.2, kiPitch = 2.5 , kdPitch = 3.2;
double kpYaw = 1.2, kiYaw = 2.5, kdYaw = 3.2;
double outMinPitch = -254, outMaxPitch = 254;
double outMinYaw = -254, outMaxYaw = 254;
// 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 700000 // 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
MPU9250 IMU(MPU9250_ADDRESS, SDA, SCL); // Using MPU9250 named internal classes as IMU functions
// Transmitter connections
#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
// Motor driver pins
#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
// Declaration of Variables for Stabilization
int THRO, RUDD, AUX1 = 0; // Declares the rudder and throttle channels as integer variables and defines zero
// Set to true to get Serial output for debugging
#define SerialDebug true
// 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.begin(115200); // Specify serial communication calls and baud rates
// Convert to PWM value (-ConstrainLimit to ConstrainLimit)
THRO = pulseToPWM(THRO);
RUDD = pulseToPWM(RUDD);
AUX1 = pulseToPWM(AUX1);
if(SerialDebug) {
Serial.print(THRO);
Serial.print(" ");
Serial.print(THRO);
Serial.println("This value is a GUN position.");
Serial.println();
Serial.print(RUDD);
Serial.print(" ");
Serial.print(RUDD);
Serial.println("This value is a TURRET position.");
Serial.println();
}
if (AUX1 == 0) { // The ability to hold the main gun and turret forcibly
digitalWrite(A1_PIN, LOW); // if the transmitter signal is missing or required.
digitalWrite(A2_PIN, LOW);
digitalWrite(B1_PIN, LOW);
digitalWrite(B2_PIN, LOW);
return inAuto_PID;
void SetMode(int Mode) {
bool newAuto_PID = (Mode == AUTOMATIC_PID);
if(newAuto_PID && !inAuto_PID){
// I just went from manual to auto
Initialize_PID();
}
inAuto_PID = newAuto_PID;
}
Following yesterday, today is a code that utilizes Sabertoot(motion controller B) using motor controller as below.
If anyone uses this code, they can use it while tuning the kp, ki, kd values.
/* 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, AUX1;
/* working PID variables */
unsigned long lastTime;
double errorPitch = 0, errorYaw = 0;
double InputPitch = IMU.pitch, OutputPitch, SetpointPitch;
double InputYaw = IMU.yaw, OutputYaw, SetpointYaw;
double ITermPitch, ITermYaw;
double outputSumPitch, lastInputPitch;
double outputSumYaw, lastInputYaw;
int SampleTime = (CheckTime / 4);
bool inAuto_PID = false;
#define MANUAL_PID 0
#define AUTOMATIC_PID 1
#define DIRECT_PID 0
#define REVERSE_PID 1
#define P_ON_M 0
#define P_ON_E 1
bool pOnE_Pitch, pOnE_Yaw = true;
int controllerDirection = DIRECT_PID;
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();
AUX1 = constrain(map((pulseIn(AUX1_PIN, HIGH)), 1058, 1887, 0, 1), 0, 1); // Convert RC pulse to switch signal (0 and 1)
if(SerialDebug) {
Serial.print("AUX1 =");
Serial.println(AUX1);
Serial.println();
}
Compute();
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
return inAuto_PID;
}else{ // Tansmitter turned on and switch on
return !inAuto_PID;
if(abs(SetpointPitch - IMU.pitch) != 0) {
STS1.writeMicroseconds(OutputPitch); //pitch and yaw stabilization
}else{
STS1.writeMicroseconds(pulseTopulse(pulseIn(THRO_PIN, HIGH))); // Convert RC pulse and write to servo channel
return SetpointPitch = IMU.pitch;
}
if(abs(SetpointYaw - IMU.yaw) != 0) {
STS2.writeMicroseconds(OutputYaw);
}else{
STS2.writeMicroseconds(pulseTopulse(pulseIn(RUDD_PIN, HIGH)));
return SetpointYaw = IMU.yaw;
}
if(SerialDebug) {
Serial.print("IMU.pitch =");
Serial.println(IMU.pitch);
Serial.println();
Serial.println("IMU.yaw =");
Serial.println(IMU.yaw);
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;
}
}
void SetMode(int Mode) {
bool newAuto_PID = (Mode == AUTOMATIC_PID);
if(newAuto_PID && !inAuto_PID){
// I just went from manual to auto
Initialize_PID();
}
inAuto_PID = newAuto_PID;
}
Below is a code table of Arduino (due) regarding the 3-axis camera stabilizer.
I recently learned about the strength of Kalman Filter while studying stabilization, and I share it because it is worth referring to.
The gimbal works very well in this camera.
The weather has become the perfect season to organize the warehouse, so I'm cleaning the warehouse and studio that I have been delaying for three years. After a long time, my chiefain came out to the yard like a pretty puppy who wanted me to call him anytime.
Youngjae
Attachments
The blooming spring has come
IMG_20230331_092035_(500_x_375_픽셀).jpg (117.09 KiB) Viewed 1896 times
IMG_20230331_091919_(500_x_375_픽셀).jpg (106.58 KiB) Viewed 1896 times
Self-driving is possible at any time.
IMG_20230331_092020_(500_x_375_픽셀).jpg (114.16 KiB) Viewed 1896 times
Good to see you again.
Enjoy the cherry blossom season.
Vince
Thank you, Vince, for being consistent.
It's a lot of trouble for me to clean up because of my laziness in this beautiful blooming season.
I'm trying to organize things easily because I'm tired of standing up all day.
Rather than making something, the inability to organize tools and consumables right away always leads to a lot of regrets.
I wish everyone happiness every moment they breathe in this spring.
Recently, I have commissioned a local junior who is good at making 1/5 scale K2 Black Panther, Korea's main battle tank.
It will be completed in August.
Youngjae
Attachments
I'm going to empty all the storage and fill it up slowly
IMG_20230331_182021_(500_x_375_픽셀).jpg (67.91 KiB) Viewed 1850 times
I take out all my luggage and organize everything in detail
IMG_20230331_182042_(500_x_375_픽셀).jpg (101.42 KiB) Viewed 1850 times