Need Some Help, hamlib will not connect to ardunio

Hamlib will not connect to the ardunio to follow commands, When it’s done in rotctl, In the tail end I keep getting getaddrinfo: no such host found. this is asking a hardware guy to do software things.

More information, please.

1 Like

I’m running an Ardunio with CNC stepper board, Trying to set it up so it’s a direct USB link from the laptop with Win 11 What am I missing or doing wrong? I think the program path is correct, But I honestly have no idea what I’m looking at. I understand hardware and mechanicals well enough, however software is a strange beast to me.




Sketch that is loaded on the ardunio is below

/*!

  • @file stepper_motor_controller.ino
  • This is the documentation for satnogs rotator controller firmware
  • for stepper motors configuration. The board (PCB) is placed in
  • satnogs-rotator-controller and is for releases:
  • v2.0
  • v2.1
  • v2.2
  • wiki page
  • @section dependencies Dependencies
  • This firmware depends on
  • AccelStepper library 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 108 ///< Gear ratio of rotator gear box default 54
#define MICROSTEP 2 ///< Set Microstep
#define MIN_PULSE_WIDTH 20 ///< In microsecond for AccelStepper
#define MAX_SPEED 800 ///< In steps/s, consider the microstep
#define MAX_ACCELERATION 800 ///< In steps/s^2, consider the microstep
#define SPR 1600L ///< Step Per Revolution, consider the microstep
#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 LOW ///< 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));
}

quick reply: Are you missing a space between the -T and the 127.0.0.1 IP address ?

image

It’s working with and without a space.

Could you try running the following command on the regular command line (cmd), not powershell?

"C:\Program Files\hamlib-w64-4.6.3\bin\rotctld.exe" -m 201 -r COM7 -s 9600 -t 5433 -vvvvvv

Do you have an additional firewall running?

Both firewalls are completely off, Just ran it in command , and this is what I’m getting.

remove the & at the front and start the line by ".

This is what I’m getting from CMD line, Not sure if it’s hung up or not.

That’s good.

Now you can continue with the other commands on another command line window.

I was, I just made the change and I’m still at the same screen.

Is this what I’m looking for? Granted I have no encoder or such on my set up, just a homing switch. I’m currently on my break with this, So I only have partial things with me. Just the ardunio and stepper board attached, Couldn’t bring in the steppers and such.

Does get_pos return any position values?

I’m not sure how rotctld should know how to communicate with your stepper board attached to your Arduino while your Arduino is attached to COM7 on your computer.

That’s now your part.

It looks like it does? but it’s on the dummy rotator settings as far as I can tell


I’ll have to get everything hooked up to see If I’m getting what I need. If not I have a better direction of where I need to head. Thank you so much for the help.

1 Like

My plan was to interface it to Gpredict for tracking. Software is a new/strange beast to me.
What rotcltd is doing I’m sure if it’s normal or not.


Am I supposed to be able to enter commands into rotctld or is it just supposed to blink like that?

You first have to tell rotctld how to communicate with your stepper board.
Currently it talks to your Arduino only and doesn’t know anything about what’s behind it.

“The rotctld program is a rotator control daemon that handles client requests via TCP sockets.”

I don’t think you would need it (at the current point) at all in your case.

Just run
"C:\Program Files\hamlib-w64-4.6.3\bin\rotctld.exe" -m 201 -r COM7 -s 9600

In my case P 128 45 already moves the rotator.

THANK YOU, THANK YOU! It seems to be working with Gpredict, I think I still have to adjust the micro stepping, But I feel like I’m almost there.

It was working for a minute
Now the command line won’t run


Hamlib is in the exact place that the command line covers

Just copy hamlib again, this time directly into your user directory drkn9.

Then navigate to rotctld.exe with cd hamlib-w64-4.6.3\bin and run the program just by

rotctld -m 201 -r COM7 -s 9600

OK, I got the command path working, correctly now,
If I unplugged the Ardunio, the command will run,
But If I plug the Ardunio in, The command line will freeze up.


After doing A LOT of reading last night, would this indicate a port conflict, or possible firmware issue with the Ardunio?
I did try a couple different Ardunio’s and I’m still having the same issue.
I did check in the device manager and both Ardunio’s are being recognized.
I also checked the Ardunio IDE and both are being recognized there as well.

It was working last night with Gpredict, and then just stopped. CMD started to hang up/freeze. I did try rebooting everything as a possible fix, and I was still getting the same results.