Controlling Lynxmotion HT! Smart Servo using two pins of artemis Red board form Sparkfun

What I need to do is to control a Lynxmotion Smart Servo HT1 using two pins off the board I am using. I want to use the soft serial library. What do I need to do to make this happen?

1 Like

Hi @robomaster_1,

Well, controlling any LSS simply requires 2 things:

  • A proper power source connected to the VCC & GND pins. The recommended voltage for optimal use is 12 V DC. Lower voltages will results in lower maximum speed and torque and higher voltages (LSS can support 3D LiPo fully charged) will increase maximum speed and torque slightly but also heat produced.
  • 3 wires from your microcontroller board to the LSS bus: TX, RX (TTL UART interface, 5 V DC) and a common GND.

From what I can see, the Sparkfun board is 3.3 V DC only so do not connect it directly to the LSS Adapter Board or the LSS-HT1 on its own as it could damaged its I/O pins.

You’ll will either need a level translator (3.3 V DC <> 5.0 V DC) or connect your TX/RX through the XBee socket of a LSS Adapter Board (it has an on-board translator there for 3.3 V DC electronics).

Sincerely,

Thank You for help. I got a hold a Logic Level Converter board from spark fun hook it up and got it to flash on the servo between red and white on the bar on the servo do not know what it means. Still not sure if I got my to send out the correct serial protocol or that I got it hooked up correctly.

Code:

/*
  Software serial multple serial test

 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.

 The circuit:
 * RX is digital pin 10 (connect to TX of other device)
 * TX is digital pin 11 (connect to RX of other device)

 Note:
 Not all pins on the Mega and Mega 2560 support change interrupts,
 so only the following can be used for RX:
 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

 Not all pins on the Leonardo and Micro support change interrupts,
 so only the following can be used for RX:
 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

 created back in the mists of time
 modified 25 May 2012
 by Tom Igoe
 based on Mikal Hart's example

 This example code is in the public domain.

 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 9); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
  
  Serial.println("#0D0#1D1#0D-1800#0D1800#");

 
}

void loop() { // run over and over
 {
  Serial.println("#0D0/r#1D1/r#0D-1800/r#0D1800/r");
  delay(500); 
  }
}
1 Like

I forgot to ask is there a schematic of the LLS adapter board that I can look at. To get some idea on how hook up to the servos?

1 Like

That is my preferred board for these kind of tasks! Cheap, efficient and even supports I2C bidirectional communication! :slight_smile:

You probably want to change the two uses of Serial to mySerial, right? Otherwise it will most likely not work.

Have a look at the wiki at these links:

When the Servo LED strip flashes between red and white what does it mean?

1 Like

Typically, a command that is not recognized.
See the details here (Wiki).

Thank You for the information. I have gone back to using the arduino UNO board. Was successful to it to work with LLS library bye just connecting the serial pin to the servo without using the LSS adapter board. Works fine. Now I need to if I can command it without using the library by using the softwareSerial library. Below is the code I am using that caused that error. Should I be sending out as a string or raw data?

/* Test Code ***********************************************************
/*
  Author: Nathan Seidle
  SparkFun Electronics
  Created: June 19 2019
  License: MIT. See SparkFun Arduino Apollo3 Project for more information

  Feel like supporting open source hardware? Buy a board from SparkFun!
  https://www.sparkfun.com/artemis

  This example shows how to send characters at 9600bps. Any pin can be used for
  TX or RX.

  Note: In this SoftwareSerial library you cannot TX and RX at the same time.
  TX gets priority. So if Artemis is receiving a string of characters
  and you do a Serial.print() the print will begin immediately and any additional
  RX characters will be lost.  

  Hardware Connections:
  Attach a USB to serial converter (https://www.sparkfun.com/products/15096)
  Connect
    GND on SerialBasic <-> GND on Artemis
    RXO on SerialBasic <-> Pin 8 on Artemis
  Load this code
  Open Arduino serial monitor at 57600
  Open Terminal window (TeraTerm) at 9600
*/

#include <SoftwareSerial.h>
SoftwareSerial mySerial(0, 1); //RX, TX - Any pins can be used

int counter = 0;

void setup() {
  //We set the serial monitor speed high so that we spend less time printing the output
  Serial.begin(115200); 
  Serial.println("Software Serial Example");

  mySerial.begin(115200);
}

void loop() {

//  mySerial.print("Hello world: ");
//  mySerial.println(counter++);
//  Serial.println(counter++);

  Serial.write("#0D0#0D-1800#0D1800# ");
  Serial.println("#0D0#0D-1800#0D1800# ");
  
  delay(500); //Small delay because it takes time to send chars at 115200bps
}
1 Like

I am not sure how to bit bang the commands out the servo in this format ( #0D1800)
using the Software Serial Library. Thank You for all your help.

1 Like

No problem!

Sounds good! Just be careful not to accidentally connect to the VCC of the LSS bus (typically 12 V DC).
On that front, if you are not using the LSS Adapter Board (and power supply), what are you using to power your LSS?

You can, but please note the LSS Arduino Library does support use of the official SoftwareSerial library. Simple pass the your mySerial object directly to the initBus() function instead of the Serial one.

If you still want to handle the communication directly, simply follow the examples available on the Wiki, such as (here).

In your case, you have:

I suggest sticking to .write() and you’ll need to add \r between commands. Ex:

Serial.write("#0D0\r#0D-1800\r#0D1800#\r");

The reason you get red-white LED display is most likely because of println("#0D0#0D-1800#0D1800# ") passing of as one command (println() adds \3\n at the end).

I was able to get working but had to hook up to TX0 And DX0 pins that come out J7 connector. Once I did that it works. I don’t know why I can’t use any of the other pins. Below is the working code. Again thank you for all your help.

/*
  Software serial multple serial test

 Receives from the hardware serial, sends to software serial.
 Receives from software serial, sends to hardware serial.

 The circuit:
 * RX is digital pin 9 (connect to TX of other device)
 * TX is digital pin 10 (connect to RX of other device)

 Note:
 Not all pins on the Mega and Mega 2560 support change interrupts,
 so only the following can be used for RX:
 10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

 Not all pins on the Leonardo and Micro support change interrupts,
 so only the following can be used for RX:
 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

 created back in the mists of time
 modified 25 May 2012
 by Tom Igoe
 based on Mikal Hart's example

 This example code is in the public domain.

 */
#include <SoftwareSerial.h>

SoftwareSerial mySerial(49, 48); // RX, TX

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }

  // Servo Command Select servo zero
  Serial.println("#0D0");
 // Servo Command Select servo one
  Serial.println("#1D0");
 
}

void loop() { // run over and over
 {

  
  
  // Servo Command Move Sevo Zero 180 Degrees
 Serial.println("#0D1200 "); delay(2000); Serial.println("#0D-1200 ");
  delay(2000); 
  Serial.println("#1D500 "); delay(2000); Serial.println("#1D-500 ");
 
  }
}
1 Like

Good to know.

Might be an issue with how the Sparkfun Red Board is designed. I recommend contacting the manufacturer for further help on this now that we’ve eliminated all LSS related issues (that we know of! :stuck_out_tongue: ).

:+1: