I have been using the wonderful Satnogs rotor for two years and I have decided to upgrade for a month. Having mounted a small dish for the hrpt in addition to the cubic V / Uhf, I replaced the steppers by mounting 5:18 steppers. Everything works perfectly but the rotation is very slow.
I am using a cnc shield with Arduino Nano and the standalone stepper_motor_controller sketch.
I need to know how to speed up the rotations as by changing the values from the sketch, the speed remains the same. I add that I have mounted TMC2208 drivers.
Thanks for any help.
iz3zlu
/*!
* @file stepper_motor_controller.ino
*
* This is the documentation for satnogs rotator controller firmware
* for stepper motors configuration. The board (PCB) is placed in
* <a href="https://gitlab.com/librespacefoundation/satnogs/satnogs-rotator-controller">
* satnogs-rotator-controller </a> and is for releases:
* v2.0
* v2.1
* v2.2
* <a href="https://wiki.satnogs.org/SatNOGS_Rotator_Controller"> wiki page </a>
*
* @section dependencies Dependencies
*
* This firmware depends on <a href="http://www.airspayce.com/mikem/arduino/AccelStepper/index.htmlhttp://www.airspayce.com/mikem/arduino/AccelStepper/index.html">
* AccelStepper library</a> being present on your system. Please make sure you
* have installed the latest version before using this firmware.
*
* @section license License
*
* Licensed under the GPLv3.
*
*/
#define SAMPLE_TIME 0.1 ///< Control loop in s
#define RATIO 54 ///< Gear ratio of rotator gear box default 54
#define MICROSTEP 8 ///< Set Microstep default 8
#define MIN_PULSE_WIDTH 20 ///< In microsecond for AccelStepper 20
#define MAX_SPEED 3200 ///< In steps/s, consider the microstep default 3200
#define MAX_ACCELERATION 1600 ///< In steps/s^2, consider the microstep default 1600
#define SPR 1600L ///< Step Per Revolution, consider the microstep default 1600
#define MIN_M1_ANGLE 0 ///< Minimum angle of azimuth
#define MAX_M1_ANGLE 360 ///< Maximum angle of azimuth
#define MIN_M2_ANGLE 0 ///< Minimum angle of elevation
#define MAX_M2_ANGLE 180 ///< Maximum angle of elevation
#define DEFAULT_HOME_STATE HIGH ///< Change to LOW according to Home sensor
#define HOME_DELAY 12000 ///< Time for homing Deceleration in millisecond
#include <AccelStepper.h>
#include <Wire.h>
#include <globals.h>
#include <easycomm.h>
#include <rotator_pins.h>
//#include <rs485.h>
#include <endstop.h>
//#include <watchdog.h>
uint32_t t_run = 0; // run time of uC
easycomm comm;
AccelStepper stepper_az(1, M1IN1, M1IN2);
AccelStepper stepper_el(1, M2IN1, M2IN2);
endstop switch_az(SW1, DEFAULT_HOME_STATE), switch_el(SW2, DEFAULT_HOME_STATE);
//wdt_timer wdt;
enum _rotator_error homing(int32_t seek_az, int32_t seek_el);
int32_t deg2step(float deg);
float step2deg(int32_t step);
void setup() {
// Homing switch
switch_az.init();
switch_el.init();
// Serial Communication
comm.easycomm_init();
// Stepper Motor setup
stepper_az.setEnablePin(MOTOR_EN);
stepper_az.setPinsInverted(false, false, true);
stepper_az.enableOutputs();
stepper_az.setMaxSpeed(MAX_SPEED);
stepper_az.setAcceleration(MAX_ACCELERATION);
stepper_az.setMinPulseWidth(MIN_PULSE_WIDTH);
stepper_el.setPinsInverted(false, false, true);
stepper_el.enableOutputs();
stepper_el.setMaxSpeed(MAX_SPEED);
stepper_el.setAcceleration(MAX_ACCELERATION);
stepper_el.setMinPulseWidth(MIN_PULSE_WIDTH);
// Initialize WDT
// wdt.watchdog_init();
}
void loop() {
// Update WDT
// wdt.watchdog_reset();
// Get end stop status
rotator.switch_az = switch_az.get_state();
rotator.switch_el = switch_el.get_state();
// Run easycomm implementation
comm.easycomm_proc();
// Get position of both axis
control_az.input = step2deg(stepper_az.currentPosition());
control_el.input = step2deg(stepper_el.currentPosition());
// Check rotator status
if (rotator.rotator_status != error) {
if (rotator.homing_flag == false) {
// Check home flag
rotator.control_mode = position;
// Homing
rotator.rotator_error = homing(deg2step(-MAX_M1_ANGLE),
deg2step(-MAX_M2_ANGLE));
if (rotator.rotator_error == no_error) {
// No error
rotator.rotator_status = idle;
rotator.homing_flag = true;
} else {
// Error
rotator.rotator_status = error;
rotator.rotator_error = homing_error;
}
} else {
// Control Loop
stepper_az.moveTo(deg2step(control_az.setpoint));
stepper_el.moveTo(deg2step(control_el.setpoint));
rotator.rotator_status = pointing;
// Move azimuth and elevation motors
stepper_az.run();
stepper_el.run();
// Idle rotator
if (stepper_az.distanceToGo() == 0 && stepper_el.distanceToGo() == 0) {
rotator.rotator_status = idle;
}
}
} else {
// Error handler, stop motors and disable the motor driver
stepper_az.stop();
stepper_az.disableOutputs();
stepper_el.stop();
stepper_el.disableOutputs();
if (rotator.rotator_error != homing_error) {
// Reset error according to error value
rotator.rotator_error = no_error;
rotator.rotator_status = idle;
}
}
}
/**************************************************************************/
/*!
@brief Move both axis with one direction in order to find home position,
end-stop switches
@param seek_az
Steps to find home position for azimuth axis
@param seek_el
Steps to find home position for elevation axis
@return _rotator_error
*/
/**************************************************************************/
enum _rotator_error homing(int32_t seek_az, int32_t seek_el) {
bool isHome_az = false;
bool isHome_el = false;
// Move motors to "seek" position
stepper_az.moveTo(seek_az);
stepper_el.moveTo(seek_el);
// Homing loop
while (isHome_az == false || isHome_el == false) {
// Update WDT
// wdt.watchdog_reset();
if (switch_az.get_state() == true && !isHome_az) {
// Find azimuth home
stepper_az.moveTo(stepper_az.currentPosition());
isHome_az = true;
}
if (switch_el.get_state() == true && !isHome_el) {
// Find elevation home
stepper_el.moveTo(stepper_el.currentPosition());
isHome_el = true;
}
// Check if the rotator goes out of limits or something goes wrong (in
// mechanical)
if ((stepper_az.distanceToGo() == 0 && !isHome_az) ||
(stepper_el.distanceToGo() == 0 && !isHome_el)){
return homing_error;
}
// Move motors to "seek" position
stepper_az.run();
stepper_el.run();
}
// Delay to Deccelerate and homing, to complete the movements
uint32_t time = millis();
while (millis() - time < HOME_DELAY) {
// wdt.watchdog_reset();
stepper_az.run();
stepper_el.run();
}
// Set the home position and reset all critical control variables
stepper_az.setCurrentPosition(0);
stepper_el.setCurrentPosition(0);
control_az.setpoint = 0;
control_el.setpoint = 0;
return no_error;
}
/**************************************************************************/
/*!
@brief Convert degrees to steps according to step/revolution, rotator
gear box ratio and microstep
@param deg
Degrees in float format
@return Steps for stepper motor driver, int32_t
*/
/**************************************************************************/
int32_t deg2step(float deg) {
return (RATIO * SPR * deg / 360);
}
/**************************************************************************/
/*!
@brief Convert steps to degrees according to step/revolution, rotator
gear box ratio and microstep
@param step
Steps in int32_t format
@return Degrees in float format
*/
/**************************************************************************/
float step2deg(int32_t step) {
return (360.00 * step / (SPR * RATIO));
}
Hi iz3zlu,
I am using a CNC shield with Arduino Uno with TMC2208 drivers.
Which I presume is very similar to the one you’re using.
I recall the microstep settings under the drivers were slightly different to the A4988 drivers.
Also if everything is working correctly, i.e. eventually pointing in the correct direction.
I would increase the value of MAX_SPEED in the defines.
Then maybe MAX_ACCELERATION to half that to see if it helps.
Steve
372 / 5.000
Thanks for the reply Steve. I first tried to modify the MAX_SPEED and ACCELERATION, but it doesn’t seem to have any effect … whatever value I put, the speed remains the same. In the shield I use, the three jumpers were connected together, but I made the change to have them separated. How many jumpers did you insert and what values do you have of speed and acceleration?
Hi,
Sorry for slow reply. Work gets in the way.
All of my program settings are the same as you have posted above.
For the TMC2208 drivers Micro-stepping, I have nil jumpers (All pins vacant), on my cnc shield.
Have you tried changing the RATIO setting? I assumed you had.
I tried to search for an 5:18 stepper all I could find was 5.18:1 steppers.
So with a bit of dodgy calculation of current setting 54 x 5.18 = 279.72 round up to 280 for RATIO setting.
This maybe completely wrong, so please triple check.
I hope this makes sense and also helps.
Steve
Thanks Steve,
your response was not slow since you are in another hemisphere (HI HI). I’ll do this test.
My sister was born in Sydney and I was conceived in Australia … I hope one day to come and visit your wonderful land.
I’ll write the results here.
For now, thank you so much for your help
I was wrong … I apologize.
My motors are 5: 1 …
The problem with slowness is that it takes a lot of steps to make little space. I have no problems for the positioning that I have perfectly adjusted … the problem is only in the slowness of the rotation. I adjusted the sketch for 4 microsteps and the cnc board without jumpers, but it is too slow and in the passages over the antennas, the rotor cannot stay on the satellite. To point the antennas I use PSTRotator, but I can’t find any settings on the speed, but only on the refresh. Maybe I should replace the gears, but I’m afraid it won’t be possible to tension the belt … thanks for any help.
P.S.
Any modification on the sketch, apart from the GEAR, does not work and the speed remains the same …
… what if I reverse the two gears?
Someone can tell me if it can work or if the effort causes the 5: 1 motors to behave like normal ones
Hi Again,
Sorry with my understanding of ratios I don’t have the knowledge to answer.
Though the way I see it is the 5:1 stepper motor has to turn 5 times faster to get the same speed as standard.
Can the stepper handle that?
Maybe easier to use standard steppers.
Steve
Thanks to you Steve,
When asked if the stepper can manage that speed, I don’t know how to answer. A minimum of more speed would be enough, only when the satellite passes overhead. I’m missing wonderful passages from Meteor, FengYun, MetOp. The signal is great but when the rotor flips, it falls behind and I lose the signal.
Hi iz3zlu,
So sorry but I think I’m misunderstanding what you are saying.
From your last message you say your rotator FLIPS, which I take to mean as Antennae turning upside down.
My Antennae DOES NOT turn upside down.
When the elevation reaches 90 degree above horizon the azimuth rotates and elevation never exceeds 90 degree (Vertical).
If Antennae is flipping upside down (exceeding vertical) something is else wrong.
I am sorry but I don’t think I can help any further, if I can I will.
Steve
The ability to flip is set on the sketch:
#define MIN_M1_ANGLE 0 ///< Minimum angle of azimuth
#define MAX_M1_ANGLE 360 ///< Maximum angle of azimuth
#define MIN_M2_ANGLE 0 ///< Minimum angle of elevation
#define MAX_M2_ANGLE 180 ///< Maximum angle of elevation
but this is not the problem, the problem remains the low speed with motors with gearboxes.
You have been very kind Steve and I thank you, if you can think of something I’m here.