I don't understand how connect HS1 servo motor to arduino uno

I have connected the LSS adapter to Arduino uno board, and installed the LSS library for Arduino, but for some reason it’s not working, do I have to connect a power supply to the board and the servo motor? Apologies for the inconvenience, but I tried to look a lot for some resources and I couldn’t find helpful resources

1 Like

Hi @RoryGilmore and welcome to the RobotShop Community.

Yes, the Arduino board cannot power motors directly. We suggest the following 12V power supply:

Apologies for the inconvenience, but I tried to look a lot for some resources and I couldn’t find helpful resources

1 Like

Thank you for your reply @cbenson it worked finally! But, I am trying to open and close the gripper but I couldn’t find any relatable resources for configuring the gripper with the arduino, can you share some resources if available.

Also, I am using the adapter so if I want to connect each servo motor to a separated port in the adapter instead of connecting them in series how can I configure that in arduino ?

Thank you again

To be certain, can you provide a few photos of your setup, especially showing the electronics and servos and how they’re all connected?

I couldn’t find any relatable resources for configuring the gripper with the arduino, can you share some resources if available.
The “gripper” is not treated any differently than a normal servo, except you need to determine the maximum closed and open angles. For Arduino, we have a basic library which you can look at (but not necessary):
LSS Libraries & Examples

Also, I am using the adapter so if I want to connect each servo motor to a separated port in the adapter instead of connecting them in series how can I configure that in arduino ?

You don’t - all six connectors are on the same communication bus. The Adapter simply ensures that more servos can be connected to the BUS.

1 Like

the servos are HS1 and the gripper motor is ST1
I didn’t connect the power supply, I just wanted to show you the connections I made


Is it better to connect each servo to a different port in the adapter or should I connect all the servos in series ?

Also, I’m having an issue where, in my Arduino code, the servos aren’t responding to the input I provide (e.g., the desired position). However, when I use a regular micro servo motor, it responds correctly to the user’s input. I’m not sure what could be the error.

Ok. We assume you have the 12V power supply with XT60 connector?

Is it better to connect each servo to a different port in the adapter or should I connect all the servos in series ?

With only three servos, it’s fine to connect them to one port. It’s all a question of total current consumption.

Also, I’m having an issue where, in my Arduino code, the servos aren’t responding to the input I provide (e.g., the desired position).

Remember there’s a three-way switch on the adapter: USB / XBEE / Arduino. This determines what is able to send commands on the bus. If you’re using an Arduino board and its Tx / Rx pins, then you need to set it to Arduino. However if you’re using only the Arduino software and connecting via USB, then you need to set the board to USB.

However, when I use a regular micro servo motor, it responds correctly to the user’s input. I’m not sure what could be the error.

The LSS are not controlled at all like a normal RC servo motor - they use serial commands.

yes I have the 12V power supply with XT60 connector.

So, if the arduino board is connected to the laptop via USB and the user is entering some inputs, the three-way switch of the adapter should be on USB? I have just tried that and it didn’t work, can you correct me if I’m wrong

Thank you

Not sure I understand. You’re connecting an Arduino board to the LSS adapter how, and how is the computer involved? Normally an Arduino can communicate with a computer via USB, but it’s intended to be stand-alone and make use of its IO pins. If it’s shield-stackable (same as an Arduino Uno) you can stack it. Very basic code should include setting up the COM (baud etc.) and send a single serial print line command.

You should start with only one servo connected to the board, ensuring you know its ID and baud rate. Get to know the serial commands and start with a single D command like #0D300 or #0D300 (serial print line) to move it to 30.0 degrees.

Side note: If you pressed the button at the back of the servo, there’s a chance it’s no longer in serial mode. if you didn’t then don’t press it.

The adapter is stacked directly on top of the Arduino Uno. I then connect the Arduino to my laptop via USB to upload the code. This USB connection should also allow to receive inputs from the user through the Serial Monitor in the Arduino IDE.

If you’re trying to use D0 and D1 to communicate with both the servos and via USB to the computer, to the best of our knolwedge, that is not possible.

D0 (RX) and D1 (TX) on an Arduino Uno are used for serial communication with secondary devices and cannot simultaneously be used to communicate with a computer via USB as it can cause conflicts. Here’s why:

D0 and D1 are the pins used for hardware serial communication on the Arduino Uno. They are directly connected to the USB-to-serial converter (ATmega16U2 chip) that handles communication between the Arduino and the computer. When you upload code or send data to the Arduino via USB, this connection is active. If you try to communicate with a secondary device using these same pins, it can interfere with the USB communication.

You can try using software serial on D8 and D9 and set the switch to XBee which connects those pins to the Arduino. Your code would need to be modified to use software serial with those pins. It was not intended for this, but it’s worth a try.

1 Like

The adapter is stacked with the Arduino Uno, so the servos are not connected to D0/D1.

There has been some progress: when the user provides a position input to the Arduino via the Arduino IDE and USB, the adapter switch is initially set to USB. After entering the position, I switch the adapter to Arduino, and the actuation occurs successfully.

Regarding the gripper (ST1), I was trying to use the LSS_Sweep example code from the LSS Arduino library with different angles, but the gripper isn’t moving, even though the same code works for the HS1 motors.

I’m also facing an issue with controlling the two motors separately when they are connected in series—I still haven’t been able to control each motor independently.

Here’s an example of code I modified to give each motor a different speed. However, both motors are still rotating at the same speed of 100 RPM:


#include <LSS.h>

#define LSS_BAUD (LSS_DefaultBaud)

// Choose the proper serial port for your platform

#define LSS_SERIAL (Serial) // ex: Many Arduino boards

//#define LSS_SERIAL (Serial1) // ex: Teensy

// Create two LSS objects

LSS myLSS1 = LSS(1);

LSS myLSS2 = LSS(2);

void setup()

{

// Initialize the LSS bus

LSS::initBus(LSS_SERIAL, LSS_BAUD);

// Wait for the LSS to boot

// Move the LSS continuously in one direction

myLSS1.wheelRPM(100);

myLSS2.wheelRPM(10);

}

void loop()

{

// Nothing to do in loop

}

There has been some progress: when the user provides a position input to the Arduino via the Arduino IDE and USB, the adapter switch is initially set to USB. After entering the position, I switch the adapter to Arduino, and the actuation occurs successfully.

The approach you are taking is really a fringe case where you’re using the Arduino as intermediary for normal serial commands. Do you plan to connect other devices to the Arduino, or just the LSS? If just the LSS, why not only use the LSS Adapter (connected to the computer via USB) and remove the Arduino?

The adapter is stacked with the Arduino Uno, so the servos are not connected to D0/D1.

Negative. If the Adapter is stacked and the switch is set to Arduino, the Tx / Rx lines are connected to D0 and D1 and cannot be used with the USB connection to the computer. You need to use software serial if you want to use both the USB and the servos, and change the switch to XBee, which connects the servo bus to D8 and D9. Your code does not use these pins, so you’re still trying to use D0 and D1 to communicate with both the bus and the computer.

but the gripper isn’t moving

Remove the jaws to ensure that you’re not commanding the servo to move to a position where it’s blocked.

I’m also facing an issue with controlling the two motors separately when they are connected in series

Have they been assigned their own ID via the LSS Config? Does your code use those IDs?

Before delving into custom code and uncertaintly, to confirm, have you:

  1. Used the LSS on their own with the LSS Adapter and the computer and been able to control each independently from the computer via the LSS Config software?
  2. Have you tried creating a simple program to upload to the Arduino to have the servos move (for example rotate back and forth at different speeds) without the use of the computer?
1 Like

I’m working on a project where I’m designing a robot arm for pick-and-place tasks connected to an Arduino microcontroller. The setup includes limit switches and an emergency shutdown, all wired to the Arduino Uno. The system should prompt the user to enter the desired pick-and-place positions, and the robot arm will perform inverse kinematics to move accordingly.

I’m uncertain if connecting the adapter via USB will allow me to both take user inputs and connect the limit switches and emergency shutdown, while still being able to run the inverse kinematics analysis. Also, I need to display both the desired position and the actual measurements in real time.

[quote=“cbenson, post:13, topic:109156”]

I was able to configure and control each servo individually, but when trying to configure all of them together, it’s not working, and I can’t figure out why this is happening.

Unfortunately, I can’t do that right now because I don’t have batteries to provide input voltage to the Arduino separately from the laptop, but I will try to do that soon.

As such, you’ll need to use software serial to communicate with the servos (setting the switch on the LSS Adapter to XBee). This should free up D0 and D1 for the USB connection. The LSS Arduino Library doesn’t use software serial, so you’ll need to eitehr modify that code, or create your own.

If you were able to set the ID for each servo, then it’s more than likely each of them works. However if you want to “configure” them all at the same time via the LSS Config software, you need to use the broadcast ID (at the top of the servo list, you’ll see under 3 a 254 - All:


Note that you should not be constantly reconfiguring the servos. Ideally you would do this once and then use action commands. If you are indeed reconfiguring all of the servos a lot, please explain more?

2 Likes

I am trying to measure the position of the servo motor, using the LSS_Query example from the LSS Arduino library. However, it consistently returns a measured position of 0, even when the motor’s actual position is not zero.

1 Like

Hi RoryGilmore,

The first thing I would try is our example in the library:

This will take the position of one LSS and send it to the second LSS.

Make sure to set your IDs accordingly.

:slight_smile:

1 Like

I just attempted to upload this code, but the second motor is not mimicing the movements of the first one.

The first thing I notice is the jumpers on the LSS Adapter; please remove them.

2 Likes

The measurment works now
Thank you.

2 Likes

Hello,

I am working on a 2-DOF robot arm for pick-and-place tasks. I am using two HS1 servo motors, and for the gripper, I am using a standard servo motor (not LSS).

The inverse kinematics calculations and position measurements work perfectly on its own. However, once the gripper is introduced into the code, everything gets disrupted. The position measurements always return zero, and although the inverse kinematics calculations are correct (as shown in the attached picture), the motors do not actuate properly. For example, for coordinates x=0 and y=30, the IK calculations return theta1=90 and theta2=0, but in reality, the motors remain at zero degrees. The same issue occurs for other coordinates. Even when it occasionally works, it becomes inconsistent and disrupts everything again.

I’ve verified that the gripper is powered correctly with a separate power supply. The gripper works well in the integration but the issue is with the motor actuation and position measurments.

I tried a lot but I couldn’t identify what is causing this problem when the components are integrated, even though each part functions perfectly in isolation.

I don’t think I am allowed to share the code in public maybe if I can send it to you privately, but I believe it follows a logical flow.

1 Like