18v7 SMC with linear actuator (w/pot)

Hello,

I want to control a linear actuator (w/pot) with a 18v7 SMC using RC for a steering mechanism. I’ve been using a Arduino with a much simpler motor controller. I’m using the Arduino to get the steering to return to center when the RC controller is at center. Is there a way, can you direct me to a lead where I can eliminate the Arduino, or do you think I should keep using it? Thanks for any help.

Paul

Hello, Paul.

It sounds like you want to do closed-loop position control using a feedback potentiometer on your linear actuator and controlled with an RC signal. The Simple Motor Controllers (SMC) do not directly support closed-loop position control like this. If you want to do closed-loop position control with the SMC, you would need to use a separate microcontroller (like your Arduino) to process your feedback and input signals and send TTL serial signals to the SMC.

Alternatively, you could use one of our Jrk Motor Controllers with Feedback. These controllers can be configured for closed-loop position control using analog feedback, and they can accept RC signals as an input.

Brandon

Yes, exactly. Thanks for your response. I discovered what you’re telling me as I looked deeper into the capabilities of the SMC. The Jrk controllers are sexy but for my budget, I’m going to have stick with the Arduino. The code provided in the user guide is extremely helpful. Thanks again!

Paul

Actually this isn’t working. Even the example code stalls with errors (format and noise). My code, my logic, which works with a much cheaper IBT-2 (except that it uses digital signals), will not with the 18v7 SMC. Besides the format and noise errors, it appears the SMC isn’t responding to the instructions clearly. I’m just about to give up on the SMC. Here is my code:

#include <SoftwareSerial.h>
#define rxPin 2  // pin 2 connects to smcSerial TX  (not used in this example)
#define txPin 3  // pin 3 connects to smcSerial RX
SoftwareSerial smcSerial = SoftwareSerial(rxPin, txPin);

const int SAPpin = A1;    // Steering Actuator Pin
const int RCPpin = 4;     // Remote Control Pin
const int SAPMax = 900;   // actuator max
const int SAPMin = 50;    // actuator min
const int RCPMin = 1000;  // RC pot min
const int RCPMax = 2000;  // RC pot max
const int precision = 20;  //how close to final value to get
const int interval = 50;  //how often position is checked (milliseconds)

int SAPval = 0;
int target = 0;
int difference = 0;


void setup()
{
  pinMode(SAPpin, INPUT);        // St Actuator Pot
  pinMode(RCPpin, INPUT);        // RC St Pot

  smcSerial.begin(19200);
  delay(5);
  smcSerial.write(0xAA);  // send baud-indicator byte
  exitSafeStart();  // clear the safe-start violation and let the motor run
}

void loop()
{
  SAPval = analogRead(SAPpin);    // StAct
  target = map(pulseIn(RCPpin, HIGH), RCPMin, RCPMax, SAPMin, SAPMax); // Calculate the target position of the RC control
  difference = abs(SAPval - target);

  if (target < SAPval && difference > precision) moveLeft(3200);
  else if (target > SAPval && difference > precision) moveRight(3200);
  else stopMovement();

  delay(interval);
}

void moveLeft(int speed)
{
  smcSerial.write(0x86);  // motor reverse command
  smcSerial.write(speed & 0x1F);
  smcSerial.write(speed >> 5);  
}

void moveRight(int speed)
{
  smcSerial.write(0x85);  // motor forward command
  smcSerial.write(speed & 0x1F);
  smcSerial.write(speed >> 5);
}

void stopMovement()
{
  smcSerial.write(0xE0);  // motor stop command
}

void exitSafeStart()
{
  smcSerial.write(0x83);
}

Please let me know if you see something I’m doing wrong.

Do you get any response from the motor connected to the SMC? Can you be more specific about the “format and noise errors” you mentioned? Are you receiving errors on the SMC (e.g. is the red error LED turning on)? If so, can you connect it to the Simple Motor Control Center and see which errors are being indicated in the “Status” tab? Please note that you should pay attention to the “Count” column and not just the “Stopping motor” column.

Could you try using the “Simple Example” code in the “Arduino Examples” section of the Simple Motor Controller User’s Guide and see if you get the same errors? Could you post pictures of your system that show all of your connections? Also, could you post your Simple Motor Controller settings file? you can save your settings file by selecting the “Save settings file…” option found within the “File” drop-down menu in the Simple Motor Control Center (with the SMC connected).

Brandon

The problem seems to be caused by the connection to the linear actuator pot. There are serial errors (noise and format), but the red flag comes up on the Safe Start Violation with a Yes. If I disconnect the pot from the Arduino, the sample code works fine. The pot is connected to an analog input pin on the Arduino. Can you think of any reason that would cause interference? If I can’t use my linear actuator, I obviously can’t use this device. I know the LA is working because I hooked everything up to my old IBT-2 and it worked fine. I’m attaching my settings file in case you find it useful.

smc_settings1.txt (3.0 KB)

Thank you for the additional information. It sounds like the Simple Motor Controller is working correctly, and I suspect there might be a problem with the potentiometer on your actuator or some other problem in the connections. For example, if the potentiometer is connected incorrectly, it could be causing a short and browning out the Arduino (which might explain the “Safe Start Violation” error). You should be able to test your potentiometer connections separately. If you disconnect your potentiometer from the Arduino and measure the resistance between the ground and power wires of the potentiometer, you should see the resistance stay the same as the actuator moves. If the resistance changes between those wires, you are probably using the wrong connections.

Brandon

Thank you for your general objectivity on this issue. Trying one more time, I disconnected everything from the Arduino except the TX wire to the SMC. Only the motor wires from the actuator are connected to the SMC. The sample code runs for a good while, but still ends in safe start and serial errors.

Unfortunately, and with my apologies, I have lost my patience with this product. My Arduino logic works fine with my old IBT-2 to which I will revert. Thanks again for your help.