PC Program                                                                         Latest change 2017-09-08

In brief:
A program which graphically presents the behaviour of the pendulum, allows setting of several parameters and logs data for later analysis.
Download the zipped source files. Also see the Software Development page.

Fig 1. Screenshot.

From Top-Left to Bottom-Right:
- Linear display. On each Center Pass the display shifts one pixel to the left. New data arrives at the right side. It is 500 pixels wide.
In yellow the difference in zero-crossing time of successive half periods. Midscale = zero. Units: All timing values are in 20 kHz Sample Ticks.
This signal is primarely used to center the coil assembly on the Floor Unit.
In red the peak amplitude of the Center Pass signal, just before the center crossing. This signal is proportional with the velocity of the pendulum, it is strongly dependent on the height of the bob, and it becomes smaller when a more elliptical path develops. Here the pendulum was on its way to change from a CCW to a CW ellipse.
In cyan the amplitude as calculated from the Rim fly-over time. (now stabilized)
In green the length of the long axis of the ellipse.
In purple the length of the ellipse's short axis x10 exaggerated. Midscale = zero, positive = CW, negative = CCW.
In white the width of the drive pulse, resulting from the automatic stabilisation mechanism.
A marker is a small white line at the bottom (none are present in this example) It is set a.o. when the "Change Settings" button is pressed.
The scale is + / - 160 for signals with zero midscale, and 0 .. 320 for the other signals.
The checkboxes below the display allow turning on or off the traces.

- Compass display.
Shows in real time the movement of the pendulum, as measured with the Hall sensors. With the checkbox "Persistence" checked the dots will stay until the display is cleared. The time of Last Clear is displayed on the mid right. Here it is only 13 seconds ago, so we see the dots from 3 swings of the pendulum.
"Enlarge" scales the display 10 times more sensitive, and is used for precisely zeroing the TopMount.
The red circles indicate the actual angle of the pendulum's swinging plane. Right = East = 0, over North increasing to 180 as usual in math.
Note: In the collection of dots one can see some voids, places where a position measurement never is registered. These voids come from the way messages are sent from BobControl to the GUI. Normally the messages contain only Hall data, but when a Center or Rim Pass is detected that info is sent in stead of the Hall data. The locations of the voids tell us here that we have a CCW rotating ellipse.

- Parameters to be set:
Start and width of the Drive pulse, the Leds pulse and the Camera pulse.
"Enable" directly enables or disables the Drive Pulse.
"Change settings" sends (new) settings to the Bob Control unit and also logs these settings in the Event Log file.
"Expect" settings mainly cause the system not to react on magnetic induction from the Drive coil into the Center Coil or the Rim Coil.
"Missed" settings indicate when Center or Rim Passes are to be reported as missing.

- Calibration settings:
Tne North-South and East-West sensitivity calibration for the Hall sensors, and the radius of the Rim coil, such that the Amplitude and Ellipse dimensiones are correct in mm.

- Zero allows for software correction of a residual zero error during fine-adjustment of the Top Mount.
- Amplitude lists the amplitudes as calculated from the Rim passage times and the long and short axis of the ellipse.

- Far right the Angle and below that the actual values from the Hall sensors. Used during the calibration procedure.

Left to the memobox we can enter the upper and lower limits for the width of the Drive Pulse, the interval at which the Amplitude Stabilisation mechanism must look, the setpoint for the Amplitude and if we want manual or automatic amplitude control.

- The memo box lists some results at each zero crossing.
Status: 1 = ok.
Time of last half period. Used for centering the coil assembly.
Difference with the previous half period time.
Peak amplitude of signal from Center Coil.
Time of Rim Passage.
Peak Amplitude of signal from Rim Coil.
The Amplitude of the pendulum averaged over the last two halfswings.

To the right of the memobox:
- The current time and the last time at which the Compass Display was cleared.
- A possibility to stuff a comment line into the logfile.
- A possibility to start a new logfile. Log files will have a timestamp as name.
- Temperatures in the TopMount and in the Power Unit (one seems not to work in this example)
- "Show Power" will bring up a form with the measured voltages in the Power Unit.
- In the lower part some diagnostic fields regarding the communication between this program and the BobControl unit.

About the operation of the program
Although the operation of the program is quite self-explaining two parts of it need some explanation. That is where I process the data from the Hall sensors and the mechanism to stablilize the amplitude.
The coordinates of the Bob are derived from the North- and South Hall sensor signals by the formula Ypos = (North - South) / (North + South). For East - West the same recipe. This formula assumes a good linearity which of coarse is not there, but the results appear quite acceptable.

To determine the parameters of the ellipse I follow a number of steps.
- Collect 60 datapairs (X,Y). They do not need to come from a whole number of pendulum swings but they must be consecutive in time.
- Determine if this set has the most width in Y or in X direction by finding the minimal and maximal Y's and X'es.
- If Y is the widest I exchange X-es and Y-s in the whole dataset. That is: rotate the dataset around a diagonal.
- Apply the Least Squares Linear Fit algorithm to find the angle of the longest axis of the Ellipse. Now here is the problem to circumvent, this algorithm behaves very badly when that axis is near vertical, so by rotating the dataset this situation does never occur.
- Correct the angle for when de dataset was rotated.
- Rotate the dataset such that the long axis becomes horizontal, in the X-direction.
- Determine the length of the long axis from max-X and min-X.
- Determine the length of the short axis from max-Y and min-Y.
- Determine the direction of the ellipse bij following the dataset and finding out if X is increasing or decreasing while Y is positive. Here a majority decision is taken.

Certainly this is an akward method, but it appears to work quite well. I am very interrested if anyone comes up with an algorithm that:
- Given a dataset as above, produces the lengths of the long and short axes of the ellipse, the angle of the long axis and the direction in which the ellipse goes.

About stabilizing the amplitude. If the measured amplitude is lower than the setpoint, the width of the drive pulse is set to the value in the box "Upper". If it is higher it will be the value in the "Lower" box. The "Interval" box tells how many halfswings should pass before the algorithm is applied again. This value turns out to be very uncritical. One should play a bit with the Upper and Lower values for on average equal times Lower and Upper as can be seen in the white trace on the linear display..