Hacks like this are a lot of fun to play with on the bench but don't design a circuit like this when you want something that "just works", has a reasonable life-time and certainly don't put a hack like this into production.
That being said, Sir Clive Sinclair made a pretty remarkable little computer (the ZX-81) but minimizing the parts count to the extreme. And there's a colloquial term for the process of minimizing your component count.
One of my favorite authors in Electronic Design was Bob Pease (now deceased). In a 1992 article [0] he recounts the process used by Earl "Madman" Muntz who was an early television pioneer. I could ruin the story but I'm going to insist you read the original instead. Enjoy!
EDIT: I also should have noted that this practice has led to me trying to create the simplest possible software algorithm that solves my problem. A good day is when the LOC count goes down (and not because I've packed more into a single line).
My favorite cute hack of a power supply is the ringing choke converter (self-oscillating flyback). It doesn't require any controller ICs, just a couple of transistors, resistors, caps, and a transformer. You get isolation, and the circuit is quite simple. With an optoisolator and zener diode you can even get regulated output!
The disadvantages are the poor efficiency, need for tuning, and need for a transformer if you don't need the isolation. Also no programming involved, so not really of as much interest to most of the HN community.
If you buy a $2 phone charger, this circuit (the ringing choke converter) is what you get. It's kind of amazing how cheaply these are made. It can look just like an Apple charger on the outside, but the power quality (and safety) is much, much worse.
Yep, they're used in lots of cheap power supplies, not just phone chargers.
The poor power quality and safety aren't inherent problems of the ringing choke design, those are just issues with cheap chargers. They tend to omit the output filtering and do horrible things to creepage and clearance distances.
That was the first circuit I put together after cobbling together some old TV parts in 8th grade. The noise and dazzling purple glow of the high voltage arc from the flyback transformer were mesmerizing.
The urge to understand how it worked led me to study EE in college.
Great story, I hadn't read that one before. Madman Muntz is a hero[1] of a person, love that guy, also inventing the term "teevee" (later "TV") and manufacturing and selling the Muntz Jet automobile[2]. Oh, he also invented car stereos (and bars, but watch #1).
I've had great success building digital logic with minimized part counts. When I've tried to do the same with analog circuits, I've had more mixed success. I realized that it's because digital logic is transitive (in the algebra sense) but analog is only quasitransitive. That is (assuming you're working in the realm of bits rather than abusing physical limits), in digital logic if circuit A is equivalent to circuit B and circuit B is equivalent to circuit C, you can replace A with C, and keep repeating this process until the circuit is minified. In analog electronics, you run into the sorites paradox.
> Hacks like this are a lot of fun to play with on the bench but don't design a circuit like this when you want something that "just works", has a reasonable life-time and certainly don't put a hack like this into production.
Dunno, do you think a constant rate PWM SMPS isn't enough to power a trivial load like LED and justifies the cost of adding a dedicated chip? LED forward voltage is well below absolute maximum for the RESET pin, peak current is limited by pulse time, looks good enough to my (amateur) eye.
I didn't mean that you shouldn't use a boost converter - back in the RS-232 days the Maxim max232 chip saved a tremendous number of parts (otherwise you needed a +/-12VDC power supply to drive the signal wires. The idea of the IC's Vcc following the coil's transient is a bit scary and I wouldn't design that into a system.
I thought about using RESET of course. The Vcc thing is indeed bizarre and I wouldn't be confident that running logic circuits on a fast dV/dt power supply is a good idea.
RSTDISABLE means that no in-circuit programming is possible any more and for re-flashing a parallel HV programmer is required; it's quite annoying for tinkering.
If the objective is to use the least number of parts, then there's a simple solution: brute force.
You can of course automate this using a simple computer program and a simulator like SPICE. Slightly more intelligent solutions could use heuristic optimization techniques like genetic programming.
See the data sheet for the part.[1] Basically, you want to feed power into the inductor briefly, then turn off power and somehow connect the inductor to the LED. The trick is to find some way to get the microcontroller to connect two of its own pins together, so you can use it as a switch on the output. This is probably done by abusing one of the alternate uses of the six "B" pins. See table 10-3. I'm thinking that port B, bit 5, DW mode might be abusable in this way.
This exact solution is described at the end of the post except that they call it RESET pin rather than DW pin. And of course they short it directly to GND by driving low, you can't just short two GPIOs together.
That was my first thought too, but he explains that in the last paragraph:
> I am also obsessed with eliminating hardware with clever software wherever possible. Hardware is mater and is therefore you have to manufacture, move, and dispose of each and every hardware part used. None of these these problems apply to software
I'm a big fan of joule thiefs. Small solar panel, a supercap and a joule thief and you can trickle charge NiNM batteries for years+. That's how I keep my hand-radios fully charged when not in use.
I don't think that you necessarily do. The protection diode just dumps voltage into the Vcc line of the microcontroller, which if you're clever may not necessarily be an issue.
Specified a few missing values, but there you go -- the LED lights (see the simulation current plot)! As long as the microcontroller doesn't reset from every VCC dip...
This is none other than Josh Levine, the hacker programmer who invented all modern electronic trading infrastructure (ISLAND / ITCH) and a personal hero of mine.
He's now probably rich enough to just play with microcontrollers and have fun all the time. Living the dream.
I enjoyed the part where it rounds an order quantity to a multiple of 100 by using string operations. A comment there explains it's to avoid floating point ops. Ah the good old days.
Does anyone have recommendation on a simple self contained primer to understand electronic circuits as shown in this article. Article is very interesting but am hampered by lack on ability to understand the circuit diagram.
I don't know if this is the answer you expect, but Radio Shack made a "200-in-1 electronic project lab" toy/kit that came with a book that has a really really good explanation on all of analog electronics. And you can try all the examples yourself. It is very fun.
An alternative is, read about the following:
1. Ohm's law -- the relationship between voltage, current, and resistance. And power.
2. Learn how to sum resistors in parallel vs resistors in series.
3. Learn about capacitors, how do they charge? (the RC constant). What happens afterwards?
4. Now learn about RC circuits (resistor+capacitor), which means you will learn about filters: low pass, high pass, at the very least. Know how to calculate the 'cutoff' frequency.
5. Learn about how a transistor works. First, how it can be made to work as a switch. Then, how it can be made to work as an amplifier.
6. Learn about the inductor (the "L" in L,R,C). Learn the relationship between inductors, capacitors and resistors.
7. Since now you know about inductors, you can also see Oscillator circuits using transistors.
ALTERNATIVELY
on step 5, instead of learning about transistors, learn about opamps. It is easier to understand than transistors!
Then learn about how to implement oscillators with opamps, filters with opamps.
Afterwards you may perhaps want to learn about digital circuits. If you understand boolean algebra or bit logic functions (and, or, xor, not), then this will be a piece of cake.
Thank you for the detailed steps. Based on your list I purchased "Teach yourself electricity and electronics" which has content similar to the order you have listed. Hopefully ramping up on the basics will enable understanding of circuit diagrams
Might want to add in a 4.5, learn about the diode.
And I also recommend learning about opamps instead of transistor amplifiers, easier and more practical. However the transistor as switch is still very useful to understand.
I'm trying to write an online electronics book, so your comment hits home for me! I'd like it to be "self contained," but that still assumes a moderate dose of prerequisite math and physics topics. Furthermore, "simple" it is not.
Could you take a quick look at the simulation I attached elsewhere in this discussion? Let me know if that simulation and the notes around it are helpful for your understanding.
Thank you for pointing to excellent resource like circuit labs.I was able to get a better understanding after running the simulation. Looking forward to your book
What I'd LOVE to see is a series/book called: "15 ways to make an LED blink" which explains all the ways you could accomplish this task. By this you should learn a lot about electronics.
You might want to just learn the physics of these things.
When you have any solid object, it's got a crystalline latice structure at the molecular level. Do you remember valence shell electrons from chemistry? They're the outermost shell. They are only tenuously connected to their atom and so it's easy to push them around, but the atom wants to be electrically neutral (#electrons = #protons)
In a conductor, let's say copper, you can shove on one end of the crystal with an electric field and induce a movement on those valence shell electrons that propagates your shove across the lattice. You could measure how much energy each electron gets from its shove, we'll call this Voltage. The rate of electric field moving through a particular surface area is called Current. In a perfect conductor, the voltage of the wave moving across the surface doesn't drop off. We can think of wires as being pretty good conductors, and in diagrams they exist as platonic perfect conductors. Also note that the amount of current in one end of the wire has to equal the current out or you would be losing or gaining a net electric charge.
So now you know the rules for a straight line in a diagram. The rest is learning how electric fields behave in other kinda of bulk materials. In the resistor, the voltage change across the entire resistor is proportional (linearly) to the flow of current through the resistor.
In a capacitor, we place two wide metal plates across from each other by a small distance. This doesn't form a complete connector - charges can't cross - but initially current flows in to charge the plates, then dies off as the voltage difference between the two opposing plates equalizes with the voltage applied to the capacitor. So these devices hold a charged electric field, and they allow high frequency changes in voltage to pass through, but low frequency is blocked by the charge saturation.
Inductors are similar to capacitors, but the energy is stored in a magnetic field. If you wind some wire into a coil, the magetic field from the wire acts as a sort of flywheel. These devices allow low frequencies to pass through.
Diodes are made out of crystalline solids called semiconductors, where a pure ingot of silicon (an insulator) is doped with a donor like Boron or Arsenic. Depending on whether the donor has fewer or more valence electrons than silicon, we get either a p type or an n type material. If we put a p type next to an n type, there's a thin band near the junction where the opposite types "cancel out" and no charge can pass. But if we apply a small voltage across the ends of the diode, the cancel out region shrinks thinner and thinner until eventually charge does pass through. So these are sort of like a one-way valve for circuits, and you need about 0.7V in the forward direction to get them going.
Thank you for the excellent summary. Based on your input and u/flavio81 response I have purchased a book on basic of electricity and that will hopefully enable me to understand and interpret circuit diagrams
I think this might be another solution, using the capacitance of the diode to make a resonator and then driving near resonance. Here V(n001) is some pin voltage and V(n002) is the voltage across the diode: http://imgur.com/a/xwZF4
That being said, Sir Clive Sinclair made a pretty remarkable little computer (the ZX-81) but minimizing the parts count to the extreme. And there's a colloquial term for the process of minimizing your component count.
One of my favorite authors in Electronic Design was Bob Pease (now deceased). In a 1992 article [0] he recounts the process used by Earl "Madman" Muntz who was an early television pioneer. I could ruin the story but I'm going to insist you read the original instead. Enjoy!
[0] http://www.electronicdesign.com/boards/whats-all-muntzing-st...
EDIT: I also should have noted that this practice has led to me trying to create the simplest possible software algorithm that solves my problem. A good day is when the LOC count goes down (and not because I've packed more into a single line).