Maybe someone has some insight into how linearactuators work, as I seem stuck in solving this. The motors extend at different speeds, whereas they should all extend at the same speed of 10mm/s.
I've a simple setup of 4 linear actuators wired in parallel and all connected to a double relais controlled by an arduino, just like in this example from https://starthardware.org/motorsteuerung-mit-einem-schaltrelais/
In general, two "identical" brushed DC motors (like the ones in the actuators), do not rotate at the same speed, even if the supply voltages are the same. There are always small manufacturing differences.
No two mechanical or electrical devices EVER stay in step without being forced to stay in step. Two identical free swinging pendulums will never stay in sync.
two initial ideas, though really, I have no clue, what's the best approach
a)
Attach an ultrasound distance sensor to each end of the motor, have an arduino based script read those measurements and control the relais to each actuator separately, thereby pausing the faster actuators until they are all evenly extended?
b)
experimantelly find the voltages at which all actuators extend at the same speed and then run each actuator with its individual voltage (worse approach than PWM control)
Sure, when starting afresh, that seems to be the best course of action.
But what about now, that the actuators are already bought?
Would an H-bridge consisting of 4 mosfets work to use as a PWN-control? Then calibrate the motors by adjusting each PWM-speed to make them extend at the same time?
I am familiar with coding and have built arduino controlled PWM systems with transistors before. What I don't know is, whether this is the best way to approach the problem.
Consider adding some feedback from the mystery project you are building. The position feedback does not really have to come from the actuators themselves.
jremington:
The 10 mm/s figure is only approximate.
In general, two "identical" brushed DC motors (like the ones in the actuators), do not rotate at the same speed, even if the supply voltages are the same. There are always small manufacturing differences.
In fact the speed is also affected by frictional losses too, which will vary as the brushes
wear, with temperature, and with dust contamination or simply age (bearings). Most motors
will have somewhat different speeds in the two directions too, due to timing-advancement of
the brushes in the forwards direction (gives better efficiency for forwards full speed).
But usually DC motors will match well (to a few percent), but for position control this is useless
as the integrated error is what matters for position, so the match must be exact, forever.
This is why you need either stepper motors (open loop) or closed-loop systems using position
feedback (typically using encoders).
The goal is to build a raisable desk. Each actuator will serve as a leg in order to raise & lower the desk. For that purpose it won't be neccessary for the motors to run in step. As long as the difference in speed isn't too high for the desk to tilt, it should be fine.
I have tried using L298N motor drivers to adjust the speed of each actuator via a PWM-Pin of the NodeMCU. While that does allow for speed adjustments, the actuators start sqeaking uncomfortably loud when the PWM-Value is lower than 1023 (e.g. analogWrite(actuator1, 800)), like a motor that doesn't have enough torque to move, even though they do move.
Wiring setup:
NodeMCU Pins:
VIN connected to 5V output of First L298N
GND connected to GND of power supply, also connected to First & Second L298N GND
D0 & D1: // Used for setting direction of the motors. (split 4 times)
D2 // PWM Pin for actuator #1
D3 // PWM Pin for actuator #2
D4 // PWM Pin for actuator #3
D5 // PWM Pin for actuator #4
First L298N:
12V & GND // comes from 300W 12V power supply
IN1 <-D0 // comes from D0 of NodeMCU
IN2 <-D1 // comes from D1 of NodeMCU
IN3 <-D0
IN4 <-D1
EnA <-D2
EnB <-D3
Out1&2: // actuator #1
Out3&4: // actuator #2
Second L298N:
12V & GND // comes from 300W 12V power supply
IN1 <-D0
IN2 <-D1
IN3 <-D0
IN4 <-D1
EnA <-D4
EnB <-D5
Out1&2 // actuator #3
Out3&4 // actuator #4
I don't know which actuators commercial units use. They must have different actuators, as from what I have seen, those are directly wired to a switch that controls the motion.
The really noisy squeaking sound made by the actuators came from using a too high PWM-Frequency, by lowering the PWM-Frequency to 244Hz, it's now possible to adjust the speed of each motor individualyl, without all the extra noise.
Why would the actuators sound, as if they were being hurt, when using a higher PWM-frequency? Am I free to use any frequency, where they don't emit strange sounds, or is there a best frequency?
The commercial units likely use 4 AC, reversible motors that can be stalled for a long time without damage. Each motor turns a threaded rod that turns inside a nut in the bottom half of the desk. Or could be mounted in the bottom and the nuts are in the top of each leg.
If the legs ever get out of alignment, just run the desk to the bottom until all 4 motors stall and then start raising the desk again. Simple.
Paul