PC Program                                                                         Latest change 2023-12-25


In brief:
A program which graphically presents the behaviour of the pendulum, allows setting of several parameters and logs data for later analysis.
The program runs 24/7 on an older laptop.
There is also an Analysing program which shows the logfiles graphically.
See the Software Development page where you also can download the source code.




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 10 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 had an elepticity of around 10%.
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. We can see that it frequently changes from max to minimum.
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 right. Here it is only 20 seconds ago, so we see the dots from 5 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.

- The memo box can list some results at each zero crossing.
Time of last half period and difference with the previous half period time. Used for centering the coil assembly.

- Parameters to be set:
Maximum an minimum width of the drive pulse, and the center position.
"Enable Drive" directly enables or disables the Drive Pulse.
"Force" boxes force the dive width, bypassing the mechanism for amplitude stabilisation.
For the Center, Rim 1 and Rim2 pass times we have settings for when to start looking for it and a time-out for when a passage is missed.
Reason: The Drive Pulse will induce a voltage in the other coils which may trigger a false reading.
"Change Parameters" sends (new) settings to the Bob Control unit and also logs these settings in the Event Log file. The arduino stores the parameters in EEPROM and reads them at startup.
"Defaults" sets the default values for these parameters.
"Resync" starts a synchronisation procedure in the Arduino software.
"Other half" switches the precession angle to the other half period of the pendulum. Note that we cannot automatically distinguish between the two halves.
"Radius' is the diameter of the Rim coil.
"Set_mm" is the setpoint for the amplitude in mm.
"Set ticks" is currently not used.
"Ampl" gives the actual amplitude in mm

- Status
Displays a number of situations.
"Clr Self" clears indications when the Arduino did a resync or system reset.

- Hall Sensors:
The acttual readings from the Hall sensors in A/D converter values (8 bit conversions)
The North-South and East-West  positions and farest positions found
The ellipse parameters calculated.

- General
Current time and last time th eCompass display was cleared.
A possibility to enter a comment into the logfile.
The name of the logfile. Automatically changes at midnight time.

- Power
Some parameters of the power provisions are presented here.
Battery operation and -management is foreseen, but currently not used.

- Communication.
This box gives info about the ethernet communication between the GUI and the Arduino.


About the operation of the program
The operation of the program is quite self-explaining by name-giving and comments in the code.
The way the ellipse parameters are calculated needs some more explanation.

The coordinates of the Bob are derived from the 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. See drawing.



For this example we have a clockwise rotating ellipse (see arrow) with a precession angle A-Prec w.r.t. the X-axis (EW) The long axis is labeled a, the short axis is b.

The dots represent the sampled positions of the Bob’s path.
from messages appox. 10 times per second)
The moment where the Bob makes a Center Pass or a Rim pass is indicated in the messages..

The procedure starts when there is a center pass.
This is done by finding the sample laying the farest from the center. For that we start at the moment of the Center Pass and track the absolute distances of the samples using Pythagoras’ law. When we find the first sample which is not further away than the previous one (3) we know that the previous one (2) was the farest away. Using the arctan2 function we find the Precession Angle.
Knowing that the precession angle wiil vary very slowly and that our samples are contaminated with noise we apply a walking averaging over many pendulum swings using the so called “leaking bucket” method where:


NewAverage = OldAverage * (1-f) + NewValue * f, where f is a value 1 > f > 0.

A small fraction f gives a slow walking average, f near 1 gives a fast response.

The next step is to determine the short axis of the ellipse.
For that we take the first sample after the Center Pass. Its distance from the center gives a good approximation of the length of the short axis.
We also want to know the rotational direction of the ellipse. For that we rotate the found sample over minus the earlier found PrecessionAngle. The sample is now so to say on the ellipse when it is laying with the long axis horizontally. The Y-polarity of the sample now gives us the direction of the elliptical path. If it is positive we have a CW rotation, if negative it is CCW.

To calibrate the short axis in mm we rely on the knowledge that the long axis (= Pendulum Amplitude) is kept stable by the amplitude control mechanism, in our case 230 mm. So we can easily find a calibration factor for the short axis, using the distance of the farest sample in “Hall units”.
If we would do these calculations for each halfswing we would find opposite values for nearly everything and averages would approach zero. That wo’nt work, so we do the calculations only for each other halfswing. This means we must be sure that no Halfswing info is missed. Normally this wo’nt happen, but for the case it does we have a button to switch to the other halfswing.


Certainly this is an akward method, but it appears to work quite well. Although there is a problem:
Look at the graph below, The white line in the centre, a bit like a squarewave gives the amplitude of the short ellipse axis. I have no explanation why it behaves so much as a squarewave. I'd expect something mor gradually, probably a sine wave.
Also this square-wave behaviour does not match very well with the peak amplitude from the center detect coil as we see it in the green line in the uppper part of the graph. The maxima correspond well with the direction changes of the ellipse, but there is no trace of the suddenness of these changes.  

 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. See the "Not Understood" page.


About stabilizing the amplitude. This is implemented in the Arduino Firmware. The GUI only sets the parameters for the control mechanism.
If the measured amplitude is lower than the setpoint, the width of the drive pulse is set to the value in the box "Max". If it is higher it will be the value in the "Min" box.
One should play a bit with the Upper and Lower values for on average equal times Maximal and Minimal as can be seen in the white trace on the linear display.
When the GUI stops working the Arduino will keep the Bob running, only no data are logged anymore.


The Analysing program reads one or more logfiles and presents the data in graphical format.
 


Individual traces can be switchd on or off. Here all are on.
Important are:
 - Yellow staircase: time of the day in hoursteps,
 - Blue sawtooth: Foucault Precession from +180 to -180 degrees. 180 and 0 are East-West, + and - 90 degrees is North-South.
 - White, squarewave like: Ellipse short axis length showing the periodical direction changes.
 - Green, more or less sine shaped: Peak amplitude of the center detect signal. Obviously the strongest when the bob is passing straight over the center, that is when the ellipse's short axis goes through zero during the direction change.