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~
Can anyone tell me where I can get lead free solder paste? Like a few hundred milliliters of the stuff.

And REAL MEN drive their LEDs with current sources.

Adbot
ADBOT LOVES YOU

ANIME AKBAR
Jan 25, 2007

afu~

slackingest posted:

digikey.com or mouser.com should be able to hook you up.
That was the first place I checked, but they don't have it (in reasonable quantities, at least).

Also I dig the new mosfet av.

ANIME AKBAR
Jan 25, 2007

afu~

ValhallaSmith posted:

These guys have free 250g paste samples: http://www.smtsolderpaste.com/free_solder_paste.php
Well poo poo, that looks great, thanks.

And as for your power supply, you might be best off rolling your own linear regulator. It's fairly simple and there's no need for digital stuff (unless you want a built in meter or something). I can post an example schematic if you want.

ANIME AKBAR fucked around with this message at 02:04 on Jan 13, 2008

ANIME AKBAR
Jan 25, 2007

afu~
Jairbrekr would you be mad if I stole your gimmick and did a a minilesson on transistors?

edit: poo poo, you did that already. Maybe I could do some example transistor circuits.

ANIME AKBAR fucked around with this message at 02:57 on Jan 13, 2008

ANIME AKBAR
Jan 25, 2007

afu~

ValhallaSmith posted:

I've built tons of those. What I'm trying to come up with is something very cheap for the hobbyist. The reason I would go with a pic or avr is because using one of those over USB is cheaper than adding in everything you need for a display, controls and switches. Plus I want to keep these at a very small form factor (altoid form factor). I've been reading up on synthetic instrumentation for a chunk of the day. I might draw something up that heads in that direction. Instead of a power supply you could basically build a DAC. Then if you want a voltage meter you add a ADC voltage module. If you want power factor correction/metering you add a shunt resistor, amp and another adc. Basically a very generic instrument set that performs most of the measurement on the PC. It would be USB 2.0 based so that would kind of limit things at times. USB has crappy latency.

But 10$ per module isn't that bad I don't think. Most people don't need sampling in the ghz range. I think just making a 1khz DAC and a 1mhz adc would be a good start.
uh, it's pretty drat hard to get any simpler than a linear regulator. I don't see how one could make a supply out of a DAC, since they have output impedance and ripple and all that. Measuring output parameters with ADCs sounds fine though, but only for display, not as the feedback element. You should make the feedback path completely analog.

The next logical step up from a linear regulator would be a switcher, which is what I think most good bench supplies use. But unless you're very concerned with load and line regulation, it probably wouldn't be worth the added complexity over a linear supply.

ANIME AKBAR
Jan 25, 2007

afu~

900ftjesus posted:

If you're at all serious about getting started in electronics, you need this book:
http://books.google.com/books?id=bk...-with-thumbnail
:rock: Horowitz and Hill

ANIME AKBAR
Jan 25, 2007

afu~

Mr. DNA posted:

I need to control a solenoid from a microcontroller. The solenoid will need up to 1.8A. Is this a suitable MOSFET to use? STM STD50NH02L

I'm looking at the graphs and it looks like it will be fine. The micro will output 5V and the solenoid will be on a 12V supply. So Vgs is 5V and Vds is 12V, correct?.

Looking at Figure 3, the thing can output huge amperage at my operating voltages, so everything seems fine. However, Figure 2 is throwing me off. I still seem to be operating below the curve, but I'm not sure what the labels (100us, 1ms, 10ms) mean. Does this mean I can't run this switch continuously at Vgs = 5V, Vds = 12V, and Id = 1.8A?

Also, is there something more suitable/standard for this application? Cost is an issue, so if there's a cheaper way to accomplish this, I would love to know about it.
While the mosfet is on, the drain source voltage should be very small (since it's drain source resistance will be very low). Figure three isn't what you should be looking at. The power and current max ratings given are way higher than what you need, so there's no need to worry about that.

With a Vgs of 5V, your Rds will be around 10 milliohms. With 1.8 amps, it will be dissipating maybe 40 milliwatts. The mosfet is rated for 60 Watts.

Given what capabilities you need, you shouldn't be paying more than a buck on whatever you choose. Look at some Fairchild semiconductor FETs. They make good inexpensive ones.

ANIME AKBAR
Jan 25, 2007

afu~
for a project I need some good antistatic protection for the pins of my microcontroller. It has built in protection diodes, but I don't really trust them since their characteristics aren't specced in the datasheet. The easiest way would be to just put a resistance in front of the input, but the thing is I will be switching it to an output also, and I don't want it to have too high of an output impedance. So it seems my best option is to put on some redundant protection diodes. However, I'm not sure what kind to get. I'd assume Schottkys with good peak current ratings would be good, but I'm not sure.

Any advice?

ANIME AKBAR
Jan 25, 2007

afu~

ValhallaSmith posted:

If you can get reasonably decent resolution on your PCB, you can try using spark gaps. They are pretty effective at ESD protection. Just have small spots where there is an unobstructed .5 mm gap to ground.
well I'm not sure if I'll be making custom pcbs for this particular project, since it's reasonable simple. I'll keep that in mind though. The minimum gap allowed is 8mil, so that should be small enough. I assume for each pin I will want gaps going to both ground and the positive supple rails correct? and there shouldn't be any soldermask over the gap?

ANIME AKBAR
Jan 25, 2007

afu~

Jonny 290 posted:

From what I remember, linear power supplies are about 50-70% efficient depending on the design.

Efficiency of linear regulators is Vout/Vin (if you assume quiescent current is zero, that is. It's usually so small it's negligible).

ANIME AKBAR
Jan 25, 2007

afu~

Jayls5 posted:

mtwieg recommended I post here.


I build lasers, and I need help making a circuit for a laser diode.

I've built circuits that drop voltage down, but now I want one that steps voltages up. This is for the better battery options... like a single AAA 1.5V source, etc.


Now, I have no idea how to go about making a reliable circuit that does this. I need it to put out 4.5-5.5V (5V preferably) and 35-45mA current to this diode. If it's possible to vary these precisely with a resistor swap (or pot), let me know.

Is there a way to adjust current/voltage output on these?


If I'm missing any pivotal information, let me know as well.
What you want is called a Boost converter (sometimes called a step up regulator), which can take voltages a low as 0.5 volts and turn it into something higher. They're pretty efficient (usually over 80%, sometimes as high as 95%), but they're slightly tricky to use. Also, you won't find them in your local radio shack, so you'll most likely have to order them online.

Generally the voltage is set the same way as an lm317: a resistor divider from output to ground, with the divided voltage being held at some reference voltage.

ANIME AKBAR
Jan 25, 2007

afu~
Your circuit would look something like this:



Your output could be adjusted via any of the three resistors. The exact design and component values will depend on your boost converter (datasheets typically tell you exactly what you need to know).

When you say they give to much current out, I think you're misunderstanding what these things do. They regulate voltage, not current (though most will limit the current output). You control current by voltage and the load impedance at that voltage.

ANIME AKBAR fucked around with this message at 04:18 on Jan 28, 2008

ANIME AKBAR
Jan 25, 2007

afu~
charge pumps are nice for their simplicity and and efficiency, but they have their limitation. They're limited to low-current loads, since they require low-esr capacitors to work properly, and therefore you really can't just stick a giant electrolytic on the output to reduce ripple. Also, they are unregulated, so you're usually stuck with inverters or doublers. I use them when I want to make a tracking negative power rail for battery powered devices, but beyond that I'll usually go for a boost/buck converter.

ANIME AKBAR
Jan 25, 2007

afu~

Jayls5 posted:

Will something (such as a laser diode) only pull a specific current at a certain voltage? Is that why a steady voltage source implicitly acts as a current regulator? I was trying to tell my friend this originally if that's the case.


Now, I am concerned about the properties of a diode itself. It is my understanding that they get "runaway" resistance. As temperature increases, resistance decreases on the diode... further increasing the current and heat to it as a result. This quickly results in diode death. Now, on these boost converters, the circuit will keep this from happening?

Part of the picture in your link is cut off on both sides, do you have the rest of it? I really appreciate the help.
Diodes aren't characterized by resistance. They have I vs V characteristics which generally look like this:

Usually you will operate it at around the "turn on" voltage, where it starts looking like a low impedance. Just putting a resistor in series with it of appropriate size will usually work fine (as in the schematic I posted). As for current regulation, it most likely isn't necessary. I highly doubt the properties of the diode will change enough to significantly change its power output.

Do you have a datasheet for the diode?

ANIME AKBAR
Jan 25, 2007

afu~

Jayls5 posted:

I think this is the same one I have:
http://www.photonics.uk.com/products/sanyo_violet_laser_diodes/dl-3146-151.pdf

Everything seems fine, then (though parts of the pdf won't display). The circuit I showed should be fine. The best way to regulate current would be with the series resistor. I doubt the diode's heat will have enough positive feedback to cause it to fail.

If you really want to, you could use a circuit that makes a current source out of your voltage source. A simple one would be as follows:

A normal red LED provides a stable voltage reference of around 1.5 volts (this may vary from LED to LED, but the point is it remains pretty much constant regardless of the load on the circuit). The current through the laser diode will be (practically) equal to the current through R2. The voltage across R2 will be the Voltage of the red LED minus the base emitter voltage of the transistor (0.6 volts). To sum it up, the laser LED current is equal to (Vd - Vbe)/R2, or 0.8/R2. So you can easily adjust R2 to change current (just make sure it can't go to zero).

You will still need to boost the voltage, since at the very minimum the LED needs 3 or four volts. Supplying this with five volts from a boost converter should be fine.

The one downside of this is that it requires some extra current in order to get that 1.5V across the red LED. There are more efficient ways to do it, but they're fairly complex and aren't worth the trouble.

Also, did you ever simple consider using a higher voltage batter?

ANIME AKBAR
Jan 25, 2007

afu~

Wisdom posted:

I notice Radio Shack sells these. Is this a good kit to use to get into the hobby?
It's a good price for what you get. But if you're at all serious about using microcontrollers, don't bother with BASIC stamp stuff. AVRs and PICs are far more versatile and powerful for the same price. They just have a longer learning curve.

Try the microcontroller thread for this kind of stuff.

ANIME AKBAR
Jan 25, 2007

afu~

kid sinister posted:

Here's a question. I just noticed that the caps on my motherboard were bulging. It's old and out of warranty, but I'd like to keep this machine running. I'm pretty handy with a soldering iron and I'd like to replace these caps myself. My problem is that I'm kinda overwhelmed with the selection at Digikey. According to the stats on those bad caps, I'd need some 2200uF 6.3V caps and some 1500uF 16V caps. Do I just need to match up those numbers for replacements?

look for additional information on the old caps. There should be a temperature rating and possibly a series indicator marked on their cases. You want to at least match the temp rating. If you can determine what series they are, search for it on digikey (or google if it's really old) and you can get all its specs there.

For large supply caps, you'll generally want low ESR, good temperature stability, and high ripple current ratings. How good these parameters need to be depend on the circuit, but I don't think we'll know that much. I wouldn't sweat it too much.

ANIME AKBAR
Jan 25, 2007

afu~

Zaxxon posted:

Hey anyone willing to give me a hand with a circuit. It's called a negative impedence converter, it's built around op amps and you use it to make filters.

The idea is that the effective input impedence will be -Z, where Z is whatever you connect between the inverting input and ground. It looks very much like a typical op-amp current source, but the positive feedback is wierd.

feel free to use a lot of profanity if you want.




Think about it this way. Define impedance as V/I. Assuming the op amp is not saturated, the voltage at the noninverting input (Vin) will equal the voltage at the inverting input. So the current across Rz will be Vin/Rz, as will the current across the negative feedback resistor (call it R2). In this sense it pretty much is a current current source. The output of the op amp will be Vin(1 + R2/Rz). Therefore the current across the positive feedback resistor (call it R1) will be [Vin(1 + R2/Rz) - Vin]/R1, or -(Vin/Rz)(R2/R1). This current is negative because it's flowing into the voltage source. Normally this circuit will be built with R2 = R1, so it simplifies to I = -Vin/Rz. Do some algebra and you get -Rz = Vin/I. Therefore, since we defined impedance as V/I, Zin = -Rz. Bam.

ANIME AKBAR
Jan 25, 2007

afu~

babyeatingpsychopath posted:

I asked this somewhere else, but I'll ask again here:

If you connect an LED whose voltage drop is 1.2V at max current to a 1.2V source, why do you still need a resistor in the circuit?
Ideally it will be fine, but in practice it's a bad idea because the Vf will vary, even between similarly specified leds. If its Vf is 0.1V lower than expected, you may very well be looking at a double in current. And of course the voltage source will likely have its own issues with line and load regulation.

Are you asking because your supply voltage is low, or because you just don't want to bother with resistors?

ANIME AKBAR
Jan 25, 2007

afu~

yergacheffe posted:


Or does it have to be on the anode side? I'd try it out but I don't have any more LEDs I can sacrifice.
Doesn't matter. As long as the diode is pointing the right direction, the resistor can be on either side.

ANIME AKBAR
Jan 25, 2007

afu~

nobody- posted:

Could someone explain impedance to me?
It's pretty much impossible to explain more than basic concepts adequately without going into some high level math. Analyzing crosstalk and bode plots and stuff like that is pretty much what spice programs were meant for; figuring them out with pencil and paper is a nightmare.

If you stick to one or two reactive components, then it's pretty easy. A reactive component is one whose impedance changes in the frequency domain, i.e. inductors and capacitors. Search for wikipedia for passive low pass and high pass filters. It'll explain as well as I can.

ANIME AKBAR
Jan 25, 2007

afu~

Jayls5 posted:

I forgot to check this thread for a while.

I have been using a higher voltage battery from the start (9V). I was merely interested in shrinking the size of the device. 9V batteries are too large for an aesthetically pleasing laser pointer, and they're far more expensive... $2.50 a piece.

The blu-ray laser takes a bit more voltage to lase. It needs 5-5.5v just to run. I'm not sure exactly what I'm going to do for a cheap practical driver that uses 1.5V AAA just yet, but I definitely appreciate the input.

look into a23 batteries. 12 volts and half the size of a AAA. Not sure how much current they can deliver though. You can find them at most stores (radioshack for sure).

ANIME AKBAR
Jan 25, 2007

afu~

Jonny 290 posted:

OK, help me wrap my head around this one. I created a touch sensor out of a common collector amplifier with a 2n5306 darlington, a +5v bias voltage (for 4.3 at the emitter) and +12 fed to the collector (it's what was set up on my board at the moment). Load is a 2.2v drop LED with a 47 ohm resistor (ignore the bad sizing for now).

Like a good Darlington amp should, I get full current through the LED when I touch the Vbias with one hand and the base with the other. HOWEVER, when I touch my hand to only the base, the LED dimly lights and I measure about 43 mV across the load resistor, calculating to about 600 uA of current flowing! Dividing this by average Darlington gain of 10k, I get a base current of 60 nA. Is this body capacitance at work, or what the hell is going on?

How are you biasing it? Also, if you're using the darlington shouldn't you get around 3.6V at the emitter?

Putting things together from a verbal description is hard. Maybe you could invest in drawing it, maybe in a simple CAD program (this goes for people in general)?

And there are a few things in the human body model that could explain it. Capacitance is one. If you continue touching it, how long does current keep flowing?

ANIME AKBAR fucked around with this message at 19:02 on Feb 9, 2008

ANIME AKBAR
Jan 25, 2007

afu~

babyeatingpsychopath posted:

Ok, if I remove the LED/transistor entirely and just read voltage at pin 3, still nothing. I've triple-checked everything. I've even duplicated this circuit on BOTH sides of my 556 to no avail. What gives?
If it still doesn't work, make sure the datasheet says it is meant to work on that supply voltage (make sure you're looking at a datasheet for the right type of 555 too).

Also, just to try, take the bypass cap off the control voltage pin. I can see too large of a capacitance there possible screwing things up. 0.1uF is all you'll ever need.

And what does the voltage across the timing capacitor read?

ANIME AKBAR fucked around with this message at 08:13 on Feb 10, 2008

ANIME AKBAR
Jan 25, 2007

afu~

babyeatingpsychopath posted:

Ok, I'm back. I'm still dicking with that 555/556 blinky light maker.

I've put this circuit on a 555 and both sides of a 556. Identical behaviour in all of them.

When I touch the "output" pin to Vcc, the LED latches on. When I touch Vcc to "THRS" it turns off.

This doesn't make any sense. It won't turn on when I hit "TRIG" or "CV" just "THRS". Did I burn out a 555 and both timers in the 556? What other faults could exist?

How can I check to see if my 555/556 is burned out/dead/whatnot?

Umm you should never touch an output directly to a low impedance (either supply rail). That'll kill the IC quick. Touching thresh to Vcc should make the light should go off, so that's okay.

Don't just go making random connections with the Vcc or Ground. Not without some resistance anyways. The schematic you posted will work, guaranteed. If it doesn't, then either you goofed up or a component is dead.

hook it up in astable mode again. Here is a good test circuit for it (maybe use a bigger timing cap so it's slower):

taken from this awesome 555 website, which you should read thoroughly.

Make sure everything is right. Then probe the capacitor voltage. It should be changing between 1/3Vcc and 2/3Vcc. If it's above 2/3, make sure your discharge pin is attached. If it's below 1/3, make sure the trigger pin is attached. If it falls and rises between 1/3 and 2/3, then it's working.

turbo sex bat 4000 posted:

What's the best sketchy ebay store/angelfire website to buy luxeon type high power LEDs from?
What's wrong with digikey?

ANIME AKBAR
Jan 25, 2007

afu~
could you post the whole thing? I can't make heads or tails of the table.

ANIME AKBAR
Jan 25, 2007

afu~

Cuw posted:

I wanted to get a DSP to mess around with, i think they are freakin cool, outside of class but drat are they expensive. For a decent AD Blackfin on a test board it is $500 :(

Sound card = DSP (audio frequency only, of course)

ANIME AKBAR
Jan 25, 2007

afu~

Maynardr6 posted:

This is the best video I've found so far for soldering surface mount stuff without really expensive soldering equipment like hot air guns.

http://www.youtube.com/watch?v=3NN7UGWYmBY&feature=related
Nice. So far I've managed TQFPs and even MSOPs and 0603 passive parts with just an iron and wick, but it looks like I should get some flux too. That quickchip stuff looks great too. I'll probably check out their QFN soldering guide, since those are a huge pain in the rear end.

ANIME AKBAR
Jan 25, 2007

afu~

radioactivelego posted:

I'm looking to do a little project that uses multi-color LED's that react to sound. Imagine an 80's LED tachometer except it reacts to sound (or hey if frequencies are possibly even cooler). It'd be hooked up to a computer microphone and would be aimed at a sound. dB or frequencies I want 5 different color LED's (like a blue to white gradient) that react and light up based on levels. I would imagine some form of resistors would be in order and would revolver around voltage dropping etc. Some sort of variable potentiometer?

edit: Oh poo poo answered my own question.



http://www.escience.ca/hobby/RENDER/0001/C9/3043/13055.html

Got another one though. I'd imagine something like that knob would adjust how sensitive it is to the sound?
Having it react to volume is easy. Just amplify the signal off a microphone, rectify it and low pass it to get a volume to voltage converter. If you wanted to have the brightness of the leds vary with volume, you could just hook that voltage up to voltage to current converter and drive the leds with that. If you want different leds to turn on at different volumes you could use comparators and set a few thresholds at which the comparators will switch on, and power the leds from there. There a lots of ways to go about doing this.

Reacting to frequency is a great deal harder, because unless the sound is a perfect sine wave, any sound will have many frequencies in it. If you're looking for one or more specific frequencies, you could build a bandpass filter for each frequency then rectify the output as before. But if you want to look at continuous range of frequencies you'd effectively have to build a spectrum analyzer, which is pretty deep stuff.

ANIME AKBAR
Jan 25, 2007

afu~

babyeatingpsychopath posted:

I got an LM317 voltage regulator, and it's totally tits. The datasheet for the thing is 26 pages long, six of which are schematics showing you how to do stuff.

One of the "stuff" things you can do is have digitally selected output voltages using transistor-controlled resistors.

This, I understand.

What I don't understand very well is how this device works. Does it need a resistive load on the adjustment output, or will a differential voltage load work? I'd love to be able to infinitely vary my output voltage using a DAC. I'm not sure if a variable resistor that can be controlled electronically even exists. Does a transistor work this way?

the lm317 is a solid device, though one of the things that bugs me about it is that it will only operate correctly if you load it with at least 10 or so milliamps, so it blows as a low power reference but is good as just a supply.

Linear regulators are pretty simple and they can be built from a few transistors and stuff pretty easily. There tons of tutorials online. You just have to understand how negative feedback works. That's how most analog circuits work.

ANIME AKBAR
Jan 25, 2007

afu~
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.

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

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

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.

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

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.

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

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

Adbot
ADBOT LOVES YOU

ANIME AKBAR
Jan 25, 2007

afu~
A resistor divider should work fine, as long as you account for it's impedance. It should be high enough that it won't load down the sensor, but low enough that the ADC sampling capacitor will charge fully in the sample period. Check the datasheet for the sensor and your adc. You'll likely find that there is a good range of impedance that will work. If the impedance is too much for your adc, you could slow down its sampling time, or buffer the signal with an op amp. If the op amp is good (something with low offset in the microvolt range), the error should be negligible.

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