Sitar Control

A research internship at Centre d'Automatique des Systèmes, Mines ParisTech

by Jeremy Dahan, student at Mines ParisTech and member of the Trublion collective

This website is my report for my research internship at the CAS where I built a stringed musical instrument on which timbre is controled using electromagnets. A complete description can be found here

EDIT : This report was written in 2016, when I was a member of the Trublion collective and a Student of Mines-ParisTech


  1. Introduction
  2. Landscape of augmented instruments
  3. Design choices for the instrument
    1. General geometry
    2. Choosing the actuator
    3. Choosing the sensor
    4. Microcontroller, amplifier and woodworking
    5. Summary of the design
  4. Engineering a magnetic scanner
    1. Design
    2. Results
  5. Controlling the instrument
    1. State-sensor algorithm
    2. Dynamics of the system
    3. Code architecture and first control
    4. Linearising the actuators
  6. Discussion : Compairing with other setups
  7. Conclusion and future work
  8. About this website

The dynamics of the system

Summary

We started using a simple model, the damped string model. It exhibits an important property of the system : the relaxation and max stimulation frequencies are different, making the tuning of the system more complex.

The model predicts a first order response on the amplitude of each mode, when the drive frequency is exactly the resonant frequency, and predicts beatings when the difference is small. Experimental open loop data indeed shows strong beatings, but their dynamics are complex.

This simple model, which parameters seem too dependent on the environmental conditions of the instrument, was not used in the experimental control, and we did not manage to get a clear differential equation describing the system as defined.

Calculations

The homogeneous equation

We started with a very simple model of this instrument : the damped string, in one dimension.

Let u(x,t) be the height of the string above its resting position at position x and time t. We can write the damped string equation uttc2uxx+λut=0(1). with boundary conditions u(0)=u(L)=0. Supposing u is harmonic and can be written as u(x,t)=f(x)g(t), we find f(x)=kf(x) and g(t)+λg(t)=c2kg(t). The asymptotic stability imposes k<0, hence k=α2

The boundary conditions impose f(0)=f(L)=0, hence f(x)=Asin(αnx), with αnL=nπ. e.g. αn=nπL. The solutions of g(t)+λg(t)+c2αn2g(t)=0 are tBexp(βt) with βC and BR. Re-injecting in the previous equation, we find β2exp(βt)+λβexp(βt)+c2αn2exp(βt)=0 hence β2+λβ+c2αn2=0. The real system oscillates with little friction, so we can assume that λ4c2αn2<0.

Hence β=λ±j4c2αn2λ22=λ2±jc2αn2(λ2)2

Let ω0,n=cnπL, thus β=λ2±jω0,n1(λL2cnπ)2 .

We will also call ωu,n=ω0,n1(λL2cnπ)2 the pseudo-frequency of undriven oscillations.

Now solving the general solution, we had fn(x)=Asin(αnx). We suppose A=L2 (since constants can be adjusted to boundary conditions later). Since (fn)nN is an orthonormal basis of the Hilbert space L2(]0,L[), we can write u=nNgn(t)fn(x)=nNgn(t)sin(nπLx).

The linearity of the wave equation and the orthogonality of the (fn)nN gives gn(t)+λgn(t)+c2αn2gn(t)=0 and so gn=Bnexp(λ2)sin(ωl,nt+ϕn).

Hence the general form of the homogeneous equation :

u=nNBnexp(λt2)sin(ωl,nt+ϕn)sin(nπLx)

Adding the actuator

Let us now consider the non-homogeneous damped string equation :

uttc2uxx+λut=h(x,t)(2).

where h:]0,L[×R+R is a smooth function that can be written as h(x,t)=d(x)s(t) (the actuator does not move).

Projecting h on the (fn)nN basis gives h(x,t)=nNs(t)knsin(nπLx), where kn∝<fn,d>.

The cn scalars represent the spatial distribution of the force, while s(t) represents its time dependent variations.

Equation (2) yields nN(gn(t)+λgn(t)+c2αn2gn(t))sin(αnx)=nNs(t)knsin(αnx).

Hence gn(t)+λgn(t)+c2αn2gn(t)=kns(t), since the (fn)nN are orthogonal.

In complex notation, we get

(jω)2g_+jωλg_+ω0,n2g_=kns_ hence g_=s_knω0,n2ω2+jωλ

This is the typical behaviour of a second order low pass filter with a resonant frequency ω=ω0,n.

The simulations of cylindrical permanent magnets and the magnetic scans are consistent with a simplification of the force of the type :

d(x)=(0 if x[x0δx2,x0+δx2]dmax(δx2)2(x(x0δx2))(x(x0+δx2)) otherwise.

Proposed simplification of the profile of the force exerted by the electromagnet

Proposed simplification of the profile of the force exerted by the electromagnet

This definition is that of a parabola centered around x0, with a max height of dmax and a distance between its roots of δx. The function is zero outside of [x0δx2,x0+δx2], hence out of the bell region.

We can now calculate kn :

kn∝<fn,d>=0Lsin(αnx)d(x)dx=x0δx2x0+δx2sin(αnx)d(x)dx kn(2αn3(δxαncos(δxαn2)2sin(δxαn2))sin(αnx0))

But for small actuators, this result is close to the one we would get from the single point model : kncsin(αnx0). We found experimentally that both predictions were far from actual amplitude data : the final amplitude values of modes tested in open loop had very different ratios than xhat the formula predicted.

It is important to stress that we are interested in the dynamics of the amplitude of each mode (C(t) as introduced in the state sensor algorithm page), not just the state of its associated oscillator. For a Heaviside excitation at the resonant frequency, i.e. s(t)=u0(t)Asin(ω0,nt) (where u0(t<0)=0 and u0(t0)=1), the system behaves like a first order system (regarding the amplitude) : the final state is reached with an exponential decay profile. The time constant is 2/λ, like in the homogeneous equation. We can thus hypothesise that the system behaves like a first order system for more complex excitations, if exactly driven at its resonance frequency.

Transient of a damped oscillator to a pure sine excitation at the resonant frequency, from R. Fitzpatrick website

Transient of a damped oscillator to a pure sine excitation at the resonant frequency, from R. Fitzpatrick website

Except in the simple case of the undamped string, we were unable to analytically compute a simple expression for the amplitude of the transient response when the frequency is not exactly ω0,n (even with the help of Mathematica). We also had trouble finding literature on the subject (and would welcome any documentation sent to us).

We expected beatings similar to a second order response, but we came to the conclusion that we needed experimental data to continue.

Transient of a damped oscillator to a pure sine excitation off the resonant frequency, from R. Fitzpatrick website

Transient of a damped oscillator to a pure sine excitation off the resonant frequency, from R. Fitzpatrick website

Testing the simple model

We collected a set of data representing the system response to different step inputs.

We used the Bela to inject a signal of the type :

s(t)=r(t)(i=15aisin(wi(t1))) where tr(t) is a ramp signal defined as

r(t)=(0 if t<1(t1)/D if 1t1+ϵ1 if t>1+ϵ And phases were chosen so as to limit the high frequency click at t=1.

The ai amplitudes were chosen to study both single frequency response and multimodes excitation.

The actuator was placed at 120mm from the sensor (the string has a length of 700mm).

The below figure shows the system response to a 0.5 step input for mode 1.

Open loop response for a 0.5 step input for mode 1

Open loop response for a 0.5 step input for mode 1

The decay of the beatings has an exponential profile, but the beginning of the transient is difficult to analyse. The same observation can be made on the open loop response to a mode 2 step (though the decay is too slow to be exponential):

Open loop response for a 0.5 step input for mode 2

Open loop response for a 0.5 step input for mode 2

However, the beatings become more complex for mode 3 onward : the beatings start to have a beating oscillation.

Open loop response for a 0.5 step input for mode 3

Open loop response for a 0.5 step input for mode 3

The modes are also more coupled than anticipated, and the beatings change accordingly. We tried to use the system identification toolbox in Matlab to get a numerical model that could explain these responses, but even with high order models, we could not get better than a 70% fit, and most often the begining of the transient was fairly off.

In front of these difficulties to get a reliable model, we resorted to first control the system with a model-less controller like a PID, before resuming the model construction with better knowledge of the system behaviour.

The issue of tuning the string

Tuning the string to an exact frequency is a difficult process : as seen previously, the free oscillation frequency differs from the resonance frequency, and this relationship depends on the damping of the system. The string being attached to other mechanical parts (the piezo bridge, the nut and the tuning mechanism, and the wood itself), the damping is a function of the entire instrument geometry. Furthermore, the surface on which the instrument is played also dissipates energy, as it radiates sound.

To mitigate the surface dependancy, we layed the instrument on thick foam legs, dramatically reducing the transmitted vibration.

We used stroboscopy to tune the string : we injected a pure sine at a fixed frequency into the actuator, and then used an LED array driven at the same frequency to see the actual movement of the string.

We also reduced the illumination time to a tenth of the period the fundamental : this reduced motion blur and allowed finer tuning.

We were constantly confronted with a kind of hysterisis : the string would start its vibration when driven at a frequency close to f0, but would still vibrate, sometimes with a higher amplitude, when driven at a frequency further off from f0.

Our method for tuning was to regularly stop the string and wait for the amplitude to settle, while checking the frequency with the strobe.