Closed andykirk50 closed 1 year ago
Hi Andy
Here is a hack of one of the ESP32_Servo examples. I've added your az configuration. You could add a few print statements if you like, and use it for testing your setup. Your range of 400 - 4000 seems a bit high, but not impossible.
Thank you Ill give it a try.
Have your parts arrived yet for the stepper motors?
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Eric @.> Sent: 22 January 2022 09:26 To: @.> Cc: andy @.>; @.> Subject: Re: [zs6buj/AntTracker] 360 servo (Issue #43)
Hi Andy
Herehttps://drive.google.com/file/d/12RTa0NoTNfYy--MgXbfH6GACVM3lm2d3/view?usp=sharing is a hack of one of the ESP32_Servo examples. I've added your az configuration. You could add a few print statements if you like, and use it for testing your setup. Your range of 400 - 4000 seems a bit high, but not impossible.
— Reply to this email directly, view it on GitHubhttps://github.com/zs6buj/AntTracker/issues/43#issuecomment-1019126111, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACXXNEWLA7JVNLOFKE236D3UXJZ2NANCNFSM5MPXG7NQ. You are receiving this because you authored the thread.Message ID: @.***>
The stepper motors have not yet arrived, and unfortunately I have a deadline of 9 February for an overseas trip.
No problem.
Ive ordered a Pololu T825 pwm to step converter which should be here Monday so ill have a play with that and let you know how I get on.
Hope you have a good trip.
Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Eric @.> Sent: 23 January 2022 07:21 To: @.> Cc: andy @.>; @.> Subject: Re: [zs6buj/AntTracker] 360 servo (Issue #43)
The stepper motors have not yet arrived, and unfortunately I have a deadline of 9 February for an overseas trip.
— Reply to this email directly, view it on GitHubhttps://github.com/zs6buj/AntTracker/issues/43#issuecomment-1019429859, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACXXNEW2M5OX3XVSHSJP62TUXOT5XANCNFSM5MPXG7NQ. You are receiving this because you authored the thread.Message ID: @.***>
how can i add the 360 hack?
@andykirk50:
I'm back home, but there is no sign of the stepper motors shipped through the SA post office I'm afraid. Maybe someone decided they looked like interesting paper weights.
@sebas1984x:
Carefully go through the config.h, especially the SERVO SETTINGS section, and configure according to your perceived needs. As questions if you need clarification. Once you have configured, you can test the outcome using selected debug macros:
//=============================================================================================
//=================================== S E R V O S E T T I N G S ===========================
//=============================================================================================
#define Test_Servos // Move servos through their limits, then try box_hdg every 45 degrees of circle
//#define Az_Servo_360 // Means the azimuth servo can point in a 360 deg circle, elevation servo 90 deg
// Default (comment out #define above) if 180 deg azimuth and flip over 180 deg elevation
#define azStart 90 // 0 deg = left, 90 deg = straight ahead, 180 deg = right, 270 deg = behind
#define elStart 0 // 0 = horizontal, 90 = vertical
#define Servo_Slowdown 10 // Default 0 - Try 5, 10.. ms/degree to limit angular velocity
// Set the degree range of the servos here. Do not adjust servo mechanical limits here.
#if defined Az_Servo_360 // 1 x 360, 1 x 90 (or 180) servos
int16_t minAz = 0; // Az lower limit in degrees, left of tracker facing flying field
int16_t maxAz = 359; // Az upper limit in degrees
int16_t minEl = 0; // El lower limit in degrees, horizontal
int16_t maxEl = 90; // El upper limit in degrees, straight up
#else // 2 x 180 deg servos
int16_t minAz = 0; // Az lower limit in degrees, left of tracker facing flying field
int16_t maxAz = 180; // Az upper limit in degrees, right of tracker facing flying field
int16_t minEl = 0; // El lower limit in degrees, horizontal and forward
int16_t maxEl = 180; // El upper limit in degrees, horizontal and rearward
#endif
// Sometimes the mechanical movement of a servo is reversed due to the orientation of its mounting
// Its movement may be reversed here to compensate
#define ReverseAzimuth // my azimuth servo has a reversed action
//#define ReverseElevation
// Default values for SG90 servos; 500 and 2400
// My 180 deg servos have a PWM range of 700 through 2300 microseconds. Your's may differ.
// ADJUST THE MECHANICAL LIMITS OF MOVEMENT OF YOUR SERVOS HERE BELOW
#if defined STM32F1xx // my STM32 based tracker has different servos
uint16_t minAzPWM = 600; // right (because mine is reversed)
uint16_t maxAzPWM = 2300; // left
uint16_t minElPWM = 700; // front
uint16_t maxElPWM = 2300; // back
#else
uint16_t minAzPWM = 625; // right (because mine is reversed)
uint16_t maxAzPWM = 2235; // left
uint16_t minElPWM = 600; // front
uint16_t maxElPWM = 2257; // back
#endif
Thnx, unfortunately i got the wrong 360 servo (continues rotation)
Can i use a 180° servo with 2:1 gear ratio, if so what do i need to change?
Ps. Thnx for your work, love it 👍🏻
Thanks for your kind feedback. The 180 deg azimuth servo plus 180 deg elevation servo will effectively achieve 360 degree all 'round coverage, because the 180 degree elevation servo flips over and behind when need be. You need to imagine the scenario in your mind's eye, or set it up and use the #define Test_Servos
Yes i know, the thing is it cant flip backwards to much because of a hdzero reciever on the back. Is there a way to use a 1:2 gear ratio? That would be great
Any solution to this?
Hi, I built this tracker with 1:2 gear allowing 360 servo rotation. These values give me really 360 degrees: minAzPWM = 647, maxAzPWM = 2470. I wrote my own servo test routine to test full range and at the end I'm feeding azServo.write(az); with values 0-360. Servo does full circle in the range 0-180 and doesn't move in the range 190-360 so it seems to me that function azServo.write(az) works only with 0-180 values. Of course I have defined #define Az_Servo_360. Real tracking is also incorrect - if required pointing is above 180 deg. it doesn't work properly. Is there any trick I missed or is it a bug? I'm afraid I'm not good enough programmer to find it. Thank you for any help! Video of my bench test showing the problem is here: https://drive.google.com/file/d/17kbrcO2MIMX4dp0wyhKl5gqORhdIF3hi/view?usp=sharing
@sebas1984x
Unfortunately the video won't allow me to download.
The 360 functionality was added by one of the other contributors, and I know it worked for them, but of course your setup is somewhat unique. In general, if you have 360 degrees of movement in azimuth, the elevation servo will never need to "flip over", as it can simply turn to the correct heading and then rise up within a 90 degree arc.
You don't say which board you are using, but assuming esp32, then the servo library does indeed limit the servo range, as per the readme at https://github.com/jkb-git/ESP32Servo.
QUOTE: Servo - Class for manipulating servo motors connected to ESP32 pins. int attach(pin ) - Attaches the given GPIO pin to the next free channel (channels that have previously been detached are used first), returns channel number or 0 if failure. All pin numbers are allowed, but only pins 2,4,12-19,21-23,25-27,32-33 are recommended. int attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds; enforced minimum min is 500, enforced max is 2500. Other semantics are the same as attach(). void write () - Sets the servo angle in degrees; a value below 500 is treated as a value in degrees (0 to 180). These limit are enforced, i.e., values are constrained as follows: Value Becomes
< 0 0
0 - 180 value (treated as degrees)
181 - 499 180
500 - (min-1) min
min-max (from attach or default) value (treated as microseconds)
(max+1) - 2500 max
I can think of two workarounds:
1 Use your 360 servo in 180 mode, and set up accordingly 2 in the servo writw commands, if the value written is greater than 500 (see the readme above) it assumes microseconds (PWM value). So use the Arduino map() function to map to the values that will produce the correct result for you.
Unfortunately I'm pretty swamped with work right now, so I can't spend much time one this.
I assume this issue is now moot. Sorry, I have been away. Please open it again if necessary. Thanks.
can anyone help please ive set up my tracker on V2.29.05, everything seems to work fine other than the AZ movement. i have a 360 servo but it only moves 180. ive checked the output of the PWM and ran servo test to see the output. when the tracker first loads its set to point 180 (PWM value of 3736. then in the servo test i run it as below, when it tries to test 360 it doesnt move and reads the same as 180 then when it tests 0 degrees it moves down to pwn 769. please correct me if im wrong but setting the start point at 180 it should have a mid point on the pwm then move left and right from that when moving to 0 and 360
when setting the servo movement to 180 i get pwm 3719 max, 2253 mid and 802 low, so seems to be an issue when 360 is configured
void TestServos() { delay(8000); moveServos(180 (pwm 3736) delay(8000); moveServos(180 (pwm 3736) delay(8000); moveServos(359 (pwm 3736) delay(8000); moveServos(359 (pwm 3736) delay(8000); moveServos(0 (pwm 769 ) delay(8000); moveServos(0 (pwm 769) delay(8000); moveServos(azStart, elStart);
define Test_Servos // Move servos through their limits, then try box_hdg every 45 degrees of circle
define Az_Servo_360 // Means the azimuth servo can point in a 360 deg circle, elevation servo 90 deg
// Default (comment out #define above) is 180 deg azimuth and flip over 180 deg elevation
define azStart 180 // 0 deg = left, 90 deg = straight ahead, 180 deg = right, 270 deg = behind
define elStart 45 // 0 = horizontal, 90 = vertical
define Servo_Slowdown 5 // Default 0 - Try 5, 10.. ms/degree to limit angular velocity
// Set the degree range of the servos here. Do not adjust servo mechanical limits here.
if defined Az_Servo_360 // 1 x 360, 1 x 90 (or 180) servos
int16_t minAz = 0; // Az lower limit in degrees, left of tracker facing flying field int16_t maxAz = 359; // Az upper limit in degrees int16_t minEl = 0; // El lower limit in degrees, horizontal int16_t maxEl = 90; // El upper limit in degrees, straight up AntTrack_360AZ.zip