Project Overview
Analog computing is a seemingly antiquated form of computation. Instead of relying on ones and zeros like in a digital computer, analog computers perform mathematical operations on continuous voltages instead. This makes them well suited to perform calculations involving continuous functions (acting as a voltage), like solving differential equations. In fact, analog computing is still an active field of research, with optical computing solving certain problems orders of magnitude faster than state-of-the-art digital computers. In this project, we will build a compact analog computer capable of solving differential equations near-instantly. We will then use it to solve two problems, a dampened mass on a spring and a simple chaotic nonlinear ODE, plotting the solutions on an oscilloscope in real time.
Step-by-Step Instructions
Op amps can be used to perform many different mathematical operations. In this project, we will be using them in three different ways: to integrate, to multiply by coefficients and to take an absolute value. We are able to perform these calculations by either placing a capacitor or a resistor across the negative input and output terminals. Also, due to their low output impedance, we can chain many of them together without observing any loading effect.
We will start by a system with a mass connected to a dampened spring. As shown in the figure, we see that solving this system (i.e describing the position of the mass at all times, x(t)) requires solving the second order differential equation x'' = -a/m x' - b/m x.
Now that we understand how we can perform these operations independently, we can now chain them up in the correct order and configuration to solve the previous ODE. Note that the resistances are written as ratios, so as long as you are consistent, it doesn't affect the output result. The RC integration time is affected by this resistance choice, which is why I found a nice result when using 100k Ohm resistors as "1" and then picking 1/a and 1/b correctly afterwards. The op amps are powered with +- 15V rail voltage. Notice how we can split the -x' output of the first integrator into two paths, one that integrates again to calculate x and another that multiplies by the constant a. We then combine these back into one last multiplier that inverts the output and multiplies the x term, then sends this entire signal back into the first integrator, effectively creating a feedback loop that solves the ODE step-by-step. See the annotated diagram for more detail.
Next, we need to start the computation with a nonzero position, otherwise the system would look boring as the mass wouldn't oscillate at all. To do this, we simply need to attach a switch on both sides of the second integrating capacitor (the one that would output the position of the mass). This switch should normally be connected to the op amp, but when pressed/flipped, both terminals now connect to a +5 DC source. Then when the switch is flipped back, the simulation would start with an initial position of +5V, which would then oscillate as we would expect.
Now, if we connect an oscilloscope probe to the x terminal and the -x' terminal (inverting this one on the scope), flipping both switches off and on again starts solving the system in real time!
Now for the Chaotic system, we repeat this same process, but with the following ODE.
Similarly, we can design the circuit to solve this ODE shown below: I used 1K Ohm resistors as R, and 1 micro Farad Capacitors as C. I also used Germanium diodes as they have a smaller drop (0.3V) compared to Silicone ones, but in theory Silicone diodes should work fine. I used a resistor box as the variable resistor. This one doesn't require specific timing with the initial conditions. Only some values of R_var tend to chaotic solutions, (around 2.2k Ohms in my testing). To find these values, I turned the rail voltages on and off and observed the voltages x and -x' (inverted on the scope). At too large or small resistances, the output will saturate really quickly and the voltages will measure either + or - 15V. This means that the circuit received too high or too low of a voltage causing positive feedback, eventually saturating the op amps. This is fine, just turn off the rail voltages, tweak the variable resistance and try again, until the output oscillates somewhere between +- 10V. Then put the oscilloscope in XY mode and visualize the chaos!
I had an output that looked like this. Notice that tweaking the resistance slightly can sometimes send the trajectory into a seemingly periodic solution, while others have chaotic trajectories that seem unpredictable. I've gotten this change to occur by changing the resistance by 1Ohm, or ~0.05% of the resistance!