The relay is NAIS (Panasonic) TXS2-4.5V. Its footprint is 0.6in by 0.3in. The coil has a resistance of 405Ω. On a 4.5V power supply with the coil switched by its NC contact the frequency is 300Hz. The pin for the common contacts are between NC and NO. Larger relays with a 0.2in pitch usually have the common contacts pinned out on one side of the other contacts. I avoided those in case their capacitance is not symmetric enough.
Sensing armature position
In a double-throw relay, there is capacitance between the common terminal and either throw on the order of 1pF. It should increase as the contacts get closer. It reaches infinity as the contacts touch. That means there should be a position where the two sides have the same capacitance. I should try to keep the relay armature around that point.
Some MEMS sensors measure capacitance imbalance of this magnitude. There is an example on page 3.16 of Linear Circuit Design Handbook:
My approach is basically the same. The clock is 8MHz. Amplifier A1 is cascaded unbuffered CMOS inverters (SN74AHCU04). The output of the third stage is a full-scale square wave depending on which side has more capacitance. Prior stages give square waves of smaller amplitudes. The synchronous modulator is an xor gate. My setup only compares which side has more capacitance. Enough for my purpose.
Both sets of the relay’s contacts are used. The 0° clock is applied to the NC terminal of the first set of contacts and the NO terminal of the second set. The 180° one is applied to the other two contacts. The two sets' outputs are averaged with 330Ω resistors and filtered with a 68nF capacitor. It helps with interference, especially when a switching coil is nearby.
Driving the armature
The business should be simple. Turn the coil on when the poles are closer to the NC side and off when they’re closer to the NO side. I tried it. The common contact would travel too far and alternatively hit the contacts. The reason. There is some lag between the poles being sensed to cross the center and the driving force being switched, mostly due to inductance of the coil and springiness in the armature. That means the driving force is in the same direction as speed a little more often than opposite. Thus the armature and spring will gain energy until it hits the ends.
Now we know the armature should be driven when its speed is toward the NC side instead of its position. We only need to differentiate the 1-bit position readout to get a speed. The derivative is a positive pulse when position turns to 1 and a negative pulse when it turns to 0.
My solution is to drive the coil for about a fixed 1ms when the poles cross the center towards the NC side. It should deliver a fixed amount of momentum.
The armature oscillates at around 500Hz. It is quieter than when contact is made but still audible, probably due to linkages in the armature. Both sets of the relay’s contacts are used to sense position and it has a black case, making it hard to measure whether the contacts are touching. I know the contacts aren’t touching because if I adjust the pot to lengthen the drive time, at a certain point loud state is entered and I have to turn the pot back about 1/3 turn to get out of that state. That is when the center contact starts hitting the sides.
I did not succeed in getting rid of oscillation.
Misc circuit stuff
In the capacitance measurement, the input to the first inverter is quite small, and the inverter has a large output impedance in the linear region. My probe, a 50Ω cable and a 22kΩ resistor is enough to keep its output at zero when probing the output. I had to add a capacitor in series to see the signal on a scope.
To worry less about inductance in the coil, it is driven with a current source and the power supply is 24V.