# Cool Cap Engineer

## Mini Projects: 15 Watt Audio Amp Experiment

A couple weeks ago, I mentioned that I was learning how to build audio amps and I tried building one using Sparkfun’s STA540 audio amp kit. Well, I tried to design the PCB for my modified version of Sparkfun’s audio amp kit, but I ran into a very….large problem. In order for me to make sure the STA540 properly drives two speakers at 25 Watts, I needed a multiwatt heatsink. However, the heatsink takes up 1/3 of the PCB! Not to mention it will be a pain fitting it inside a box since the heatsink is also very tall! In otherwords, I needed to find something else.

Then I heard about the TPA3122, a 15 watt stereo audio amp.  Although it can only drive 10 watts less than the STA540, the space it saves more than makes up for it. After building the circuit, I ran into latching issues, or when the ic stops working due to voltage spikes on the dc bus. At first, I thought adding more bulk capacitance would help, but it had no effect. After asking around, one person suggested to rewire the circuit to be much more orgainized. Not only did I rebuild my circuit on the breadboard, but I place .1uF decoupling capacitors as close to the IC as possible. Afterwards, the amplifier worked marvelously! I even recorded a video of the amplifier in action.

Suffice to say, I will consider using the TPA3122 for my next audio project. Well, that’s all from me today! If you have any suggestions, comments, or concerns, please feel free to use the comments below. See you guys again next week!

## 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

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.

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
Misc. Wires

Now wire the circuit like in this picture.

Now 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.

## Mini Projects: Messing Around With Sparkfun’s Problematic Audio Amp

Sparkfun’s audio amp kit fully assembled

Despite the fact I’m learning more about power electronic circuits, I’m also trying to branch out my analog circuit knowledge. I figured a good place to start is by building an audio amplifier. But, I did not want to start with a simple 1 watt audio amp. I wanted to go up to 25 Watts. Since I had no prior knowledge of audio amps before this post, I figured I started with something that exists. So I brought Sparkfun’s Audio amp kit as a starting point.

25 watt speakers from Do It Yourself Electronics

To make sure I’m getting the most out of my amp, I drove down to Do It Yourself Electronics in Needham,MA and brought a pair of 25 watt speakers. These speakers were ironically $25 dollars and it wasn’t until later I found out that Sparkfun were selling 25 Watt speakers as well. Could of saved me the trip! To power my speakers, I used my trusty 150W DC power supply. The audio was provided by my usually Jpop music video. When I powered the amp and played the video, I was surprised by how loud the amp was! However, I noticed occasionally 5Hz thumping that the speakers were producing. DC Bus voltage during 5hz thumping. So I carefully attached one of my oscilloscope probes to the DC power of the audio amp. I noticed that when the 5hz thumping occurred, the DC bus dropped close to 0V. I suspected that there was not enough capacitance on the audio amp’s power supply rail. So I added 2000uF to the audio power supply rail, and it was not enough. It wasn’t until a week later that I realized the cause of the thumping. The first thing I realized was that I failed to add DC blocking caps to the speakers since they are AC only components. Another issue that I failed to realize was that the thumping occurred when the volume of my computer was set to max. Therefore, there was a chance that the pre-amp section of the amplifier was getting saturated. Modified Sparkfun’s circuit usig my knowledge from testing Thus far, I modified Sparkfun’s audio amp circuit with more bulk capacitance on the power supply rail as well as DC blocking capacitors on the outputs of the audio amp. Of course, I’m still trying to figure out how to solve the clipping issue, but for now, I will not set my input volume to its max. Thank you guys for reading today’s post and if you have any suggestions on how I can make this audio amp better, then please leave a comment below! ## Mini Projects: Boost Converter Experimentation Since I started working in the power electronics industry, I figured I should spend a little more time building power electronic circuits. I remembered that I understood how non-isolated boost converters worked during my school work and decided to build one for myself. For those who do not know, a boost converter is a power electronic circuit that converts incoming voltage to a higher voltage. I decided for starting purposes, I would build a 12V to 24V boost converter. Although I plan to write a tutorial which shows how boost converters work, this post is to talk about what I did in my free time. 12V TO 24V Boost Converter Schematic After a week relearning important boost converter design parameters, I managed to draw out the basic schematic. Although there are 3 components missing from my schematic, those parts functioned as a way to implement a controller for the boost converter. There are alot of major improvements that could be made, such as protecting Q2 from high voltages, solving the logic inversion caused by Q1, and prevent L1 from causing my power supply to current limit. However, I just want to see the boost converter work. Boost converter circuit soldered onto a perfboard After buying my parts from Digi-key, I soldered my parts to a perfboard. Why not assemble the circuit on a breadboard? In order for this boost converter to properly work, I needed to switch the main transistor (Q2 in the schematic) at a high frequency (I based my calculations around a 62.5KHZ switching frequency). Since I’m switching at a high frequency, building the circuit on a breadboard will screw up the signal due to the breadboard’s nature of acting as a capacitor at high switching frequencies. The boost converter load Finally, to make sure the boost converter functions correctly, I needed to connect a load. I decided to go with a 25 ohm/50W resistor. If the boost converter was not connected to a load, then there’s a high chance the boost converter will go unstable. A high value resistor can be connected at the output to function as a dummy load to prevent the boost converter from going unstable. Also, I was dissipating a lot of heat through this resistor. The resistor got so hot that it melted one of my oscilloscope clips. Blue waveform is the output at the load, while yellow is the square pulse going into the the Q1. So I was ready to power up my converter. Since I was using my multimeter as a current meter, I had to setup my crappy Hantek oscilloscope to measure the voltage by measuring the DC level. One thing that surprised me was the actual duty cycle needed to set the voltage to 24V. To get 24V, instead of setting my frequency generator to 62.5KHZ with a 50% duty cycle, I got a 24V output using the same frequency, but a 25% duty cycle. This usually happens when your boost converter is incredibly inefficient. Brother, my boost converter was the definition of it. According to my calculations, my boost converter efficiency was around 70%.Well…it was a good attempt, but converter needs a lot more work. I will need to investigate the causes of the low efficiency, and rectify it. My first suspicion involves the big bulky inductor. The bigger the inductor, the higher the parasitic resistance. Thank you guys for reading this post, and if you have any suggestions on how I can improve the efficiency, then leave a comment below! ## Rants: Second Room, New Lab Back in March, I moved from Kingston NY to Lawrence/Andover MA to work as a design engineer for a power electronics company. Due to the fact I needed to find an apartment within a 3 week time frame, I had no other choice but to rent a two bedroom apartment, even though I will be the only one living in the apartment. So, what did I do with the extra room? I turned it into a lab! Although I still need to get a bench multimeter, hot air soldering iron, etc, I think it’s a good starting point. Anyway, here’s a small tour of my lab. So right now my inventory is pretty sparse. The cabinet on the bottom I had before I moved to MA and contains spare items.Some of the items include diodes, op amps, atmel and PIC18F microcontrollers, PIC programmers, and AVR programmers. However, one of my co-workers gave me his old electronics cabinet. This one contained a diverse amount of through-hole discrete parts such as resistors, capacitors, even some inductors. Either way, I will not run out of discrete components anytime soon. So I obtained another goodie from my co-worker- a power supply (15V/1A). Although I do not use it often since I have a higher wattage power supply (32V/5A), I’ll find a use for it soon. For the first time in my engineering career, I finally invested in a….meh function generator. I never heard of Victor before obtaining the function generator, but it does a decent job. My chief complaint is the minimum and maximum duty cycles for square waves. This function generator can only be set to have a 20%-80% duty cycle for square waves. As a person who likes to switching things at a fast pace, this continues to annoy me. One of my electrical engineering colleague told me that a good electrical engineer typically has an analog and digital oscilloscope. I took that advice to heart and obtained an old school analog oscilloscope from – you guess it – my current co-worker. I’m not going to lie, I’m still tying to figure out how to use this scope. I tried looking for the instruction manual online and even asked my co-worker who lend me the oscilloscope, and I still cannot figure out how to use it. So this is one of the supplies I brought while I was living in Kingston. As embarrassing as it sounds, I lost the caps to the power supply’s output during the move to MA. For now, I have alligator clips attached to the power supply’s output. Although the current capability of the cables is a little less that the maximum current the power supply can deliver, my current projects are not really current demanding, so I can get away with it. Of course, I cannot forget my multimeter from Radioshack, Although I was groomed to love Fluke multimeters, I cannot complain about it as it gets the job done. I will get a bench and Fluke multimeter sometime in the future. So here’s my current oscilloscope. Originally I wanted to get a small cheap Techtronix oscilloscope but apparently the cheapest Techtronix oscilloscope I could find at the time was$1000. So…I brought a Hantek oscilloscope from Ebay. Although I find the screen to be a little hard on the eyes and the speed isn’t something to brag about,I can save pictures using USB! I cannot tell how many oscilloscopes I used in the past could only save waveforms using a floppy drive. I know it’s petty, but after using oscilloscopes for two years  now, it’s kind of a big deal.

So the last item I got for my lab is my new soldering iron. My previous soldering iron I obtained from Radioshack started to affect my soldering. Instead of getting another cheap crappy soldering iron, I decided to invest in a Hakko 936 soldering iron. Not only did I get a new soldering iron, but I got two chisel tips with them. What’s great about these chisel tips is that the heat is spread out a little more, making through hole soldering a little easier.

So that’s it for my little post for today. Again, I apologize for the delay, but assimilating to life in MA was….more time consuming that I thought. Anyway, thanks for reading this post and if you have any suggestions on any lab equipment I should get, then please comment below! I will see you guys next week and have a wonderful day!

## Projects: Arduino 24V Brushed DC Motor Controller Shield Update #4

Well, this is a first. This is kind of an embarassing first, but a first nevertheless. In my two years blogging on Cool Cap Engineer, I could never get past a third update for any of my projects. A lot of the times, I cancelled a project due to the huge time commitment for a project, or the lack of knowledge on the project’s topic. With that said: here’s the 4th update for the 24V Brushed DC Motor Controller Shield project.

In my last post, I mentioned that the original 24V Brushed Motor Controller circuit needed some improving. One of the crucial improvements I mentioned was adding overvoltage and undervoltage protection circuitry. Because of the power supply protection circuitry additions, I decided to look into the LM2574: a 12V/.5A Buck Regulator IC. By using the LM2574, not only will I be able to add the protection circuitry by manipulating the on/off pin of the regulator, but its surprisingly more efficient than the 7815 linear regulator I was using.I could not emphasize how efficient this regulator is. No matter how much I loaded the regulator, it still delivered 11.92V  to the load. Even when I loaded the regulator with a 24 ohm resistor, it still maintained 11.92V. Of course, the performance will change depending on huge temperature variations, but I’m assuming the final shield will be used at room temperature.

Just for the sake of curiosity, I wanted to see how the regulator performed when I loaded it with an Arduino, which typically draws 30-40ma. To my surprise I regulator delivered 11.97V to the Arduino. So I think I will use the LM2517 in the final design.

The final thing I was thinking doing for the project was implementing the MC33035 brushless motor controller on the shield. The MC33035 can not only control DC motors, but it comes with a current limit. If I have time this week, I will implement the undervoltage and overvoltage protection circuitry with the 12V Buck regulator circuit and start working on the PCB for the shield, which will control 1 motor. Once I test the shield, I will modify the shield to control 2 motors.

Well, that’s it for me this week. Feel free to post a question, comment, or concern and I will do my best to respond back to you. See you guys next week and Happy New Years!

## Electronics-LTC3639

Buck regulators are used for reducing the input voltage coming from a power supply to safely power microprocessors, gate drive circuitry, and other circuits. Today, I will show you how to use the LTC3639 – a buck regulator that can receive up to 150V- which comes with under-voltage and over-voltage lockout.

The LTC3639 should allows you to to easily change the output voltage, undervoltage lockout, overvoltage lockout, switching frequency, and the maximum peak current. I built 15V power supply using the LTC3639 and the DC1901A development board from Linear Technology.

Pin Functions

• SW (Pin 1): Connects to the drain of the LTC3639’s internal MOSFET.
• Vin (Pin 3): Supply pin for the IC
• FBO (Pin 5): Feedback comparator output. Connect to VFB of other LTC3639’s in order to increase the output current. Otherwise, leave FBO floating.
• VPRG2, VPRG1 (Pins 6, 7): Used for configuring the output of the LTC3639. These pins can be connected to either ground or the LTC3639’s SS pin.
 VPRG2 VPRG1 Vout GND GND Adjustable GND SS 5V SS GND 3.3V SS SS 1.8V
• GND (Pins 8, 16, 17): Ground connection. Pin 17 must be soldered to the PCB ground plane for rated thermal performance.
• VFB ( Pin 9): Output voltage feedback. Connect to output voltage’s resistive divider for an adjustable output. Connect this pin to Vout for fixed output configurations.
• SS (Pin 10): By connecting a capacitor from this pin to ground, the voltage ramp up time can be set. Leave floating to use internal 1ms soft start.
• Iset (Pin 11): Leave this pin floating for 230ma peak current. Short this pin to ground for 25ma peak current. For a configurable peak current, connect a resistor from this pin to ground.
• OVLO (Pin 12): Can be used to configure the overvoltage lockout using a resistive divider connected from the input supply. If the voltage on this pin is greater than 1.21V, then the overvoltage lockout is activated. The chip resumes operation when the voltage on the OVLO pin is less than 1.10V.
• Run (Pin 14): Activates the chip when the voltage on this pin is greater than 1.21V. This pin shuts off the chip when the pin’s voltage is less than .7V. The Run pin is also used for setting the under voltage lockout.

Leaving  pin 12 floating sets the peak current to 230ma, while shorting this pin to ground sets the peak current to 25ma. For a different current peak current limit, a resistor should be connected from pin 11 to ground. The peak current cannot exceed 230ma and cannot be less than 20ma. The peak current is also twice the average current. The value of the peak current resistor can be found using the following equation…

The inductor is used to determine the LTC3639’s switching frequency when it is operating in burst mode, or when the LTC3639 is lightly loaded. The following equation is used for determining the inductance during burst mode.

If the LTC3639 will not be lightly loaded, then the inductor must meet the following two conditions…

Although the previous equations provide some insight on how the inductor will affect the switching frequency of the LTC3639, figure 2 gives a range of recommended inductor values given peak current for maximum efficiency.

It is recommended to use ferrite core inductors for their ability to handle a high switching frequency, and low core loss.

An input capacitor is necessary for filtering the trapezoidal current going into the source of the LTC3639’s internal high side MOSFET. If the maximum input voltage ripple is given, then the following equation can be used.

The output capacitor is needed to filter the inductor’s ripple current. If the desired output voltage ripple is given, the output capacitor can be selected as long as it follows the following two conditions…

How the output voltage is configured depends on the configuration of VPRG2 and VPRG1. For an adjustable output voltage, short VPRG2 and VPRG1 to ground, and connect VFB to an external resistive divider from the output. The output voltage can be set according to the following equation.

The only requirement on the resistive divider is to keep R2 less than 200K in order to keep output voltage variation less than 1%.

The undervoltage, and overvoltage lockout can be set using a three resistor divider.

All three resistors must satisfy the following condition…

V_(in(MAX))*(R5/(R3+R4+R5))<6V

By leaving pin 10 floating, the output voltage ramp time will typically be 1ms. If a longer ramp time is required, then connect a capacitor from pin 10 to ground. The value of capacitor can be computed from the following equation…

Although the ramp time can be calculated from C_ss, it must fulfill the following condition…

I used the LTC3639 to assemble 15V power supply circuit to power a gate drive circuit I was working on. The 15V power supply must perform according to the following requirements…

Vo=15V
Ipeak=230ma
Overvoltage Lockout=97V
Undervoltage Lockout=18V

One of the first tests performed on the 15V circuit was loading it with a 100ma load and observing the start up time. It took 12ms for the output to start up after immediately applying 43V and 85V to the 15V power supply circuit.For more information about the LTC3639, look at the datasheet. Feel free to post a comment if you have a question or concern. Once again, I will see you guys next week!