Why do you need a scope?
An oscilloscope, or simply scope, allows the observation of constantly varying signal voltages, usually as a two-dimensional plot of one or more signals as a function of time. Oscilloscopes are used to observe the change a signal over time, such that the signal value and time describe a shape which is continuously graphed. The observed waveform can be analyzed for such properties as amplitude, frequency, rise time, time interval, distortion and others.
A scope is then very useful to capture signals allowing human observation of events too fast or complex to be directly perceptible and record them so that the user can process all the information. Several channels (sources) can be recorded using the same time scale allowing the comparison among them and to understand events that are related between signals.
Where can you get one?
LinuxCNC have a built in scope named HalScope. No need to install or wire anything. It can be accessed from the top bar menu of LinuxCNC.
Running it will show the halscope window similar to the picture below. In this case, only a signal is connected (named axis.1.f-error). To select another signal, simply add another channel or change the signal connected to a existing channel pressing the signal name. A pup-up list will appear where another signal can be selected. This is similar to physically connect probes on standard scopes.
HalScope for tuning
Although on this wiki we are tuning a system on velocity mode, at the end we want that the machine where this axis is being built moves correctly to a position and that it respects the path during the movement. The user do not really care about the analog voltage from the 7i77 to the drive and what the drive does with that analog voltage. The user wants to send position commands, feed rates and it is expected that the machine respects those commands.
Therefore the most important signal for tuning is the signal that holds the difference between the commanded position and the actual position. This signal is know as following error. The name of the following error signal depending on the axis number: axis.0.f-error, axis.1.f-error, ..., axis.n.f-error. Refer to your INI file to know what axis number corresponds to the axis that you want to monitor (x,y,z, ...).
As you probably noticed nothing is happening on the halscope, at start it is on stop mode, as the stop is selected on the Run Mode group. As a example to start working with the scope place it with the following settings:
- Signal to scope = axis.0.joint-pos.cmd (this will be the signal of axis X, commanded position)
- Vertical scale = set a gain so that you will see the scale at about 10/div (if working in metric)
- Select 8000 samples at 1.00 KHz or similar so that you will have more samples (more recording time)
- Run mode = Single (you will notice that a black bar starts to move)
In our example, before start the halscope add the following appearance:
When the black bar that moves from left to right reaches about half of its total length, the scope enters in TRIGGER? mode, soon after it will display TRIGGERED. When in TRIGGERED mode, the scope will start to record the signal axis.0.joint-pos.cmd and when it finishes, the scope window will graphically represent the recorded data, and this data can be analyzed. To excite the signal, a commanded position must be commanded. In order to do this, while the scope is recording data (triggered status on), select the linuxcnc window leaving the halscope window, and in manual mode, move the X axis right and left. A large monitor is usefull for this task as you can see both the halscope and the main linuxcnc window.
You are now commanding a position, and that position that you are commanding is being recorded by the halscope. Simple and quite powerful if you wanted to analyze what position was commanded in relation to time. Your result will be similar to the image below.
Now you can zoom in/out horizontally (time scale), alter the vertical scale so that each vertical division corresponds to a different value, and if the mouse is passed by part of the signal, the real value is displayed. In the image above, it can be observed that the amplitude of the signal was 15.9855 (in this case millimeters).