
Reverse engineering a counterfeit 7805 voltage regulator - carloscm
http://www.righto.com/2014/09/reverse-engineering-counterfeit-7805.html
======
dewitt
Super informative post. Thanks for sharing.

One thing I didn't understand was the author's comment that "I bought the part
off eBay, not from a reputable supplier, so it could have come from anywhere."

A 5-pack of quality 7805's can be found on Amazon for $5, including Prime
shipping, (e.g. [http://amzn.com/B00H7KTRO6](http://amzn.com/B00H7KTRO6)), so
what's the incentive to buy parts of unknown provenance on eBay or the like?

I ask not being a hardware guy myself, so genuinely curious, as I've heard
stories like this before.

Again, fantastic overview of the chip, though. I learned a lot.

[Edit: spelling]

~~~
kens
Thanks for the comments. I bought the parts off eBay for several reasons.
First, I wanted the less common metal TO-3 package so I could open the chip
with a hacksaw rather than nitric acid. Second, eBay parts are amazingly
cheap: you can get 10 7805s for $1.33 from Hong Kong, shipping included. (Does
anyone know how they can ship something that cheap?) Finally, since I'm
cutting the chip open, I'm not exactly looking for quality :-)

~~~
diogenescynic
Most Chinese sellers use a service called Epacket to send small items to the
US. Epacket is a trilateral agreement between USPS, eBay and China Post that
allows Chinese sellers to send items to the US in bulk at a low rate. Even
without Epacket, Chinese postage is a lot lower than in the US.

~~~
Scoundreller
I think there's more to it than that since the shipping is usually free
worldwide, not just the US. I think most countries in the world have an
agreement through the International Postal Union to pay by total weight for
international packages, and the rate is low. In China/HK and some other
places, they pass that low cost to the consumer, unlike the US.

------
quarterwave
This is a beautiful post, and I am reluctant to try and say anything profound.
Still, all of HN's a stage so I'll attempt a brief explanation for the general
reader about why we need voltage regulators.

A logic chip like a microprocessor is designed for a particular supply
voltage, if this voltage drops too much the logic circuitry will switch
falsely. Say we had only a capacitor and we tried to power the logic chip with
it. As the chip draws current the capacitor discharges - this is because
current is movement of charge, so the charge (and energy) can come only by
draining the capacitor. For an ideal capacitor the voltage is directly
proportional to the charge across it, so as the charge drains the voltage
falls. To hold the voltage constant we need to keep 'topping up' the capacitor
with charge. This is what a voltage regulator does - it uses a negative
feedback loop to sense the capacitor voltage and when that voltage falls the
circuit provides just the right amount of charge 'juice' for the top-up.

As we take the foot off the clutch pedal in a car, the load gets engaged to
the engine and if we sense a stall we press the gas pedal a bit. That's the
imagery of a voltage regulator in action.

The capacitor plays a key role because the regulator feedback loop isn't very
fast - one trouble with fast feedback circuits is chatter, or responding to
every blip. Negative feedback circuits are designed to be more like ship
wheels - they like to steer sedately and not respond to every excited cry from
the mast. But what happens if a current blip arises because a logic circuit
block turns on all at once (in response to some block of code)? That local
current blip is provided by the capacitor, it acts like an ATM to provide
local draws - but it still depends on the regulator to top it up.

In fact you can think of a battery as a capacitor that tops itself up via
electrochemistry, it works as long as there are ions in the electrolyte. If
instead of 'bandgap energy' we used the chemist's terminology of
'electrochemical potential difference', then the system similarity becomes
evident.

------
MarcScott
Prior to reading this the only thing I knew with certainty about a 7805 was
never to use it to pick up your PCB. They get a little toasty when shorted,
and I've burned myself on them more often than on my soldering iron.

~~~
YZF
Ha. Right, as the article says with linear regulators unlike switching
regulators all the extra energy ~(Vin-Vout)*I goes out as heat... They're so
easy to use though. It's interesting someone would counterfeit them, so cheap
and probably not as popular as they used to be back in the day...

~~~
Alupis
It's an interesting notion to "counterfeit" a chip... I mean, the supposed
counterfeit still has to perform the same duties as the "legit" chip does...
maybe of less quality, stability or longevity... but nonetheless, it does the
same job. It's like saying Hyundai is counterfeit cars because their quality
is less than Honda or something.

~~~
jpindar
Not at all. There are plenty of counterfeits that are not functional - some
don't even have a die in them.

Also, these parts have a brand logo on them, but are not made by that
manufacturer. If Hyundai sold cars with the word Honda and a Honda logo on
them, without permission from Honda, they would indeed be counterfeits.

------
data-cat
Very interesting. I really liked the interactive chip guide.

~~~
kens
Thanks. The interactive guide turned out to be a bigger project than I
planned, but I hope to reuse it for the 741 op amp. To generate the data for
the guide, I ended up drawing boxes around all the components in Open Office,
and then parsing the XML to extract the regions for each component and
generate the JavaScript data.

The non-rectangular resistors were inconvenient to represent. Also, the 7805
has a lot of overlapping transistors (e.g. sharing the collector), which
messed up my original system that assumed everything inside a box belonged to
the box, so I ended up tagging each component with a different color. Maybe
this is more than you wanted to know about the system :-)

~~~
hausen
You could use Inkscape for that -- it generates an SVG file that can be
manipulated with javascript by adding a <script> tag. For an example, see:
[http://hausen.github.io/control.svg](http://hausen.github.io/control.svg) and
[http://hausen.github.io/control.js](http://hausen.github.io/control.js) . No
need to postprocess anything!

------
joshu
Ken, If you're gonna write stuff like this, I'm gonna continue to offer to
fund your eBay spelunking expeditions.

------
bluedino
I know almost nothing about electronics - why don't the thin wires going to
the die melt like a fuse, are they just made out of the right material?

~~~
kwantam
Until recently, almost all bond wires were made of gold. This is because low
temperature ultrasonic welding can be done reliably between gold and aluminum,
and because gold and aluminum are ductile enough that they act as a cushion
during the welding process to prevent oxide cracking. (In CMOS, until the
0.18u node or so---1998ish---IC interconnect was aluminum; on more modern
processes, interconnect is copper, but generally for wire bonded chips there
is a plating layer added to the copper bond pads to enhance bonding
reliability.)

Bond wire diameters are (for historical reasons) usually specified in mils. A
common bond wire diameter is 1 mil, which, depending on length, can reliably
handle a bit more than an ampere without fusing. (Shorter lengths and lower
temperatures help this.) Note that this number is quite conservative, since
this is the fusing current at 125 degrees Celcius, and there is a quasi-
exponential dependence on temperature.

(Also note that multiple bond wires can be used in parallel to increase the
fusing current; in one image from the linked article [1] it appears that there
are two bond wires in parallel, but kens points out below that this is a
force-sense arrangement and not a double bond.)

As a result, when running a chip at room temperature, very high currents will
almost always blow up the circuit rather than the bond wire. In over ten years
I've only once managed to melt bond wires without also causing the chip to
crater, and that was on a power converter with gigantic transistors (like,
"see them with the naked eye" big) that was designed to be quadruple bonded
and was only double bonded in an engineering sample.

More recently, copper bonding has become increasingly common. This is driven
by higher conductivity of copper (and thus lower bond wire resistance and
higher fusing current) and substantially lower cost compared to gold. However,
copper bonding requires special care. For example, the bond pad structure must
be built to withstand much more bonding force without cracking.

For a technology as old as the one being used to build this 7805---a mid-80s
bipolar or BiCMOS fab, 1 or 2 layers of aluminum interconnect---it would
probably take substantial effort to redesign the bond system for copper bonds
(and there may not be enough metal layers to provide cushioning, so it might
just be impossible to reliably bond with copper). Beyond that, there are only
four bond wires (see the aforementioned image), so the cost is minimal (and at
most bonding houses, packages come with a number of "free" bonds built into
the price of the package). In addition, redesigning the chip would involve
substantial engineering effort (redesign the layout, redesign the package,
redo all the reliability qualifications), the cost of which would probably not
be recuperated via the price difference between copper and gold.

[1]
[https://plus.google.com/photos/+KenShirriff/albums/605050806...](https://plus.google.com/photos/+KenShirriff/albums/6050508063770810849/6050521739326879154?pid=6050521739326879154&oid=106338564628446721517)

EDIT: kens, good catch on the Kelvin connection. Now that I look at the die
photo again, it's clear the left one is for sensing.

~~~
kens
There's an interesting reason for the parallel bond wires to the output pin,
and it's not to keep it from fusing. The problem is if you put 1A through a
thin bond wire, there will be some voltage drop across the wire. So if the
chip produces 5V at the die, it might be 4.9V at the 7805's pin, which is no
good. So they run a second bond wire from the output pin to the regulator
circuit. This sense wire has hardly any current through it, so it gives an
accurate value of the output voltage. Thus, the 7805 can regulate the voltage
on the output pin, rather than the voltage at the die pad.

TL;DR: one bond wire to the output carries the current and the second bond
wire on the output senses the voltage.

------
typhonic
I am compelled to echo the the first statements by quarterwave and kjs3. I was
personally saved from a morning of mindlessness, and I will be soon opening up
an IC or two to see for myself. You said I could do it. Thanks kens.

------
raverbashing
Well, the 7805 is sold by multiple vendors, so, it may be a counterfeit, or
just a subcontracted part?

Very, very nice explanation of the 7805 though. This is the bread and butter
of linear regulators.

~~~
janekm
Even if it was subcontracted it would have to match the diagram in ST's
datasheet.

~~~
userbinator
Not necessarily; the schematics of ICs in datasheets often can and do
significantly differ from what's on the silicon, as to the user the important
part is how the part performs in circuit, not its internal structure. (I
suppose this is quite a non-leaky abstraction.)

ST's datasheet also has this standard disclaimer, so it's also perfectly
acceptable for them to change it from a legal perspective:

 _STMicroelectronics NV and its subsidiaries (“ST”) reserve the right to make
changes, corrections, modifications or improvements, to this document, and the
products and services described herein at any time, without notice._

------
baq
it continues to amaze me how such a little thing can generate so much heat
while doing useful work and operating normally.

------
kjs3
This is with all seriousness the most informative thing I read this week. Took
me right back to my abortive flirtation with EE as an undergrad. If thing had
been explained this clearly, I might have stuck with it.

~~~
PhantomGremlin
This article exhibits the sort of passion that someone needs in order to
become "really good" at something.

Maybe 90% or even 99% of designers would only be interested in taking a
regulator, connecting input, output and ground, and perhaps some adding bypass
caps, and stopping right there. Good enough to make it work in most
situations.

But that final 1% are the really good engineers. They want to truly understand
or _grok_ what all the components of the circuit are doing. That's what lets
them achieve so much more than the typical engineer.

From what I've seen (but I haven't really studied his designs in detail) Steve
Wozniak was (is?) the epitome of a great design engineer. His designs were
magical for their time. The article also mentions Bob Widlar, who was also
truly one of the greats.

~~~
kjs3
Well put. I think you're about 95% right about Woz. The difference is that
looking something Widlar or Pease did, I go "holy shit, that's genius! I would
never have thought of that!". Some of Woz stuff (I'm looking at you, Apple II
disk controller) are just "that's demented. I wouldn't have wanted to think
that up. Genius, but demented".

~~~
CamperBob2
You can't thoroughly appreciate Woz's disk controller until you compare it to
the abortion that was the C64's floppy disk system, nor his display circuitry
until you compare it to the atrocity that was the IBM CGA adapter. That's when
you realize that he wasn't a once-in-100 years fluke of engineering genetics,
but the once-in-500 years kind.

~~~
madengr
The abysmal performance of the C64 floppy disk was due to a bug, but
management went ahead and decided to ship it anyway. It was supposed to be 10x
faster, thus the 3rd party ROM replacements.

~~~
CamperBob2
The funny thing was, the same was true of Apple's DOS. With all the
engineering talent including Woz's own, it never occurred to anyone there that
they should have read the sectors in each track in descending rather than
ascending order to save wasted disk rotations.

