Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ANIME AKBAR
Jan 25, 2007

afu~
Okay, I'll go with switching power supplies, since I'm a bit more experienced with them than with motors.

I'll go over some basics first. A lot of you have probably used op amps before, but if you don't actually know how they function, you should read this anyways.

Differential amplifiers part I: op amps and negative feedback


A differential amplifier is a three terminal device, two inputs (named V+ and V- in this picture) and one output (Vout). The differential amplifier, like all amplifiers, is an active device, meaning its output power can be greater than the power from the inputs. Therefore, it needs a power supply, which is applied between to two supply pins (named Vs+ and Vs-).

Its function is to give a voltage at its output that is proportional to the difference between its two inputs. So the the output will be:

[(V+) - (V-)]Ao = Vout

where Ao is the gain of the amplifier (or open loop gain, specifically).

Typically, differential amplifiers have very, very high open loop gains, usually ranging from thousands to millions. Of course if you apply a couple volts between the inputs, don't expect thousands of volts at the output. The voltage of the output can't exceed the supply voltages.

So what are these things good for? Why would anyone want such crazy gain? First lets note some other key characteristics of these things:
-The inputs have very high impedance, meaning that they essentially do not draw current from the signal applied there.
-The output is very low impedance, meaning it can supply lots of power and not change in voltage.

What this means is that these things, while kind of useless on their own, can do awesome thing in closed loops. This means that the output is somehow fed back to the input, resulting in feedback. Feedback is the key to using these devices. Negative feedback is the most common form. Negative feedback means that a certain change in the input will result in a change in a change in output, which through whatever feedback path we have, will oppose that change.

Lets take a look at a simple example:

Lets say that both inputs and the output are at 0 volts. Then we raise the positive (also called non inverting) input a tiny bit. What will happen? Our differential input voltage (a fancy way of saying the voltage of V+ minus the voltage of V-) has increased, which will cause a change in the output voltage (in will increase, since the differential voltage has become positive). But wait! Since the output is fed back to the negative input (aka the inverting input), that will cause its voltage to shoot up as well! This will in turn cause the differential input voltage to become negative, thus causing the output to get lower, causing the input to switch.... et cetera!

That's negative feedback. A changing output is fed back to oppose itself. And while it may seem like it leads to a catch 22 situation, this actually meant the output will be very stable. How is it stable you ask, when its gain is so huge?

When both inputs are essentially at the same voltage.

That's it. When analyzing a circuit with one of these diff amps, you assume that its inputs are at the same voltage. Since the gain is so high, if there was even a tiny difference, the output would saturate (meaning its output voltage would swing to the minimum or maximum allowed by the supplies). Of course, ideally, an differential input voltage of exactly zero would give an output of exactly zero. Trust me, this is not something to worry about. Even in real life, the actual difference will likely be on the order of microvolts, far below what most people are concerned with.

So what was the function of that circuit? Well, we say its inputs are at the same voltage, and one of the inputs is tied to the output, so its output voltage must equal the voltage at the non inverting input. This is called a unity gain buffer, meaning it has a closed loop gain of one. It's very useful for when you have a signal from a high impedance source that you want to use to drive a low impedance load. Since the input impedance of the amp is very high and the output impedance is very low, you can use it to essentially "buffer" a weak signal, enabling it to power heavy loads.

Diff amps intended for negative feedback applications are called operational amplifiers (op amps). They're incredibly common and can do insane amounts of things. For these lessons, wheel really only use them for signal amplification.

When analyzing circuits with op amps, things to keep in mind are:
-The inputs are always at the same voltage (assuming the amplifier is not saturated)
-There is no current flowing in or out of the inputs.
-The output impedance is zero.

To give a taste of what op amps can do, here is a little sampler
The first four on the first page are basic voltage amplifiers. The closed loop gain equations are given, but you can derive them yourself by following the analysis rules given. As for the rest... good luck.

Next time: Diff amps part II: Comparators and positive feedback

ANIME AKBAR fucked around with this message at 02:20 on Apr 12, 2008

Adbot
ADBOT LOVES YOU

Mach Won
Jun 17, 2004

Is UNC playing? My post is either whining about (1) ref favoritism, (2) unfair recruiting/player caliber, (3) opposing team sucking or (4) the inevitable UNC win. The day you see me giving UNC credit for anything is the day someone hacked my account.

Roy era: 1-16 :qq: RIVALS!!!!!

mtwieg posted:

I was thinking about making a series of posts each constituting a lesson or two on common circuits and techniques, eventually culminating in combining them into something cool. I had three different things in mind:

DIY switching power supply, which would cover the following:
Comparators and hysteresis
Relaxation oscillators
Voltage controlled PWM
Switching supply theory
Voltage references
Error amplification
Closed feedback loops

DIY DC motor speed controller:
Pretty much the same as above, except replace Switching supply theory with H-bridge theory

DIY linear regulators:
Zener diodes
Transistor lesson
Voltage references
Error amplifiers
Closed feedback

Reply if you're interested in this. I'd rather not start on such an endeavor unless there is some demand.

This would be cool. I'd really like to get some practical circuit knowledge.

Three-Phase
Aug 5, 2006

by zen death robot

nouia posted:

Finished the triple CREE headlight. The hardest part was just making all those connections inside the aluminum housing.

3x CREE Q5-bin
1000ma BuckPuck driver
16x AA NiMh battery pack

Should put out around 600 lumens for 3 hours. On the test drive just now, it was fun freaking out pedestrians who didn't know what the gently caress that was coming towards them. Kind of heavy, though, I'll probable switch to a handlebar-mount soon.





Wow, very bitchen' headlight. Powerful.

Those LEDs have come very far - I remember getting some of the 1-watt Luxeon stars when they were pretty new and showing them to some professors who were amazed by the light output.

-

I must also comment that I've looked through the little "articles" and tutorials here - they are very well done and a lot of thought has gone into them. Explaining tricky concepts in understandable terms is a valuable skill.

Three-Phase fucked around with this message at 04:58 on Apr 12, 2008

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


My electronics prototyping area was getting quite cluttered so I went down to Radio Shack and bought their Electronics Learning Lab thingy. It's a solderless breadboard surrounded by LEDs, pots, speakers, that kind of thing. Keeps the LED Driver circuit off the end of my breadboard, the speaker doesn't fall off the back of the desk, and the power supply is hidden.

Well, the thing was designed to run on six AA batteries and take a tap of each to get multiple voltage sources. There are headers for 1.5, 3, 4.5, 6, 7.5, and 9 volts. I wired up a linear regulator to an old wall-wart to get a nice, clean 9V out, then used a bunch of 10k resistors as a voltage divider. I matched my resistors pretty well, so I managed to get 1.49, 3.00, 4.48, 5.98, 7.3, 9.0V on the headers. Close enough.

I don't really like the voltage divider idea, though. I'd like to build some kind of power supply that gives +1.5, +3, +5, +9, +15, and -15V, all reasonably well-regulated and independent, and fit in a space meant for 6 AA batteries.

What kind of supplies am I looking at?

Hillridge
Aug 3, 2004

WWheeeeeee!
Yeah that resistor divider isn't going to cut it for much. Depending on the impedance of whatever circuit you are powering with it, those voltages could be quite variable.

Other than building a series of switchers to get the voltages you want, you'll be hard pressed to find something that can fit in the space of 6 AAs. I would just use an old PC power supply. You'll get the most common voltages needed (3.3, 5, 12, etc.) and have plenty of current.

If you need more voltages than provided, add some linear regulators (small voltage drops, lower currents)or switchers to produce those.

Jonny 290
May 5, 2005



[ASK] me about OS/2 Warp

babyeatingpsychopath posted:


Well, the thing was designed to run on six AA batteries and take a tap of each to get multiple voltage sources. There are headers for 1.5, 3, 4.5, 6, 7.5, and 9 volts. I wired up a linear regulator to an old wall-wart to get a nice, clean 9V out, then used a bunch of 10k resistors as a voltage divider. I matched my resistors pretty well, so I managed to get 1.49, 3.00, 4.48, 5.98, 7.3, 9.0V on the headers. Close enough.


Instead of using the resistor network to cut down the regulated DC, learn how to use resistors to make a regulator work at any voltage. Presto, variable DC supply. Now, the regulator will give off X watts of heat, where X = (voltage difference between in and out pin) * (current passing through), so you don't want to regulate 15 volts down to 3 and then draw 2 amps of current.....

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


Jonny 290 posted:

Instead of using the resistor network to cut down the regulated DC, learn how to use resistors to make a regulator work at any voltage. Presto, variable DC supply. Now, the regulator will give off X watts of heat, where X = (voltage difference between in and out pin) * (current passing through), so you don't want to regulate 15 volts down to 3 and then draw 2 amps of current.....

I already have a trimpot in to adjust the regulator to 9.00V. I know how to get any SINGLE voltage; I want to have many voltages at the same time. I can't see pulling more than 400mA at any time on this, with 30-90mA draws being common, so I don't need a huge power supply.

I think I can make an opamp circuit that gives +/- 15V. Would it be any kind of good idea just to get some zener diodes for my ranges and throw those in? If so, would I need any other components?

StumblyWumbly
Sep 12, 2007

Batmanticore!

babyeatingpsychopath posted:

I already have a trimpot in to adjust the regulator to 9.00V. I know how to get any SINGLE voltage; I want to have many voltages at the same time. I can't see pulling more than 400mA at any time on this, with 30-90mA draws being common, so I don't need a huge power supply.

I think I can make an opamp circuit that gives +/- 15V. Would it be any kind of good idea just to get some zener diodes for my ranges and throw those in? If so, would I need any other components?
Putting in an op-amp would be essentially the same as putting in a linear regulator, except that op-amps generally aren't built to deal with as much power as a linear regulator.

A Zener is a dirt poor way to regulate voltages, because you could end up drawing far too much current.

A linear regulator is probably the best option. You can get an adjustable guy if you want to adjust it with a pot, and once the voltage is set it'll be stable across all currents. I like the LT1963A. You'll probably want to attach a heat sink if you're planning on going from 15V down to 3V at 400 mA, since you'll be dissipating (15-3)*0.4 = 4.8 Watts. The LT1963A is available for $5.5 from Digikey.

If you want to get fancy, use a switching regulator, like the TPS something from TI. They tend to be smaller and are much more power efficient, but have minimum output currents, can be noisy, and require a bit more care then the linear regulators.

Three-Phase
Aug 5, 2006

by zen death robot
I just want to make sure I'm correct here, as far as the best/worst ways to turn variable X voltage into steady Y voltage (DC):

WORST (Efficiency wise)
-Resistor network
-Zener diode
-Linear regulator
-Switching regulator
BEST (Efficiency wise)

I was talking to someone doing some military applications and they had to use linear regulators because the switching regulator risked making too much noise.

Oh, and here is the Petzl Zoom regulated LED retrofit I cooked up:







It runs off of AAs or C batteries. The current pull at 3V is approximately 100mA. It has a boost converter that switches the input voltage up to around 9 volts, which powers the two sets of three LEDs (and a small resistor.) A current source would have been a better approach, but with precise control of the output voltage I could use a very small current limiting resistor to waste little power.

Also with the regulation it will maintain the same brightness for awhile then drop off as the battery dies.

If you want something pretty, this isn't for you. But it's solid and functional.

Three-Phase fucked around with this message at 01:24 on Apr 15, 2008

ANIME AKBAR
Jan 25, 2007

afu~
Diff amps part II: comparators, hysteresis, and positive feedback.

The very high gain of diff amps can also be used even without negative feedback. Consider the case where there is no feedback at all. If the two inputs are different by even a tiny bit, the output will be saturated at either the positive or negative supply rails. If V+ is greater than V-, then the output will be high, and vice versa. What we have is called a comparator: a device that compares two voltages and gives an output based on which which input is greater. This is useful for when you are looking for whether a certain signal is below or above a certain threshold voltage. Just connect a reference voltage to one input and the signal to the other, and the output will give a high/low output based on which is greater.

For some applications, that's enough. No feedback or anything. However, much of the time one or both of the inputs will be noisy, meaning that they are not perfectly constant, but instead "jitter" a little bit randomly, usually by just a few millivolts. This means that if your two input voltages become close to each other, the output of the comparator may switch rapidly from high to low. Even if on average one input is always a little above the other, the noise might cause the it to fall below the other very briefly. The comparator will see this, and the output may change. Sometimes this is very undesirable, especially if the comparator is driving an edge-triggered device.


^^Here we see a signal that is gradually rising over all, but has noise on it. The horizontal line is the threshold voltage. The noise causes it to cross it several times, leading to many transitions on the output.

So what to do? In this case we use positive feedback. Consider the following circuit:

The signal is applied to the positive input. Our reference voltage is at the positive input, and is set by the 10K resistors between the supply rails (+5V and 0V), so it will be close to 2.5V. However it is also affected by the output via the 100K resistor. So if the output is high at 5V, then the threshold voltage will be pulled up to about 2.62V, and when the output is low, the threshold will be pulled down to about 2.38V. That is our feedback, and we can tell it's positive because it reinforces itself (high output causes V+ to increase, which causes causes the output to saturate high even more, etc). An easier way to tell is simply that the output is fed back to the positive input.

So how does this help? Well lets say that our input is at 2 volts and our output is high, meaning the threshold is at 2.62V. Now we slowly raise Vin until it reaches 2.62V. The instant it does, the output transitions low, causing the threshold to be pulled down to 2.38V. Now in order to change the output again, we would have to bring Vin below 2.38V. So even if noise causes our Vin to wiggle around by a few millivolts, this will not cause extra transitions on the output.

This is called hysteresis. It means that once you enter a certain state, the device will resist changing to another. How much it resists change depends on your resistor values. If we were to make out 100K resistor into 10Megaohms, then the feedback would have a "weaker" effect on the threshold (in this case, the threshold would only change from 2.488 volts to 2.512 volts).

We can represent this visually:

Labeled here are our two possible threshold voltages (T and -T) and our two possible output voltages (M and -M). There are two different paths between the two thresholds. If we start with the input below -T and increase it, we will follow the lower path until we reach T, then the output will transition high. Once this happens, if we decrease the input below T, we will now take the upper path until we fall below -T and the output will fall low again. And repeat.

Note that this graphic, where increasing the input causes the output to go high, is not the same as the previous example, where increasing the input causes the output to fall. This is because in the first example, Vin was connected to the negative input, while the graph corresponds to a circuit with the input connected to the positive input. It can be done either way. It all depends on the specifics of the circuit.

The difference between the two threshold voltages is called the hysteresis gap. If, as in our first example, we wanted to prevent signal noise from changing the output, then the hysteresis gap would have to be at least as large as the amplitude of our noise (usually less than 10mv).

However, there are much more interesting things that can be done with hysteresis, as we will see next time: Relaxation oscillators and PWM.

Also, I said before that comparators and op amps are both differential amplifiers, and this is fundamentally true. However, they are not necessarily interchangeable. Devices specified as op amps are meant to be used as op amps and comparators are meant to be used as comparators. They have different properties that make them suited to one purpose (for example, comparators are usually faster and have higher gain, and have logic or open collector outputs, while op amps will have lower gain, frequency compensation, and push-pull outputs. Don't worry a lot about this terminology, for now).

ANIME AKBAR
Jan 25, 2007

afu~
Not getting much response I see. I'm I going too fast/slow? Too technical? Too boring?

Relaxation oscillators and PWM

Before getting to some good stuff, we have to understand one more circuit. It's called an integrator, and it's built using an op amp:


Recall that we learned earlier that when analyzing op amp circuits, we assumed that the two inputs are at the same voltage. This means that for this circuit, both inputs are at 0 volts. Therefore the current through R must be Vin/R (we'll say current is positive to the right). Since the input does not draw current, all of the resistor current flows through the capacitor. A capacitor's voltage will change at a rate proportional to the current through it, or to put it clearly:


After we do all the math (I'll leave it to you to prove it to yourself), we find that the output is equal to:

Or, quite simply, the output will be the integral of the input, divided by -RC. If we were to put a positive DC voltage on the input, the output would ramp down linearly over time. It's slope would be -Vin/RC. Of course, it would stop once it saturates. Again, we have to keep in ming the limitations of the op amp.


So, not that we've got that, we can combine the integrator with a comparator to make an oscillator. We do this by taking a comparator with hysteresis and an integrator and connecting them together:

Lets look at this step by step. First, lets say both devices are powered by +10 and -10 volts DC. Let us also assume that the output of the integrator starts at 0 and the comparator's output starts out low. Two things happen here: First, the + input of the comparator will be pulled negative by the output. Second, integrator will start integrating the output of the comparator, causing it's output to rise linearly (remember the output will be the negative integral, so a negative input does cause a positive sloped output). As the output increases, it will pull up the + input of the comparator, eventually causing it to become positive. The comparator output will immediately transition high. Now the integrator output will start to fall. Again, this will continue until it pulls the + input below zero again, causing the cycle to repeat itself. The output of the integrator will sort of "bounce" between the two threshold voltages created by the comparator hysteresis. Upon crossing either one, it will reverse direction and approach the other, forever.

What we have made is called a relaxation oscillator, also sometimes called a multivibrator. This simply means that it works by charging and discharging a capacitor over and over. Notice that this generates two waveforms. The output of the comparator will be a square wave with amplitude equal to the supply rails. The output of the integrator will be a triangle wave, meaning it's edges are linear. The amplitude of the triangle wave will be equal to the hysteresis gap of the comparator. The frequency of both signals is determined by all the components. I'll save you the math and just give it here:

Understand that frequency depends on the hysteresis gap and the slope of the integrator. A smaller hysteresis gap will cause frequency to increase, since the linear ramp will have less "bounce room," and increasing the slope of the integrator will increase frequency, since it will travel across the hysteresis gap faster.

Now this is cool, but what is it good for? Well, we can use this to make a pulse width modulator (or pwm) quite easily. First a few things about PWM. A pwm outputs a rectangular wave with a variable duty cycle. A rectangular wave looks like this:

It simply alternates between a high and low voltage at a fixed frequency. We call it a square wave when the high time is equal to the low time. When the high and low time aren't equal, like in the above picture, then we can describe the wave with the duty cycle. The duty cycle is the percent of the total period for which the signal is high. If the on time is t and the total period is T (like in the picture again), then the duty cycle is t/T * %100. So for a square wave, the duty cycle is 50%. For the pictured wave form, the duty cycle is around %33.

Turning our triangle wave into a pwm is easy. All we do is feed the triangle wave to one input of a comparator and a variable voltage to the other.

If we connect it as above, the output will be high when the triangle wave is above the DC threshold. So if our DC is high, the triangle wave will be higher for a small amount of time. If the DC is low, then it will be higher for more of the time. Therefore we have built a voltage controlled PWM. The frequency of the PWM will be the frequency of the triangle wave and its duty cycle will be determined by the DC input voltage. For this configuration, higher voltage will give lower duty cycle. By switching the comparator inputs, we would get higher duty cycle for higher input voltages.

Next time: Switching supply basics

StumblyWumbly
Sep 12, 2007

Batmanticore!

Three-Phase posted:

I just want to make sure I'm correct here, as far as the best/worst ways to turn variable X voltage into steady Y voltage (DC):

WORST (Efficiency wise)
-Resistor network
-Zener diode
-Linear regulator
-Switching regulator
BEST (Efficiency wise)
Yup, this looks about right.
Resistors are a bit worse, tho, since they are current dependent.

The noisy regulator problem is really common, though I've seen boards where it's done right and is completely unnoticeable.

I'm a little surprised you needed to boost the voltage up to 9V for some LEDs. What kind are you using? Couldn't you just run all 9 in parallel, rather then 2 groups of 3?

Fun electronics fact: Most digital chips that do PWM output actually have analog innards which produce the PWM the same way mtwieg's oscillator works. High accuracy timing is done in a similar way, with the chip internally producing a voltage ramp and stopping that ramp when the clock is supposed to stop, and doing an analog to digital conversion to figure out the time.

ANIME AKBAR
Jan 25, 2007

afu~

StumblyWumbly posted:

Fun electronics fact: Most digital chips that do PWM output actually have analog innards which produce the PWM the same way mtwieg's oscillator works. High accuracy timing is done in a similar way, with the chip internally producing a voltage ramp and stopping that ramp when the clock is supposed to stop, and doing an analog to digital conversion to figure out the time.
I'm pretty sure most intersil switchers use this (my) method, and they are generally solid devices. Higher end ones like from linear tech and on semiconductor use fixed-on-time variable-off-time pwm instead of fixed-frequency variable-duty cycle like in what I'm doing. The former is better if you want very high frequency operation, since normal relaxation oscillators have trouble working that fast.

Keebler
Aug 21, 2000

mtwieg posted:

Not getting much response I see. I'm I going too fast/slow? Too technical? Too boring?

No no this is good, keep 'em coming!

Is there any chance you could rename that pdf you linked in the first post? It's name is showing up as a bunch of unreadable characters and my computer won't let me download it.

BatDan
Apr 30, 2003

mtwieg posted:

Not getting much response I see. I'm I going too fast/slow? Too technical? Too boring?

No I think this is interesting, but this forum moves pretty slowly so I think it might take a while for a lot of people to see it. I just graduated from OSU in Eng. Phys. and I didn't get to take as many EE courses as I would have liked, so this is useful to me too.

Anyway in most of my courses I didn't learn as much about actual practical applications of my knowledge. Where do you learn those things? I could take every undergraduate EE class and I still feel like I wouldn't actually be qualified to design a complicated circuit for something. It seems that I learn more useful stuff using app notes from semiconductor companies than anywhere else.

babyeatingpsychopath
Oct 28, 2000
Forum Veteran


The PWM circuit is completely awesome.

Would it be suitable to make an LED flash based on battery level?

Say you have a battery-powered device with a power LED. Once the battery starts dying, the LED starts flashing, flashing more quickly/slowly as the battery gets closer to not being useful?

Could you think of another circuit that would be better suited?

StumblyWumbly
Sep 12, 2007

Batmanticore!

BatDan posted:

Anyway in most of my courses I didn't learn as much about actual practical applications of my knowledge. Where do you learn those things? I could take every undergraduate EE class and I still feel like I wouldn't actually be qualified to design a complicated circuit for something. It seems that I learn more useful stuff using app notes from semiconductor companies than anywhere else.
If you want to learn practical analog engineering, pick up The Art of Electronics, more commonly known as "Horowitz and Hill." Seriously, I wouldn't be surprised if literally every EE who does analog work has this book. It goes from the fundamentals of analog electronics, like impedance and what a resister is, to transistors and op-amp level design. It has some great reference designs, and is all written for easy readability, like mtwieg's posts.

If you want to learn more specific designs, like how to make a switching power supply, you usually just read up on chips available, pick one, and that chip or the company making it will have some reference designs you can pretty much copy and paste into your schematic.

Really good analog design is a pretty important field that most people are skipping over because they like digital stuff better. This means that if you get really good at it, companies will write you a blank check.

StumblyWumbly
Sep 12, 2007

Batmanticore!

babyeatingpsychopath posted:

The PWM circuit is completely awesome.

Would it be suitable to make an LED flash based on battery level?

Say you have a battery-powered device with a power LED. Once the battery starts dying, the LED starts flashing, flashing more quickly/slowly as the battery gets closer to not being useful?

Could you think of another circuit that would be better suited?
A neat idea.

2 problems I could see: The voltage drop tends to be pretty minimal as a battery dies. Manufacturers want the battery to be at full voltage right up until it's drained, and they usually get pretty close to that, but I'm sure you could work around this relatively easily (if the effect is a problem at all).

Second issue is that battery voltage also droops when you draw more current, since there is essentially a resistor inside the battery eating up your voltage. This isn't a problem for constant current consumption things, but other applications would need to measure how much current they were consuming, and factor that in.

There are battery management chips which do pretty much this, mostly for Li batteries for Cell Phones and such.

ANIME AKBAR
Jan 25, 2007

afu~

Keebler posted:

No no this is good, keep 'em coming!

Is there any chance you could rename that pdf you linked in the first post? It's name is showing up as a bunch of unreadable characters and my computer won't let me download it.

try this:
http://www.national.com/an/AN/AN-31.pdf

BatDan posted:

No I think this is interesting, but this forum moves pretty slowly so I think it might take a while for a lot of people to see it. I just graduated from OSU in Eng. Phys. and I didn't get to take as many EE courses as I would have liked, so this is useful to me too.

Anyway in most of my courses I didn't learn as much about actual practical applications of my knowledge. Where do you learn those things? I could take every undergraduate EE class and I still feel like I wouldn't actually be qualified to design a complicated circuit for something. It seems that I learn more useful stuff using app notes from semiconductor companies than anywhere else.
Well personally I probably spend three times as much time in the lab messing around with crap as I do on actual class work. I've learned mostly through experience, not theory. I took a applied circuit design class last semester which was really great since it was less "solve for X" than it was "go build this." It's a shame most people don't get too much practical experience through the classroom. Nowadays the average EE major couldn't make a pierce oscillator, or a voltage doubler, or a charge pump, or a switch debouncer. Things are all modular now. You buy black boxes that do all these things for you. All you have to do is read datasheets and fit pieces together. DIY solutions are sometimes far better (and almost always cheaper), but it's becoming a lost art :smith:

babyeatingpsychopath posted:

Would it be suitable to make an LED flash based on battery level?

Say you have a battery-powered device with a power LED. Once the battery starts dying, the LED starts flashing, flashing more quickly/slowly as the battery gets closer to not being useful?

Could you think of another circuit that would be better suited?
Changing the frequency of an oscillator with a voltage is more complicated. I might go over some methods later, but I'd rather stay on track for now.

If you wanted to have the brightness of an led vary with voltage, then that's easy. Voltage to current converters can be made out of just a transistor (or an op amp) and a few resistors. I think current sources were covered earlier in the thread.

StumblyWumbly posted:

If you want to learn practical analog engineering, pick up The Art of Electronics, more commonly known as "Horowitz and Hill." Seriously, I wouldn't be surprised if literally every EE who does analog work has this book. It goes from the fundamentals of analog electronics, like impedance and what a resister is, to transistors and op-amp level design. It has some great reference designs, and is all written for easy readability, like mtwieg's posts.

Seconding this. Horowitz and Hill was the textbook for my applied circuit design class, and it's the only engineering textbook I actually use outside the course. It's beginner friendly, but also very practical and thorough.

ANIME AKBAR fucked around with this message at 00:16 on Apr 17, 2008

Mach Won
Jun 17, 2004

Is UNC playing? My post is either whining about (1) ref favoritism, (2) unfair recruiting/player caliber, (3) opposing team sucking or (4) the inevitable UNC win. The day you see me giving UNC credit for anything is the day someone hacked my account.

Roy era: 1-16 :qq: RIVALS!!!!!
I have The Art Of Electronics, and every time I try to read it, I feel swamped by all the information. This is doubly bad since I am about to graduate with my BS in EE and CPE!

ANIME AKBAR
Jan 25, 2007

afu~
It can seem overwhelming if you skip important parts. If you try to learn about miller compensation without first looking at frequency response and transistor models, it won't make sense at all. HH is admirably good at verbalizing concepts, but you can't skip all the nitty gritty stuff either. It's likely that you were just missing some basic precursor concepts. Any thing in particular you were having trouble with? I may or not be able to explain it myself, but I should be at least able to point you to the right resources.

jovial_cynic
Aug 19, 2005

Question about audio circuits.

I'm familiar with the gain clone, which is a very simple circuit for high fidelity audio amplification; it uses the LM1875 chip, and very few additional components.


I'd like to build up an audio amplifier for my musical instruments. I know that amps like the gain clone are generally not used as guitar amps, but since I play the electric violin, a good amount of fidelity is useful to me.

Anyhow, I've got an old JVC dual channel stereo tuner that I've taken apart. It doesn't use a single chip for the amplification like the gain clone does; instead, it uses two sets of power-transistors: a pair of 2SB1429 and a pair of 2SD2155, which apparently "complement" one another, one handling (+) voltage and the other handling (-) voltage.

Anyhow, with the parts scavenged from the JVC, I've got a solid power supply, a handful of power transistors, and all kinds of passive components at my disposal.

If I wanted to build a simple high-power amplifier from the ground up, is there a write-up handy based on these power transistors? Do all power transistors pretty much work the same way? I'm not familiar enough with power transistors to know if a (+) and (-) pairing of power transistors is common; this is rather new to me.

Is there an easy way to wire the power-transistors in place that would work similarly to the LM1875? The gain clone is an easy circuit to build up, and basically, I'm just wondering if there's a way to swap in the power-transistors from the JVC into the circuit with minor modifications.

SporkOfTruth
Sep 1, 2006

this kid walked up to me and was like man schmitty your stache is ghetto and I was like whatever man your 3b look like a dishrag.

he was like damn.

Mach Won posted:

I have The Art Of Electronics, and every time I try to read it, I feel swamped by all the information. This is doubly bad since I am about to graduate with my BS in EE and CPE!

This is why I believe, contrary to the existing opinion in this thread, that The Art of Electronics is not the book to start with. Sure, it covers a ridiculous number of topics, but the level of detail is sorely lacking as a result. I'm about to graduate in June with my BSEE and start a Ph.D. program in the fall, and I get lost and confused a fair bit when I read Art of Electronics.

As another example, some Mech. Eng. friends of mine had it as their textbook for their "Advanced Electronics" class, but they ended up using Google and another textbook (Sedra and Smith's Microelectronics, for the record) more often. Mind you, these people were not new to basic circuit analysis or design. They took the same first circuits class that I had to take and did reasonably well! The lack of depth I was talking about earlier actually made it harder for them to understand the concepts behind stuff like Schmitt triggers and various rectifiers, because it basically said "This is a blah, look at this graph to see what it does, here's some historical background." Couple that with a terrible professor (or trying to self-teach), and you're not helping yourself.

The Art of Electronics is great as a desk reference or a refresher for certain design aspects. As an introductory text? Hell no.

rixor
Jul 14, 2004
your mom...
I hope this isn't out of place, but I started a thread in SH/SC with project I am working on and I had some electrical questions. I won't repost the question, but I do urge anyone that has any knowledge of IGBTs or digital phase-control to please read it.

Thread is here: http://forums.somethingawful.com/showthread.php?threadid=2828126

Edit: fixed url

Zuph
Jul 24, 2003
Zupht0r 6000 Turbo Type-R

SporkOfTruth posted:

As another example, some Mech. Eng. friends of mine had it as their textbook for their "Advanced Electronics" class, but they ended up using Google and another textbook (Sedra and Smith's Microelectronics, for the record) more often. Mind you, these people were not new to basic circuit analysis or design. They took the same first circuits class that I had to take and did reasonably well! The lack of depth I was talking about earlier actually made it harder for them to understand the concepts behind stuff like Schmitt triggers and various rectifiers, because it basically said "This is a blah, look at this graph to see what it does, here's some historical background." Couple that with a terrible professor (or trying to self-teach), and you're not helping yourself.

The Art of Electronics is great as a desk reference or a refresher for certain design aspects. As an introductory text? Hell no.

I had a similar problem: My Electronics professor was absolutely terrible. The class text was Sedra and Smith, and paired with his poor instruction, it made absolutely no sense. I ended up supplementing with The Art of Electronics and Google, and ended up the better for it. I'm not sure if there's a single really good text for self-teaching out there, though.

hobbesmaster
Jan 28, 2008

mtwieg posted:

You buy black boxes that do all these things for you. All you have to do is read datasheets and fit pieces together. DIY solutions are sometimes far better (and almost always cheaper), but it's becoming a lost art :smith:

The problem is that your time is worth money, that black box is one less thing you have to design and implement.

the wizards beard
Apr 15, 2007
Reppin

4 LIFE 4 REAL

hobbesmaster posted:

The problem is that your time is worth money, that black box is one less thing you have to design and implement.

If you have never designed and implemented that black box or don't know how, then you really shouldn't be using it.

SnoPuppy
Jun 15, 2005

the wizards beard posted:

If you have never designed and implemented that black box or don't know how, then you really shouldn't be using it.

I hate this argument, since you could extend it to so many things that are just used as "black boxes". If I've never built a D-FF from scratch, or a multiplier from gates, does that mean I shouldn't use a micro controller?

While it's beneficial to understand roughly what is going on behind the scene, it isn't always needed. Many times doing it from scratch, while a learning exercise, is also an exercise in time and patience - especially when off the shelf building blocks will do it faster and cheaper. I agree that a basic understanding of the principles make solving problems easier, but that doesn't mean you have to build it from scratch (or even know how it works internally).

For the record, I don't mean to piss on the thread - I really like the explanations/tutorials that are being posted.

ANIME AKBAR
Jan 25, 2007

afu~

jovial_cynic posted:

Is there an easy way to wire the power-transistors in place that would work similarly to the LM1875? The gain clone is an easy circuit to build up, and basically, I'm just wondering if there's a way to swap in the power-transistors from the JVC into the circuit with minor modifications.
So wait, do you want to replace the lm1875 with a circuit make with discrete components? There's probably no feasible way to get comparable performance to that op amp. Look at its internal schematic, in the datasheet.

Making transistor ac amplifiers is pretty simple, but op amps are generally really complex, and if you want high fidelity, then you want op amps.

hobbesmaster posted:

The problem is that your time is worth money, that black box is one less thing you have to design and implement.
This is true some times. Black boxes have legitimate uses, but a lot of designers I know rely way to much on them. If they want a precise constant clock source, they'll buy a high end PLL or whatever for five dollars rather than assembling the six components needed to make a pierce oscillator with fifty cents, which literally works just as well. Need a bandpass filter? They'll get a ten dollar switched cap filter, rather than a dual op amp with a couple resistors and capacitors for a dollar. Need an RF transmitter? Screw a few dozen components for five bucks, lets get a hundred dollar zigbee!

et cetera.

ANIME AKBAR fucked around with this message at 02:24 on Apr 19, 2008

SnoPuppy
Jun 15, 2005

mtwieg posted:

This is true some times. Black boxes have legitimate uses, but a lot of designers I know rely way to much on them. If they want a precise constant clock source, they'll buy a high end PLL or whatever for five dollars rather than assembling the six components needed to make a pierce oscillator with fifty cents, which literally works just as well. Need a bandpass filter? They'll get a ten dollar switched cap filter, rather than a dual op amp with a couple resistors and capacitors for a dollar. Need an RF transmitter? Screw a few dozen components for five bucks, lets get a hundred dollar zigbee!

et cetera.

I dunno - even some of your examples are kinda iffy. If I want a precise clock source, I am willing to pay for an oscillator that has < 0.5 ps of jitter rather than try to develop and debug one myself. Plus a stand alone oscillator takes up less space on a PCB than several discrete components. PLLs have their place when you are trying to get two clocks in phase with one another, or when you need to have very low clock skew (zero delay buffer).

You have to realize that when you buy something like the zigbee, you're not wasting all that money compared to $5 worth of components. You get a part with known characteristics and a much easier to use interface. For $5 worth of parts, do you know the approximate bit error rate? The power consumption?

What specifically makes an op-amp an "ok" black box but an oscillator or RF IC not ok?

jovial_cynic
Aug 19, 2005

mtwieg posted:

So wait, do you want to replace the lm1875 with a circuit make with discrete components? There's probably no feasible way to get comparable performance to that op amp. Look at its internal schematic, in the datasheet.

Making transistor ac amplifiers is pretty simple, but op amps are generally really complex, and if you want high fidelity, then you want op amps.

Well, that was my first idea, but after doing some more research, it doesn't look like that's the way to go. I guess a better approach would be to get an understanding of how basic solid-state amplifiers work. I can follow instructions as easily as the next guy, but I'd like to know why things work the way they do, so I can take the power-transistors I've got and build an audio amplifier around them.

ANIME AKBAR
Jan 25, 2007

afu~

SnoPuppy posted:

I dunno - even some of your examples are kinda iffy. If I want a precise clock source, I am willing to pay for an oscillator that has < 0.5 ps of jitter rather than try to develop and debug one myself. Plus a stand alone oscillator takes up less space on a PCB than several discrete components. PLLs have their place when you are trying to get two clocks in phase with one another, or when you need to have very low clock skew (zero delay buffer).

You have to realize that when you buy something like the zigbee, you're not wasting all that money compared to $5 worth of components. You get a part with known characteristics and a much easier to use interface. For $5 worth of parts, do you know the approximate bit error rate? The power consumption?

What specifically makes an op-amp an "ok" black box but an oscillator or RF IC not ok?
You're missing the point, which was that I see this in applications which don't require any where near the sophistication of the parts used. You don't need a PLL for a calculator. You don't need a zigbee for a remote temperature sensor.

If you're making an MCU for the navy or the control for a pacemaker, then sure, go for it.

jovial_cynic posted:

Well, that was my first idea, but after doing some more research, it doesn't look like that's the way to go. I guess a better approach would be to get an understanding of how basic solid-state amplifiers work. I can follow instructions as easily as the next guy, but I'd like to know why things work the way they do, so I can take the power-transistors I've got and build an audio amplifier around them.

Google turns up a lot of good stuff on how op amps work. That's mainly how I learned about it. Just make sure you understand transistors really well, because if you don't nothing will probably make sense.

ANIME AKBAR fucked around with this message at 04:33 on Apr 19, 2008

Blackhawk
Nov 15, 2004

I need some help with interfacing 5V sensors to 3.3V circuits. I'm trying to interface a 5V analogue output (0-5V) pressure transducer to a 3.3V datalogger and I want to do it with as little error as possible. The simplest way would probably be using 2 resistors as a voltage divider to drop the 0-5V signal to 0-3.3V however I'm worried about the error inherent with this method and there's probably much better ways to do it.

SnoPuppy
Jun 15, 2005

Blackhawk posted:

I need some help with interfacing 5V sensors to 3.3V circuits. I'm trying to interface a 5V analogue output (0-5V) pressure transducer to a 3.3V datalogger and I want to do it with as little error as possible. The simplest way would probably be using 2 resistors as a voltage divider to drop the 0-5V signal to 0-3.3V however I'm worried about the error inherent with this method and there's probably much better ways to do it.

How precise do you actually want it (and what is the sampling rate)? Also, does the datalogger already have an analog to digital converter? Many PICs and other micro controllers have them built in already, although I don't know if the error will be sufficiently low.

If you don't have any input impedance needs, I would recommend just using a resistor divider network with smaller, high accurate resistors (probably metal film <= 1%). Smaller resistors will have less thermal noise, although depending on the ADC it might be overkill.

Fifty-Nine
Oct 15, 2003

Blackhawk posted:

I need some help with interfacing 5V sensors to 3.3V circuits. I'm trying to interface a 5V analogue output (0-5V) pressure transducer to a 3.3V datalogger and I want to do it with as little error as possible. The simplest way would probably be using 2 resistors as a voltage divider to drop the 0-5V signal to 0-3.3V however I'm worried about the error inherent with this method and there's probably much better ways to do it.

So the pressure transducer has a single analog output? If that's the case, you're going to need a analog-to-digital converter (ADC or A/D) of some sort. The ADC will have a reference voltage you can set, so the 5V-3.3V interface shouldn't be a problem.

There's lots of ways to build ADCs, but if you're that concerned about accuracy/precision, you should probably just get a single-chip type thing (try https://www.analog.com).

Your maximum precision will be limited by how wide the input bus on your data logger is--you can't do any better than +-1/2 * LSB (least-significant bit). Basically, the ADC maps an analog value to a finite number of digital values, which results in the values being quantized. You can calculate the precision by determining how big of a change is necessary in the analog value to affect the digital value.

To calculate that is actually pretty simple--we take the range of analog values, (5V - 0V) = 5V, and divide it by the total range of digital values, 2^width. The quantization error is then +-1/2 of the resulting value for reasons I'm forgetting.

+-1/2 * (VrefH - VrefL) / (2 ^ width)

For instance, supposed you use an 8-bit bus, then your maximum theoretical precision would be:

+-1/2 * 5V / (256) = +- 9.766 mV

Pretty reasonable. Note that the more bits you use, the better your precision.

You will also need to consider your sampling rate when deciding on an ADC--how fast do you want to record values from the transducer?

Also, what are you using as your data logger? Is it something that was pre-built or could you describe the internals?

edit: beaten, but my post has MATH

Fifty-Nine fucked around with this message at 16:54 on Apr 19, 2008

hobbesmaster
Jan 28, 2008

the wizards beard posted:

If you have never designed and implemented that black box or don't know how, then you really shouldn't be using it.

Do you enjoy your GUI?

Or, more relevant to this discussion... if you can go all the way to the bottom of layers of abstraction in how a diode works, then you're owed at least one Nobel prize in physics.

hobbesmaster fucked around with this message at 21:19 on Apr 19, 2008

Nubile Cactus
Aug 1, 2004
I am a cactus. :)
What's a good way to get into microprocessors? I'd like to get one of the cheaper Atmega chips to learn with, but I'm not quite sure what'd be the best introductory/cheapest way to learn how to program the chip. I've seen some programmers such as the STK500 (something around that I think) but I don't really want to spend $50 or $100 on this quite yet.

Any recommendations? The atmel butterfly looks slightly interesting, but I'd rather just work with the microprocessor and various components I already have instead of the integrated lcd/breakout/etc on the butterfly.

hobbesmaster
Jan 28, 2008

Nubile Cactus posted:

What's a good way to get into microprocessors? I'd like to get one of the cheaper Atmega chips to learn with, but I'm not quite sure what'd be the best introductory/cheapest way to learn how to program the chip. I've seen some programmers such as the STK500 (something around that I think) but I don't really want to spend $50 or $100 on this quite yet.

Any recommendations? The atmel butterfly looks slightly interesting, but I'd rather just work with the microprocessor and various components I already have instead of the integrated lcd/breakout/etc on the butterfly.

Those are microcontrollers, not microprocessors. A microcontroller integrates all the things you think of in a computer (memory, storage, communications, etc.) and other goodies (ADC/DAC, timers, etc.) into one package. A microprocessor needs some more supporting hardware for your to have a computer (for example, memory).

But anyways... as far as atmel parts go take a look at the arduino USB board (dicimila or whatever). I've also used the Digilent Cerebot II board and can say that its pretty decent.

You can also just buy a DIP from digilent... there are tutorials for how to hook it up. Kinda annoying to program though...

Zuph
Jul 24, 2003
Zupht0r 6000 Turbo Type-R

Nubile Cactus posted:

What's a good way to get into microprocessors? I'd like to get one of the cheaper Atmega chips to learn with, but I'm not quite sure what'd be the best introductory/cheapest way to learn how to program the chip. I've seen some programmers such as the STK500 (something around that I think) but I don't really want to spend $50 or $100 on this quite yet.

Any recommendations? The atmel butterfly looks slightly interesting, but I'd rather just work with the microprocessor and various components I already have instead of the integrated lcd/breakout/etc on the butterfly.

If you don't want to work with a more all-in-one solution, the guides over at Sparkfun are great: http://www.sparkfun.com/commerce/hdr.php?p=tutorials

Instead of getting the sparkfun programmer, I bought the USBtinyISP from Adafruit industries: http://www.ladyada.net/make/usbtinyisp/index.html

Adbot
ADBOT LOVES YOU

Nubile Cactus
Aug 1, 2004
I am a cactus. :)

Zuph posted:

If you don't want to work with a more all-in-one solution, the guides over at Sparkfun are great: http://www.sparkfun.com/commerce/hdr.php?p=tutorials

Instead of getting the sparkfun programmer, I bought the USBtinyISP from Adafruit industries: http://www.ladyada.net/make/usbtinyisp/index.html

Appreciate it. Went ahead and grabbed the usbtiny programmer from adafruit.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply