hi, with an RC linear actuator is it possible to find the position of the actuator whilst moving?
Thanks
hi, with an RC linear actuator is it possible to find the position of the actuator whilst moving?
Thanks
What linear actuator?
Post a link to its datasheet or user manual.
...R
We will know more when we have details of the hardware, but in general if you want to move from position 0 to position 99 and you do it in 100 steps then you will always know where the actuator is, apart from any overrun caused by the motor not stopping immediately and running on a little and the time taken to reach the new position. Some actuators have the ability to feed back their actual position or work as a servo and remain in the position commanded using internal feedback.
ttps://www.robotshop.com/media/files/pdf/L16_Datasheet-2.pdf
Thanks.. all I want to know, is when the actuator moves if I can see it on the serial monitor! - Its an RC linear actuator, so it doesn't have a position feedback- not sure if it will still work!
Assuming you have the -R version the position seems to be determined by a standard servo signal. That means that the actuator should extend by an amount dependent on the signal you send. As you know what signal you give it you should know how far it has extended without needing any other feedback.
If you look at the servo-sweep example you will see how to move a servo in small increments. That would allow you to update the position display as the actuator moves.
...R
Thanks- yeah I tried this- but it doesn't seem to show me anything
//
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
void setup() {
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
** Serial.println(myservo.read());**
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
//
please use code tags.
this code will take 5.4 seconds to complete: print a zero, then sweep the servo to 180°, and sweep it back to 0°. Then print a zero, do the sweep, etc.
Thanks- I dont quite understand what ' print a zero' means, ( I am quite new to this software!)
Thanks!
MB94:
Thanks- yeah I tried this- but it doesn't seem to show me anything
How do you expect it to show you anything when you have not added any Serial.print() statements?
...R
Let's just cut to the chase
Try this
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int pos = 0; // variable to store the servo position
void setup()
{
Serial.begin(9600);
myservo.attach(9);
void loop()
{
Serial.println(myservo.read());
for (pos = 0; pos <= 180; pos += 1) // goes from 0 degrees to 180 degrees
{
// in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
Serial.println(pos);
delay(100); // waits 100ms for the servo to reach the position
}
for (pos = 180; pos >= 0; pos -= 1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
Serial.println(pos);
delay(100); // waits 100ms for the servo to reach the position
}
}
Open the Serial monitor and make sure that the baud rate is set to 9600. What do you see in the monitor ?