<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  <title>Rashid Al-Ma&#39;awali — Writing</title>
  <subtitle>Notes on embedded control, robotics, and mechatronics.</subtitle>
  <link href="https://astromyth101.github.io/feed.xml" rel="self" />
  <link href="https://astromyth101.github.io/" />
  <updated>2026-06-20T00:00:00Z</updated>
  <id>https://astromyth101.github.io/</id>
  <author>
    <name>Rashid Al-Ma&#39;awali</name>
  </author>
  <entry>
    <title>Holding a grip without a second control loop</title>
    <link href="https://astromyth101.github.io/blog/holding-grip-with-hysteresis/" />
    <updated>2026-06-20T00:00:00Z</updated>
    <id>https://astromyth101.github.io/blog/holding-grip-with-hysteresis/</id>
    <content type="html">&lt;p&gt;The rehab-glove controller runs a proper PID loop while it inflates a finger — error,
deadband, anti-windup, the whole thing. So the obvious instinct is to reach for a second PID
loop on the vacuum side to &lt;em&gt;hold&lt;/em&gt; the hand open. I didn’t, and the reason is worth writing down.&lt;/p&gt;
&lt;p&gt;The hold state doesn’t need precision; it needs to &lt;strong&gt;stay put cheaply&lt;/strong&gt;. The vacuum pump is
switched by a relay, and a relay is a bad place to ask for fine, continuous modulation: it
can’t really PWM, and rapidly toggling it just wears the contacts. A PID loop on top of a
relay would chatter — constantly nudging an actuator that only has “on” and “off” to give.&lt;/p&gt;
&lt;p&gt;So the open-hand hold (&lt;code&gt;HOLD_VAC&lt;/code&gt; in the state machine) uses &lt;strong&gt;bang-bang hysteresis&lt;/strong&gt; instead.
The pump stays off until leakage drifts the flex reading past a tolerance band (~±100 ADC
counts around the open-hand target); then it bumps on just long enough to pull the hand back,
and switches off again. One comparison, a tolerance band, done.&lt;/p&gt;
&lt;p&gt;The payoff is more than simplicity. There’s no integral term to wind up while the system sits
idle at setpoint, the relay clicks a handful of times instead of thousands, and the controller
spends most of the hold drawing almost no power. It’s a small decision, but it’s the kind that
separates control logic that survives the bench from control logic that only works in
simulation: &lt;strong&gt;match the controller to the actuator you actually have.&lt;/strong&gt;&lt;/p&gt;
</content>
  </entry>
</feed>