Pololu Robotics & Electronics
Menu
My account Comments or questions? About Pololu Contact Ordering information Distributors

Pololu Forum

Tic249 release stepper ok to use

Thank you for a great forum. I have been digging and not quite found what I was looking for.

The documentation notes that use of release for the stepper is not quite recommended as you lose position information. In my use case I would very much like to power down the stepper when it is not moving, is there a preferred way to accomplish this.

In case it helps, my set up:

I am using a stepper to control the potentiometer used for speed control on a minn Kota transom mount trolling motor. I am using it as an outboard for my pontoon boat and would like to control the speed from the helm.

Plan is an Arduino with potentiometer input at helm talking serial (or i2c) to a tic249 in the control housing of the minn Kota. Drive a dual shaft stepper so that one shaft can be controlled by a manual knob (in the case of electronics failure) and the other spins the pot on the motor control. While steady state cruising I would like to power down the stepper. I hope this makes sense and I appreciate constructive feedback.

Hello.

Stepper motors do not typically provide any way to measure its position, so any time it is rotated by anything other than the controller, its actual position will no longer match what the controller thinks the position is.

The Tic has a position control feature that uses a limit switch to find a point of reference for the position of the motor, but anytime the stepper motor is de-energized, there is no way for the Tic to keep this point of reference, since it cannot tell if the motor has been moved. This means it would have to go through a homing procedure every time it is de-energized, which doesn’t sound very practical for your application.

If you need to retain position information through de-energizing the motor, you will likely want to add some kind of external feedback sensor. For example, you could use a stepper motor with an encoder, which the Arduino could monitor to keep track of the position. Another option for feedback might be to have the Arduino read the potentiometer connected to your stepper motor, or using an additional potentiometer coupled to the stepper motor shaft.

By the way, it sounds like you have thought about having a failsafe in case of emergency, but please note that we do not recommend our products be used where their failure could result in injury or significant property damage.

Brandon

Thank you very much for your prompt and informative response. I would expect the stepper to only be moved in the case the electronics have failed and would not be used again unless going through some startup routine. I think I am understanding that using the release stepper method may be ok in my use case as I do not expect to adjust its position while released in normal operation. Once underway the throttle gets adjusted very little and it seems an awful waste of energy and heat to have the stepper holding its position when it has no force acting on it.

Would it make sense to have a routine where the stepper and throttle must be manually brought to a neutral position before it could be enabled? Having it sweep from one limit switch to another would be undesirable in my case. Would the tic understand a limit switch or hall senor in the middle of its sweep?

Thank you again for your assistance

The limit switch feature on the Tic expects the limit switch to be on one side or the other. For example, when the Tic is uncertain of the position of the stepper, it will do a homing sequence by moving the stepper motor in the configured direction. The problem with the limit switch in the center is that the Tic will not know which direction center is, and it could run the wrong direction indefinitely trying to find the limit switch.

If you do not expect the throttle knob to move while the stepper motor is not energized, what you are proposing could work, as long as you also find a reliable way to home it and determine a starting position. However, it is risky because the system has no way of knowing if the Tic’s understanding of the position is out of sync with the actual throttle knob position.

Brandon

That is very helpful. I will have to figure something out to perform the “homing” routine. Perhaps if the “neutral” switch was wired back to the arduino a procedure could be required where in order to activate the system the “throttles” would need to be at a verified neutral as well as the stepper. This would hopefully prevent most startup mishaps and any time there was a manual intervention this startup would need to be repeated.

I have been experimenting with the basics using serial just to de-energize while there is no change in input. The following is what I have so far. The red error lights as expected. The docs state that energize should clear the error flag. With the following code the control works as expected until no change in input is given. The motor releases as desired, but no further updates are performed. It could easily be something I am missing in the loop as once it de-energizes the monitor no longer shows the pot changes either. I initially had the else/if reversed with the same behavior.

Thanks again for your time and attention.

#include <Tic.h>

// On boards with a hardware serial port available for use, use
// that port to communicate with the Tic. For other boards,
// create a SoftwareSerial object using pin 10 to receive (RX)
// and pin 11 to transmit (TX).
#ifdef SERIAL_PORT_HARDWARE_OPEN
#define ticSerial SERIAL_PORT_HARDWARE_OPEN
#else
#include <SoftwareSerial.h>
SoftwareSerial ticSerial(10, 11);
#endif

TicSerial tic(ticSerial);

int mapVal1 = 0;
int lastVal = 0;

void setup()
{
  // Set the baud rate.
  ticSerial.begin(9600);

  // Give the Tic some time to start up.
  delay(20);
  Serial.begin(9600);
  // Set the Tic's current position to 0, so that when we command
  // it to move later, it will move a predictable amount.
  tic.haltAndSetPosition(0);

  // Tells the Tic that it is OK to start driving the motor.  The
  // Tic's safe-start feature helps avoid unexpected, accidental
  // movement of the motor: if an error happens, the Tic will not
  // drive the motor again until it receives the Exit Safe Start
  // command.  The safe-start feature can be disbled in the Tic
  // Control Center.
  tic.exitSafeStart();
}

// Sends a "Reset command timeout" command to the Tic.  We must
// call this at least once per second, or else a command timeout
// error will happen.  The Tic's default command timeout period
// is 1000 ms, but it can be changed or disabled in the Tic
// Control Center.
void resetCommandTimeout()
{
  tic.resetCommandTimeout();
}

// Delays for the specified number of milliseconds while
// resetting the Tic's command timeout so that its movement does
// not get interrupted by errors.
void delayWhileResettingCommandTimeout(uint32_t ms)
{
  uint32_t start = millis();
  do
  {
    resetCommandTimeout();
  } while ((uint32_t)(millis() - start) <= ms);
}

// Polls the Tic, waiting for it to reach the specified target
// position.  Note that if the Tic detects an error, the Tic will
// probably go into safe-start mode and never reach its target
// position, so this function will loop infinitely.  If that
// happens, you will need to reset your Arduino.
void waitForPosition(int32_t targetPosition)
{
  do
  {
    resetCommandTimeout();
  } while (tic.getCurrentPosition() != targetPosition);
}

void loop()
{
  // Tell the Tic to move to position 100, and wait until it gets
  // there.
    // get the sensor value
  int val1 = analogRead(0);

 if (val1 != lastVal) {
   tic.energize();
   mapVal1 = map(val1, 0, 1023, -200, 200);
   Serial.print(val1);
   Serial.print(" ");
   Serial.println(mapVal1);
   tic.setTargetPosition(mapVal1);
   waitForPosition(mapVal1);
 } else {
   Serial.print(val1);
   tic.deenergize();
 }
 lastVal = val1;
 delayWhileResettingCommandTimeout(1000);
}

I suspect your Tic’s safe start error is getting triggered when you are de-energizing and trying to re-energize the motor. Could you try inserting a tic.exitSafeStart(); command after your tic.energize(); command and seeing if that fixes the problem?

Brandon

That did the trick! Thank you. Next I need to throw some debouncing in there, but it is getting very close to what I wanted.

1 Like