The paper describes experimental studies performed on the FTU tokamak on magnetohydrodynamic (MHD) instabilities and their active control by electron cyclotron (EC) heating and EC current drive (ECH/ECCD). It deals in particular with implementing of an automatic system that detects both the onset and localization of tearing modes and the localization of the EC power deposition and that is capable of actuating the stabilizing reaction with ECH/ECCD. The system is composed of a digital signal processor-based control unit to analyze electron temperature fluctuations (mostly from EC emission) and Mirnov coil data and to control gyrotron power supplies. The action is provided by an arrangement of four Gaussian beams at 140 GHz, coupling up to 1.6 MW power in total. The detection/reaction system, successfully tested in the experiments described, is very fast since no mirror motion is foreseen. In fact, the Gaussian beams are preliminarily oriented in an array covering the whole region where the mode is expected, and only the one closest to the mode is switched on at its appearance. The measurement of the deposition layer dep is performed by analyzing the transient response to modulated EC power. Different modulation waveforms are used, both periodic and pseudorandom, in order to select the most sensitive and fastest technique.