Showing posts with label engineering. Show all posts
Showing posts with label engineering. Show all posts

Tuesday, January 27, 2009

Zero-th Order Function Generator

I'm trying to debug a circuit that's having either a frequency- or pulse-width dependent glitch. We're using a hall-effect sensor to measure RPM on the Boldsprints equipment and under mysterious and hard-to-reproduce circumstances, the microcontroller that bridges the sensors to the software crashes. Maybe we're exceeding the frequency input of the micro. Perhaps the sensor isn't triggering for long enough. Maybe there's excessive noise on the line. Well, at least the first two conditions are easy enough to rule out or verify by swapping out the sensor input for a function generator. The only problem is - this isn't for work, and I don't own a function generator. So, I took the day to make one.

The ckt:



The scope shot:



It's a straight-forward circuit using two LM555s. I cascade an astable 555 into the trigger of a monostable 555, and sweep the Ra of each to vary frequency and pulse width, respectively. In retrospect, I should have used LMC555s - a CMOS version that has full-swing TTL output... but more on that below the notes. As it is, I can dial the pulse width from 110uS to 12.5mS and sweep the frequency from 12Hz to about 2.5kHz using the two 100k potentiometers. I can generate negative and positive pulses (by exploiting aliasing!). The signal swing is from 0V to 3.7V. The overshoot is minimal.

And because there's nothing sacred in engineering... the notes:




Congrats - you made it to the bonus geek-out portion. Why should I have used an LMC555 over the LM555? Well, it's the difference between CMOS architecture and old-school bipolar processes. Here's the schematic for the National LM555. For the purposes of this discussion, we only care about the output stage - specifically the pull-up transistors Q27 and Q28.



The LM555 is old. In addition to being incredibly cheap, it uses a very old-school bipolar process. Now, a modern bipolar process typically has comparably good P- and N-type transistors, so you'll often see a push-pull output stage that has pretty good output swing. However, Back In The Day, the P-type transistors (PNPs) were really crappy compared to the N-types (NPNs). Specifically, the P-type had really low beta (low gain), and couldn't slew a lot of current. So, a push-pull output wasn't an option for the LM555 designers. Instead, the LM555 has two NPNs (Q27 and Q28) configured as a totem pole to slew a lot of current at the output (which is necessary if you want your square wave to look square). When the LM555 is driving high, Q27 is always on, and the maximum output voltage is one Vbe down from the rail (Vbe is typically 0.6 Volts, give or take) plus the voltage drop across R12. When the load current is high enough so that the voltage drop across R12 (3.9k * Iload) exceeds the Vbe of Q28, then Q28 will turns on, which increases the current drive capability of the output but has the trade-off of limiting the output swing to within 2x Vbe of the top rail. My function generator circuit is driving a 50 Ohm resistive load (which requires a fair amount of current - 3.7 Volts / 50 Ohms = 74 mA), so it's no surprise that the output of my circuit settles at 3.72V instead of 5V.

In the CMOS-based LMC555, the output is driven by a beefy inverter - an inverter being a P-type MOSFET stacked on top of an N-type MOSFET. Once nice thing about FETs is that you can design them to have very low on-resistance (Ron), and the output of such an inverter will be able to swing to within Ron * Iload of either rail. So, in order to improve on the LM555, all the C555 designers had to do was specify the "max" output current load and the output swing to exceed the specs of a bipolar 555, having already sized the output FETs accordingly.

Monday, April 7, 2008

Reverse Engineering

The industrial design of a TV is really interesting.

I got a chance to disassemble and reassemble an HDTV at work the other day (with some reason). It was a fun afternoon. Disassembly time: unclocked; Reassembly time: 38mins. No screws lost, no extra parts leftover.



I wrangled my way into getting a full technician's tool kit when they hired me, but the project only required a hex wrench and a Philips-head screwdriver.



When you take off the back plastic cover, there's an internal metal chassis. Good TVs have substantial internal shielding because of the FCC's electromagnetic interference (EMI) regulations. EMI happens when there is a voltage transition on a wire (ie, power or data). That transition has a corresponding current pulse, which produces a magnetic pulse that radiates outward. Hence, electro-magnetic radiation. EMI worsens when your voltage swings are large and fast. The larger the voltage transition, the more current you need to make it, the larger the magnetic pulse and the greater the EMI. The faster the voltage transition, the more current you need to make it, the larger the magnetic pulse and the greater the EMI.

The source of the EMI inside a TV is typically from the power supply (if it's a switching supply), unshielded internal cabling and poorly-laid out printed circuit boards (PCBs). Things like proper shielding, short cables, current-balanced signaling (low-voltage differential signaling, like that used in HDMI, or differential current mode logic), and proper terminations improve system EMI performance. However, high-volume manufacturers are cheap and won't use a multi-layer PCB with ground planes when a 1-layer board with jumpers will do. So, they ultimately have to make up for the cheap components with the expensive metal chassis a.k.a. Faraday
cage.

Not only do cheap TVs without shielding violate FCC standards, they also tend to have weird artifacts when the EMI from one part of the TV (say, the power supply) couples into another circuit (like the receiver) and introduces noise and offset into the signal path. This TV is build really well, though. The more sensitive high-speed digital circuitry is well-protected.



On the right in the picture way-back is the power supply and the high-voltage circuitry for driving the LCD. That's built on a single-layer board with all through-hole components and pretty huge electrolytic capacitors. That design method's been in play since the 1970s. The receiver board and input circuitry is on the left under a shield that screws to the main chassis - we know that because that's where the HDMI and cable inputs are.



Under the first shield is a second shield with a built-in heat-sink for the main video processor. Please note the secret to high-speed disassembly and reassembly: mark the various screw mountings with flag tape as you remove the screws. This is useful because manufacturers cut every corner possible, so you can't trust the assembly markings. The case (and the board) are over-designed, so the manufacturer will strip the actual number of components down to the bare minimum in order to get better profit margins. Some overseas low-cost, high-volume manufacturers are even known to take a PCB design and start removing components until the design fails -- then they put the last component removed back on. Bam! Instant cost-reduction. For this TV, you can see that all of the cabling is unshielded ribbon cable or unshielded 30AWG stranded cable and they aren't using any ferrite chokes (ie, that lump on your monitor cable that also helps improve EMI). But, like I said earlier, their metal chassis makes up for that, and, hey, the low-profile PCB connectors are nice.



I couldn't remove the heat-sink entirely due to some permanent plastic rivets, but I got it up enough to fully expose the receiver boards. There are two: one for all the digital functionality and another, (only part of it is shown) that handles all of the analog inputs and audio out. The first photo is of the digital inputs with the main processor/scalar. The second photo shows the cable tuner on the digital daughter board (in yet another shielded enclosure). The analog daughter board isn't shown, but it's the darker green board you see connected with the 3 flexible headers.



Then I did what I needed to do inside the TV, put it back together, and it still worked! The. End.

Sunday, September 10, 2006

Grrl Power

I have successfully planned and installed my first floor (in less than a weekend, even). The mission: to upgrade Laura's unfinished office in the Broadway warehouse from bare concrete with traces of carpet adhesive to a vinyl tile floor.

On Saturday, I took stock of 'how to' sites on the Internet, picked up Laura. We went to Home Depot armed only with my engineer's computation pad and determination and a rough estimate of the room's dimensions from Matt's schematics. To the flooring section! We picked out tile (and designed the floor pattern), estimated minimum and necessary placement of 4'x8' sheets for the underlayment, got nails and cartridges for the Remington powder-driven nailgun and other sundries. After checking out, it turns out that our eyes were too big for my Honda Civic, so it was back into the Despot for carpet pad, clothesline and a razor knife (John from Flooring earnestly made sure we had the right trowel and then excitedly showed me his fool-proof trick for cutting edge tiles to size).


Laura and I then strapped the 4'x8' sheets of luon (ideally, you'd use plywood, and this is one of the corners we cut) to the roof of my Civic with the clothesline (with some doubtful and informative comments by a grizzled old contractor). It was secure, but still... I've never been happier to hit traffic than I was when we had to get onto Storrow Drive West to go to Back Bay. A cabbie yelled that we should have used 2x4's to keep the boards flat and a cute blond girl in a fast red car looked at our plywood and our wee little Civic and smiled at us while we were stuck together in traffic. We arrived without incident and unloaded and got to work.

Step 1: cut the underlayment and piece it together. Step 2: fun with powder actuated nailguns! It turns out that power level 3 is not quite enough to put 1" nails into concrete, but hammers can solve this particular problem. Step 3: "stitch" along the underlayment seams with a staple gun. Pound flat. Step 4: mark center lines and dry lay tile. That's where we stopped for Saturday. Sunday morning, we pulled up the tile in quadrants, spread adhesive and then glued the tile down as such:



 Step 5. Iterate. And once we were done, it looked like this:


If you look carefully, you may notice that it's an interwoven checkerboard of vertical gray and vertical white crossed by horizontal tan and horizontal white. If the tiles came with serial numbers, we probably would have had a hard time not laying them in serial order. But, hey. Floor!