Thursday, October 25, 2012

TVS Diode Current Voltage Characteristics

A circuit I'm designing requires electrostatic discharge (ESD) protection on the I/O lines of a microcontroller, and the solution that keeps popping up in my research is to use a transient voltage suppression (TVS) diode.  Although their operation is easy enough to understand, and I've had experience with similar devices like zener diodes, I still wanted to get a feel for how they worked.  Sometimes you can be sure you know how something works but it doesn't become concrete until you see it on a scope screen.

TVS diodes are basically avalanche diodes designed to conduct large peak currents for a short amount of time.  When forward biased, the device will start conducting at about 0.7 V, just like a standard diode, but when reversed biased the diode won't conduct significantly until the breakdown voltage is reached.  The breakdown voltage is however adjustable in manufacturing from a couple of volts to hundred of volts.  By placing a reversed biased TVS diode between ground and a point in a circuit, you can very quickly clamp the voltage across the device to a safe level.

What if you wanted to protect a signal line that carried an AC waveform?  Depending on the orientation of the diode, the clamping action would work for either positive or negative signals, but not both.  When the polarity of the signal reverses it would clamp the waveform to the 0.7V forward voltage of the diode and possibly interrupt the signal.  To overcome this you can use two diodes back to back.  The clamping voltage for either direction will be equal to the clamping voltage of one diode plus the forward voltage of the other.  You can get this configuration in a single package called a bidirectional TVS diode, although manufactured, differently the principle is the same.  It's this kind of diode that I happened to have laying around.

To improve my skills I've been practising soldering surface mount components on an old dial up modem (what else are they good for) and noticed that near the power input is what looked like a TVS diode.

PCB from a dial up modem
Modem with TVS diode near the power input jack

You'll have to forgive my camera work.  The photos were taken in low light while holding a jewellers loupe over the camera lens.  They didn't come out too bad for a first go.

TVS Diode on a PCB
TVS Diode

The part designation on the silk screen was GAP3 which may indicate that originally some type of spark gap was to go here.  Who knows.

TVS Diode on a PCB
TVS Diode

After removal, I was able to identify it as a P6KE27C diode.  The data sheet shows it is a bidirectional TVS diode with a breakdown voltage of 27V and a clamping voltage of 37.5V.  This means that conduction will start at 27V, and at peak current the voltage across the diode will be 37.5V.  To verify these characteristics I put together a basic circuit to plot the current voltage curve of the device.

TVS Diode test circuit schematic
Test circuit

By probing the V1 and V2 points on a oscilloscope set to XY mode, and then sweeping the floating voltage V, you can obtain a crude IV curve for the device.  The current through the TVS is equal to -V2/120.  Although I'll be able to check the breakdown voltage using this method, I can't test the clamping voltage because those conditions are only valid for short durations, if I were to apply the maximum current at the clamping voltage continuously, the device would be destroyed.

Current Voltage Curve on an oscilloscope
TVS current voltage curve

The plot came out as expected, the current is shown inverted on the vertical axis, with a scaling of 100mV/120 or 830 uA per division.  The breakdown voltage is obvious on the plot at approximately 27V and agrees with data sheet.  The bidirectional nature of the device is also evident from the symmetry of the plot.

I now feel more comfortable using these devices in a design.  ESD protection is still a bit of a mystery but I'm slowly piecing things together from what I've found online.

Sunday, October 14, 2012

Current Limiting the I2C Bus

The latest project I've been working on requires a remote temperature sensor that's reasonably accurate while operating in harsh environments where short circuits are possible.  After looking at the options available I decided to use the MCP9808 digital temperature sensor from Microchip.  It has a maximum error of plus minus 0.5 degrees Celsius over the range I am interested in, it's not too expensive, and it's digital interface means I haven't got to use an ADC.  On the down side, the i2C bus isn't really designed for board to board connection and is prone to lock-up.  However, with a few precautions I believe I can overcome these issues.

To prevent the bus locking up the main micro-controller, I'm using a smaller micro as a transceiver.  If the bus locks up due to a short circuit or any other reason the main micro can still operate and cut power to the damaged transceiver channel.  Even with this precaution it's still necessary to limit the short circuit current between the exposed i2c lines to prevent damage to the transceiver.

The simplest and most cost effective way to do this is to place a 100 ohm resistor on any exposed active lines.  With a 3.3V supply, a short on any of these lines will be limited to a current of 33 mA, which is within spec of the transceiver micro.  A short between two of the active lines will be limited to 16.5 mA.

The 100 ohm resistor on Vcc will cause the supply voltage of the sensor to slightly sag, but the current drawn by the sensor is so small that it doesn't really matter.  Just to be sure I've prototyped the design on a breadboard and it works as expected.

To further protect the i2c bus, I intend to put diodes on the SDA and SCL line to clamp ESD spikes. For what I'm using it for these measures should adequately protect the bus.

Current Limited i2c Bus
Current limited i2c bus interface

Wednesday, October 3, 2012

Standing Desk Experimentation

I've noticed lately that standing desks seem to be popping up everywhere I look.  I first spotted them in the background of the Tested.com "Makerbot Mystery Build" videos, then I saw a couple of articles on twitter discussing the pros and cons of sitting vs standing.  The idea was quite appealing as my current set-up is uncomfortable and not really working for me, so I thought why not have a go myself?

Standing Desk Prototype
Standing desk add-on

I didn't know if I'd be able to adapt to standing at a computer, so I didn't want to dive in head first and get rid of my current desk, all I wanted to do was build an ad-on that elevates my laptop to a height suitable for standing.  I had some plywood offcuts laying around that were perfect for the job.  A few cuts and a couple of screws later and I was up and running.

Standing Desk Prototype
Add-on resting on the original desk

The first feature that was vital was some way to keep the rig slipping off the back off the desk if I leaned on it.  The offcuts already had some cut outs that would do the job, so I based my design around these pieces.  They simply hang over the edge of the desk and prevent the rig moving.

Standing Desk Prototype
Back piece to brace unit

One of the pieces of ply I had was just the right size to use as a back brace.  This stiffens the unit up and makes it more stable.  This piece also doubles as a lip for the top shelf.

Standing Desk Prototype
Keyboard and mouse platform

Having my laptop at eye height is all well and good but it makes typing a little tricky.  To get around that problem I put a shelf in a bit lower to put my keyboard, mouse and other USB devices on.

Standing Desk Prototype
Work platform and laptop platform

You can also see that the laptop platform has a small lip at the back to prevent anything from slipping off the top shelf.  You really don't want your laptop falling off the back and dropping 5 feet.

Standing Desk Prototype
Cable retention system

To make managing the peripheral cables a little easier, I cut some holes and slots in the ply.  They allow me to feed the cables up though the large holes and move them along the slots to the edge.  Once the laptop is in position, the cables can't move back towards the centre and fall through the hole.

Standing Desk Prototype
Microwave door cooler stand

 To make sure the airflow to my laptop is unobstructed I use my microwave door cooler stand.  This also helps to keep the cables in place.

Standing Desk Prototype
Space under add-on

If I need the space there is plenty of room underneath the stand for temporary storage.

Standing Desk Prototype
Illuminated work platform

At night a small usb powered light comes in handy to see what your doing.

Standing Desk Prototype
Working at night

The light from the work area isn't distracting and doesn't interfere with laptop screen.

Standing Desk Prototype
Standing desk in operation

The conclusion

It took a while to get accustomed to standing at a desk, but I think it was worth it.  I can't be sure but I think that my posture has improved, and less strain is put on my back.  As this was thrown together quickly from things I had laying around the place, it's not how I would do it if I were to design and build it from scratch.  First of all, both platforms are probably about 10 cm too low, this isn't a major problem but it's something that needs to be tweaked.  The other problem being the width, it's just too narrow.  Once again easy to fix.

The other main problem that I've had to overcome, is trying to convince people this isn't the final stage of my decent into madness.  Nearly everyone I've told thinks that I'm out of my mind, but I figure it's worth a shot.  My back has to last long time, and I don't mind looking a little strange if there's a long term benefit.  After all, if you're considering this, you're probably a little quirky to start with.

Although I've become accustomed to standing, it's still nice to sit down occasionally, and with this set-up I just can't do it.  I think maybe a raised chair set at the right height would work well.  That way I could switch between standing and sitting.  Ideally what I want is a bench about 1.1 meters high instead of a desk.  This would be used for the mouse, keyboard, and other office tasks.  A small shelf about 40 cm above this would be used for the laptop and any other monitors.  A set up like this would allow me to do any task sitting or standing.  For now however this will have to do as I don't have the room or time to build a better desk.  I think the next step for this arrangement is to get an anti-fatigue mat, just to make standing for longer periods a little more comfortable.