Cool Cap Engineer

Engineering by an anime nerd

Leave a comment

Tutorials: Op Amp Relaxation Oscillator


Relaxation oscillator on the bread and waveform taken on oscilloscope.

So lately I’ve been messing around with op amps. Why? Because I want to learn more about oscillators and wanted to build one from scratch. One of the simplest oscillator to build using an Op Amp is a relaxation oscillator. Today, I’ll talk about how it works and a small experiment using the oscillator.

What is an oscillator?
An oscillator is a circuit designed to output a repetitive signal over and over again based on a certain frequency. Oscillators are often use for devices such as switching regulators and making sure your PC’s CPU operates correctly. Some of the waveforms an oscillator can output includes square waves, sine waves, sawtooth waves, triangle waves, etc. Today’s relaxation oscillator will output a square pulse with a 50% duty cycle.

How does A Relaxation Oscillator work?

Relaxation Oscillator Schematic

Relaxation Oscillator schematic

An Op-Amp relaxation oscillator is comprised of two parts: a schmitt trigger and a RC  circuit (R3 and C1). When the circuit is powered, it charges the capacitor in the RC network. Keep in mind that whatever voltage appears at the capacitor will appear at the non-inverting pin of the op-amp (pin 3). The schmitt trigger (R1 and R2) determines when the output will swing from high to low or low to high.  In other words, the schmitt trigger determines when the capacitor will start charging or discharging.


Output waveform (yellow) and the charging voltage of the capacitor (blue)

The figure above was taken from an relaxation oscillator with 15V peak to peak voltage. Although it shows 30V peak to peak, the DC offset of the waveform was set around 15V. Nevertheless, you can see that when the capacitor is charging, the relaxation oscillator output goes high, and goes low while the capacitor is discharging.

The frequency of the waveform can be set using the following equation:


Keep in mind, these equations work under the assumption that the voltage on pin 8 and 4 of the op amp are symmetrical. For example, if you apply 9V to pin 8, then -9V should be applied to pin 4. Also, if you apply 15V to pin 8, then -15V should be applied to pin 4.

Build Your Own!
Although I now have an oscilloscope – a crappy one, but still an oscilloscope- I realized some of you guys probably do not have one. So, I devised a small circuit that will turn on flash two LEDs on and off every 250ms. You will need the following materials:

1x DC Power Supply (Able to supply +15V and -15V)
1x LM741 Op Amp
3x 1K Ohm Resistors
2x .1uF Capacitors
1x  10K Resistors
1x 1uF Capacitors
2x LEDs
1x Breadboard
Misc. Wires

Now wire the circuit like in this picture.

relaxation oscillator circuitNow power up your DC power supply! You should see the LEDs flash on and off. The purpose of the LEDs is to show that the oscillator is outputting a square pulse with a positive and negative amplitude.



Well that’s it for today’s post! If you have any questions, comments, or concerns about today’s post, let me know. Thanks for reading, and see you guys next week.



Projects: Linearized Force Sensor

So I just finished fall semester of senior year. One more semester to go then I have a Bachelor’s of Science in Electrical Engineering! Anyway, I worked on a lot of projects this semester. When I said a lot I mean A LOT! Consider this plethora of projects as content that you guys can learn from. Anyway, here’s  one of the few projects I worked on this semester: a linearized force sensor.

So, there’s this class at RPI called Capstone, a senior design class. I did not take the class, but several of friends took the class this semester. One of my friends’ project was to create a data retrieval system to determine if a person fell over. One day, my friend asked me to take a look at the foot sensor for the system. Right off the bat, I saw an immediate problem with the circuit: the circuit’s output will be non-linear.


The circuit that my friend used, is shown in the figure, which was taken from the datasheet of the force sensor, above. For both 3k to100k RM values, the force is almost linear. However, after that, the output will be constant. Why is this a problem? When it hit’s the non-linear region, it becomes very difficult calculating the force the sensor experiences. Also, when the sensor enter’s the non-linear region, it tends to oversaturate the op-amp, or the output of the op-amp will be at +vdd or -vdd. Don’t believe me? Here’s the output voltage of the circuit.


As shown above, as RFSR decreases, the output voltage will increase as well. Unfortunately, there will be a point where the output voltage will stay constant as shown in the graph previously. In fact, my friend encountered this issue constantly during testing. They were applying as much force as they could to the sensor, but the value never changed. So, how did I linearized the output? I connected the force sensor to what we call a bridge circuit, which I remembered from my Advanced Electronics course that I took spring 2012.


The figure above shows the linearized circuit, where the force sensor is represented as R4, which value is change in R+1M. I won’t go over the analysis, but I will show you the equation of the non-linearized circuit, and the linearized circuit. The equation below shows how the resistance of the force sensor will affect the output voltage of the circuit.


The picture below shows my implementation of the circuit on a breadboard. Although I had a 15v power supply at the time, I added two 10 microfard capacitors in series to create a dual 10v supply power supply for the op amp. The place where the force is measured is located at the circle of the force sensor. When I varied the pressure applied to the circle, it changed from 2.3V to 4.5V perfectly.


The only problem with the circuit is relating force to the force sensor’s change of resistance. I still need to get to that.Despite my efforts to show my friend that if they stick with their non-linear circuit he would encounter nothing but trouble, he still went with the non-linear circuit. Why? Because the professor didn’t want to change the circuit. The professor knew perfectly well that the output of the circuit will be non-linear, but still wanted to stick with it. The worse part is that he wanted to work in the non-linear region.  Oh well.