A bed-lift controller needs two separate functions: a motion-profile generator that defines how the commanded position advances with time, and a position controller that converts position error into a motor command. A position PID alone does not guarantee gentle motion; commanding the final position as an immediate step can make the controller demand rapid movement.
Separate Motion Shape From Position Correction
Generate an internal position setpoint that progresses toward the requested bed position and reaches the target with zero commanded speed. Feed this advancing setpoint—not the final-position step—into the position loop. The PID then corrects the deviation between the profiled setpoint and measured bed position while the profile determines the intended motion rate.
Select the Actuation Architecture
| Architecture | Feedback or model | Controller action | Key constraint |
|---|---|---|---|
| Profiled closed-loop position control | Measured bed position | Drive motor PWM from position error | The profile must advance with time and finish at zero speed at the target. |
| Bidirectional relay actuation with position feedback | Actuator-position signal, such as a voltage-divider slidewire | Energize one relay for each direction and match the controller demand to actuator position | This is a directional actuator scheme, not a direct description of PWM motor control. |
| Open-loop timed actuation | Defined stroke time in both directions; an additional motor-lag term may be included | Move for a calculated fraction of total stroke time in the required direction | Position is estimated from timing rather than measured directly. |
Implement and Verify the Control Path
- Accept the requested final bed position and generate a time-varying internal position setpoint that terminates at the target with zero commanded speed.
- Compare the internal setpoint with measured bed position and use that error as the position PID input.
- Route the PID output to the PWM command, preserving the required direction of travel. If the hardware instead uses two directional relays, implement the applicable closed-loop position or open-loop stroke-time method rather than treating it as PWM.
- Verify that the internal setpoint advances smoothly, the measured position follows it, the drive direction reduces position error, and commanded speed reaches zero at the target.
The evidence does not specify the motor, feedback device, PWM range, profile shape, PID gains, stroke times, or lag value. Determine those items from the actual mechanism and measurements; selecting exact values without them would be unsupported.
FAQ
Can a position PID move a bed slowly instead of as fast as possible?
Yes. Feed the PID a position setpoint that advances with time instead of applying the final position as an immediate step. End the profile at the target with zero commanded speed.
Should the PID output control motor PWM directly?
It can when the drive accepts a PWM command and direction is handled correctly. The available evidence does not define the PWM range or motor interface, so verify those details against the installed hardware.
Can bed position be controlled without position feedback?
A timed open-loop method can use defined stroke times in both directions and may include motor lag. It estimates movement from operating time, whereas closed-loop control compares the requested position with measured position.