I am trying to control the position of a linear actuator as shown in the following link
What I understood is that the motor rotates and the linear actuator moves upwards and downwards? The thing is that these linear actuators comes with analog sensor.
I do not know what these sensor can tell. I am guessing that the sensor is telling the position of the motor.
Problem:
Let's say the the linear actuator is totally retracted. Its analog sensor tells me "Zero". I want to move the linear part 1 inch. I move the motor using PWM and keep reading the sensor value. When sensor says that it is at "1V" then I stop moving.
The thing is that where can I find the data that corresponds the sensor output to the position of the linear actuator.
I have also got a DC motor ( 12V , 3000 rev/min, 2.5A). It has an optical encoder ( 2bit) with digital output. How can I control the motion of the motor by detecting the digital output? Its just binary output switching between o and 1.
Let's say the the linear actuator is totally retracted. Its analog sensor tells me "Zero". I want to move the linear part 1 inch. I move the motor using PWM and keep reading the sensor value. When sensor says that it is at "1V" then I stop moving.
The thing is that where can I find the data that corresponds the sensor output to the position of the linear actuator.
You could collect the data yourself using a voltmeter and a ruler.
where can I find the data that corresponds the sensor output to the position of the linear actuator.
Possibly on the manufacturers website ?
It has an optical encoder ( 2bit)
Can you please describe the encoder in more detail ? In principle it is simple to detect the rotation of a shaft with an encoder attached and count the pulses from it.
Erica1989:
It has an optical encoder ( 2bit) with digital output. How can I control the motion of the motor by detecting the digital output? Its just binary output switching between o and 1.
If there are two channels, it's probably a quadrature encoder. You need to know the start position but then you can count pulses to determine how much the motor has rotated.
Thanks for your replies. Please take a look at the following data sheet
It does not say what kind of sensor or encoder it comes with. It says something about Stroke sizes and Retraction. I do not know what are these quantities?
In case of counting the pulses coming from the encoder, How should I count them and make sense of them. Right the DC motor that I have has two digital outputs.
I posted the data sheet in my last reply. The data sheet does not have any data about linear actuator's displacement and sensor's output? The data sheet says that it has Hall effect sensor? Does Hall sensor generate analog signal or digital output?
I am unable to understand the concept of Arm Stroke. Can you give me some more advise on it? Plus Can I run it and measure the displacement of the linear actuator with ruler?
DuaneDegn:
If there are two channels, it's probably a quadrature encoder. You need to know the start position but then you can count pulses to determine how much the motor has rotated.
The thing is that if it is quadrature encoder than how can I tell the motor has moved 45 degrees?
jremington:
If the actuator has a "12 inch stroke", that means the arm can extend 12 inches.
If the encoder has 256 counts per revolution (1 revolution = 360 degrees) then there will be 256*(45/360) = 32 counts in 45 degrees.
The data sheet says that at 0 stroke , the actuator can retract 7.87 inches. I do not understand this. If the encoder has only ( 2 digital outputs)4 states per revolution then it can not detect 45 degree. Am I right?
So inorder to detect 45 degrees, I need 8 bit (256 counts or digital states) encoder.
Quadrature rotary encoders have two outputs, A and B, with four states.
Counts per revolution is a completely different specification, and is typically a power of two, between 4 and 2048. You can read about rotary encoders here.
The data sheet says that at 0 stroke , the actuator can retract 7.87 inches. I do not understand this.
You are not interpreting the data sheet correctly. Look at the table of hole to hole dimensions.
At 0 stroke, the fully retracted length and fully extended lengths are the same 7.87 inches. That is the physical size of the unit. Now a zero stroke actuator is pretty useless so let's say you bought one with a 6 inch stroke.
The fully retracted length of the unit is now 7.87 +6 inches = 13.87". The housing has had to grow by 6 inches to contain the longer arm when it is pulled back.
When it extends, the fully extended length is 13.87 +6 = 19.87 inches. The arm now stick out 6 inches from the housing.
jremington:
If the actuator has a "12 inch stroke", that means the arm can extend 12 inches.
If the encoder has 256 counts per revolution (1 revolution = 360 degrees) then there will be 256*(45/360) = 32 counts in 45 degrees.
This means that the quadrature encoder with 4 states 9 two digital outputs) can not represent 45 degrees! Am I right? It will only represent 90, 180, 270 and 360 degrees
I forgot to ask that in the following data sheet on page 1
it says that the Duty Cycle is 20% and low design < 45 db. What do these specs. mean?
I have controlled DC servo motors in the past using PWM. They way I did it was to take account the frequency at which the servo motor works for example the servo motor I used works at 50 Hz so I used the micro and programmed it's timer to count up. I used 1MHz clock so I divided 1 sec into 50 parts and each part was of 20msec.
The thing is that I do not know and do not know where does it mention in the data sheet that what is the frequency of this linear actuator or its motor.
the quadrature encoder with 4 states 9 two digital outputs) can not represent 45 degrees!
I don't know what you mean by "9". The 4 encoder states are used to count, as well as determine direction of rotation, and have nothing to do with the number of counts per revolution.
Just buy an encoder that suits your needs. There are (perhaps tens of) thousands of choices.
jremington:
I don't know what you mean by "9". The 4 encoder states are used to count, as well as determine direction of rotation, and have nothing to do with the number of counts per revolution.
Just buy an encoder that suits your needs. There are (perhaps tens of) thousands of choices.
9 did not mean anything. It was misprint. Two digital outputs ( 2 bit) mean 4 states. Which means that this encoder can only represent 90, 180, 270 and 360. And can not represent 45 degree angle. Am I right or wrong?
If I am right than how many states do I need to represent 45 degree.
Erica1989:
Two digital outputs ( 2 bit) mean 4 states. Which means that this encoder can only represent 90, 180, 270 and 360. And can not represent 45 degree angle. Am I right or wrong?
If I am right than how many states do I need to represent 45 degree.
The encoder is much, much finer than 90 degrees, but the pattern repeats over and over. This means that you have to count the changes as the arm moves.
The reason that there are two bits is that if there was only one bit, then you would not be able to tell which direction the arm was moving, only how fast it was going. With two bits (call 'em A and B), when the arm moves one way the state of B will follow A and when it moves the other way A will follow B.
Direction X
A ** ** ** **
B * ** ** **
31023102310231
Direction -X
A * ** ** **
B ** ** ** **
32013201320132
So the algorithm is:
watch to see if A or B change (your loop should run fast enough to never see them both change at the same time).
If A has changed, then if A==B the count is +1, else it is -1
If B has changed, then if A==B the count is -1, else it is +1
Having said that, if your code is moving the arm, then you can get by by just counting the changes on one of the bits.
PaulMurrayCbr:
The encoder is much, much finer than 90 degrees, but the pattern repeats over and over. This means that you have to count the changes as the arm moves.
The reason that there are two bits is that if there was only one bit, then you would not be able to tell which direction the arm was moving, only how fast it was going. With two bits (call 'em A and B), when the arm moves one way the state of B will follow A and when it moves the other way A will follow B.
Direction X
A ** ** ** **
B * ** ** **
31023102310231
Direction -X
A * ** ** **
B ** ** ** **
32013201320132
So the algorithm is:
watch to see if A or B change (your loop should run fast enough to never see them both change at the same time).
If A has changed, then if A==B the count is +1, else it is -1
If B has changed, then if A==B the count is -1, else it is +1
Having said that, if your code is moving the arm, then you can get by by just counting the changes on one of the bits.
So, I am wrong! I connected the two digital outputs of the encoder to oscilloscope . They were switching constantly. Probably telling the direction of the motor and how much motor has moved in degrees. Direction can be predicted but how can I predict the angle of the motor with just 2 bits.
It could be that if its 0 0 then 90
0 1 then 180
1 0 then 270
1 1 then 360
I am sorry for asking these questions but is it not true that I can not use this encoder to detect 45 degree angle. I mean how?
Use the A/B outputs to count steps. For Arduino, there is an encoder library for that purpose.
When the motor has stepped by (1/8) of the number of counts per revolution, it has moved 45 degrees.
I take it you are not bothering to read any of the information posted on the web about encoders and stepping motors.