LSS ST1 fine remote control with nRF24L01 (difficulties)

I am using LSS ST1 servos in a project that requires smooth increments according to remote commands.

I have an ST1 connected to an LSS Adapter, and this one stacked in an Arduino Uno. And in this set I also have an nRF24L01 module to receive commands, which will increase (or decrease) the position of the servo.

In the other hand I have a custom DIY controller (nRF24L01-based) that send commands to the receiver.

WHAT I EXPECT/NEED: smooth movements regardless of the value to be increased/decreased.

WHAT I’M GETTING: pauses between increments (although commands are continuous).

I made a video (https://www.youtube.com/watch?v=Kvw6UU3aEFA) to show what is going on. First, with larger increments, it seems to move more smoothly, although you can hear that the motor make a brief stop. Second, with smaller increments, the pauses between increments are very clear.

And here is my code:

#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include <LSS.h>

int recebidos[1];
RF24 radio(4,2);
const uint64_t pipe = 0xE14BC8F482LL;

#define LSS_ID    (0)
#define LSS_BAUD  (115200)

LSS myLSS = LSS(LSS_ID);

float a;

void setup()
{  
 LSS::initBus(Serial, LSS_BAUD);
  
 radio.begin();
 radio.openReadingPipe(1,pipe);
 radio.startListening();

 myLSS.move(0);
}

void loop()
{
  if (radio.available())
  {
      radio.read(recebidos, 1);
           
      if (recebidos[0] == 1)
       { a+=5; }
            
      if (recebidos[0] == 3)
       { a-=5; }
       
      if (recebidos[0] == 13)
       { a+=1; }
            
      if (recebidos[0] == 15)
       { a-=1; }


     
     if (a > 900) a=900;  if (a < -900) a=-900;
     myLSS.move(a); 
     
  }
}

I have to say that programming is not my best. So, any ideas for smooth movements?

Note: my set is from beta.

I’ve made some progress by disabling motion control with the command EM0 (#0EM0) with the LSS Config and this partially solves the difficulties (at least it is a temporary solution).

The only problem that remains is that when the servo power is turned off, that command is lost. So, what I need now is just a command to incorporate in the Arduino code.

Tried with the example “LSS_Configure_Once” from LSS Arduino library, but it did not work… but I’m sure I’m missing something very simple. :sweat_smile: So I would appreciate your help. :slight_smile:

Just an additional piece of info… tried this:

	myLSS.setMotionControlEnabled(bool value);

But it seems like the library doesn’t recognize that.

The beta hardware has seen many improvements, both on the electrical and firmware fronts. Therefore, some issue may be derived from the beta state of the product alone. That being said, improvements are always possible.

Depending on the version of firmware running on your BETA hardware, it is possible CEM was not active on that version. This commands allows you to store permanently a change to the motion control (survives power cycling). For example, #0CEM0\r. You can also change that setting in the command line of the LSS Config.

Interesting. Please open an issue here and add any relevant details. Once it is open it will be assessed.

Sincerely,

1 Like

Hi, scharette! Thanks for your reply.

Tried #0CEM0\r and #0EM0\r with the command line of the LSS Config, but it did not work.

Am I writing correctly that command? I mean: must be everything exactly like this “#0EM0\r” in the same line?

The firmware is “Special version 367 [Hardware Type 1]”.

1 Like

scharette, it must be a stupid question, but before opening an issue, I prefer to ask and maybe you can help…

It must be like this?

myLSS.setMotionControlEnabled(false);

Indeed, CEM is not available in 367, type 1 or 2.
I’ll see about uploading a copy of the newest version’s current release candidate (fully tested) under experimental.

Yup! Nothing stupid about it at all! :slight_smile:
The issue is that when the library was made we didn’t expect mode 0 (EM0) to be used much but it ended up being quite useful. Therefore, the newest (experimental) firmware now has a CEM command (to set the EM value permanently), which the library does not know about (it didn’t exist at the time). There will be an update to the library once the new firmware is officially out.

For now, you can just send it yourself! The current function (LSS.cpp, line 1363-1366) does this:

bool LSS::setMotionControlEnabled(bool value)
{
  return (LSS::genericWrite(this->servoID, LSS_ActionEnableMotionControl, value));
}

Where LSS_ActionEnableMotionControl is equal to “EM”.

You could simply add a command in your main file with something along the lines of:

bool LSS::setMotionControlEnabled(bool value)
{
  return (LSS::genericWrite(this->servoID, "CEM", value));
}

Of course, this will only work with the newest experimental version, for hardware type = 1 in your case (which I’ll be adding soon. I’ll post again here once it is available).