Tuesday, December 31, 2013

A simple inverter for driving neons/nixies using Radio Shack parts

I was visiting a friend of mine a few weeks to who was helping me repair the Model H horn on my old Atwater Kent 20C receiver.  This radio and horn lives in my office at work and one day, I heard a thud as the horn portion spontaneously broke off from the base and landed on the carpeted floor.  Inspection showed that the original cast aluminum part had a lot of voids and impurities and it finally broke - after nearly 90 years!  To fix it, we drilled out the aluminum and I fitted a steel sleeve that he'd machined and used metal epoxy to secure it - a very strong and (pretty much) invisible fix!

But I digress...

After the repair we wandered into his ham shack to talk for a while.  He is a collector of old, unbuilt kits and has a soft spot for the Radio Shack "P-Box" kits from the late 60's and early 70's.  For a list of those kits - along with much of the documentation, look here:

http://my.core.com/~sparktron/pbox.html

In particular he was interested in replicating the "Goofy Light" kit - see item 28-130 on the above link.

This kit is pretty simple:  A one-transistor oscillator along with a transformer produces 100-ish volts that power a series of neon lights.  Depending on how they are wired, they will produce a "chase" sequence or just blink randomly.

To replicate this identically would have required getting two parts that would likely be difficult to find:  A 2SB54 PNP germanium transistor and 1k-200k audio transformer.  Being practical, there was really no need to use a PNP germanium transistor in this:  A 2N3904 or similar NPN silicon would be just fine - but the audio transformer was another matter!

The actual impedance of the transformer wasn't as important as the turns ratio - and for the 1k : 200k transformer that would be the square root of the impedance ratios, as in:

sqrt(200/1) - 14.142 : 1 turns ratio.

Being that the turns ratio is one of the factors that determines the voltage transformation, it was fairly important that we find something that was sort of close.

If the waveform had been sinusoidal, a (theoretical) 6 volt input would produce about 85 volts of AC on the output.  Fortunately (!) for us, it's not quite that simple.  While the transistor/circuit losses would likely reduce the drive level to 2-3 volts or so, the waveform was likely to be anything but sinusoidal - more likely, it would be rather "spikey" as the transistor snapped on - then off again and it would be this "ugly" waveform that would likely have spikes and ringing that would produce voltages far in excess of that determined by just the turns ratio!

In searching the online Mouser-Key catalogs we found a number of possible candidates for substitution, including the Mouser 42TM-114RC which was a 20 ohm to 4.6k (15.2 : 1 ratio)  transformer with center taps on both the primary and secondary and it was readily available for just $2.74.  While this transformer would probably work just fine (the absolute impedance isn't terribly important in this application) he was interested in what might be on-hand locally.

At some point he'd been to Radio Shack and picked up a couple of their 273-1380 8 ohm to 1k (center-tapped) audio transformers and we decided to see if we could make that work.

The obvious difference - aside from the absolute impedance values and the lower turns ratio (this transformer had an 11.1 : 1 ratio) was that it did not have a tapped "primary" - and it was this tap that had provided the feedback path in the original P-Box circuit.  It did have a tapped secondary and I wondered if I could make that work so I threw together the following circuit using flying leads on the workbench.

A word of warning:
  • The voltages that can be generated by this circuit could potentially be lethal, so be very careful.  (You are unlikely to get more than a "tickle" or a slight bite, but be aware!)
  • It is possible that you'll blow up a transistor or two if you experiment with parts values and output loading.  You may also ruin a transformer, so pay attention to anything that is getting hot!

For this first version, I'd omitted Cfilt and Ca, using a 10k resistor for Ra and a 2N3904 for Q1.

Figure 1.
A simple circuit using a transformer and transistor to produce fairly high voltages.
The noted colors are for the Radio Shack 273-1380 transformer and indicate phasing:  If the phasing is
incorrect, the circuit may not oscillate!
(V+ is connected at the junction of the Red and Blue wires.)


Amazingly, it worked the first time, lighting the NE-2 type lamp attached to it - this, with a power supply of just 7 volts.  While the circuit worked, the current consumption was a bit higher than we would have liked - around 50-60mA at 7 volts - not terribly efficient, but then again, it was not at all bad for such a simple circuit on the first try!

Changing R1 to 47k, the circuit still worked fine and pulled only about 15-20 mA and the output voltage was a bit lower - still able to (just barely) light the neon at 7 volts, but brightly illuminating it at 12 volts.


After I got home from his place I decided to experiment with the circuit a bit more and in so-doing I put the 'scope on the output lead using the version without any capacitors and Ra = 10k and with the power supply at 6 volts, getting the waveform below:

Figure 2:
An example of the waveform being output from the transformer.

As you can see, the waveform is very "spiky" (to be expected) with the peak part being mostly at a negative voltage (e.g. below zero, the dashed line in the middle.)  With just a 6 volt DC supply the total waveform was about 226 volts peak-to-peak (more or less) with the oscillation frequency being about 2 kHz and the current consumption being about 50mA.

For the heck of it I decided to reconfigure the circuit as follows:

Figure 3:
 A reworked version of the same circuit as in Figure 1.  It produces a waveform that is essentially
an upside-down version of that in Figure 2, but at lower voltage since we have but half of the
secondary winding to produce an output voltage.
(V+ is connected at the Red/Green wire connection)


The result of this was a circuit that produced a lower peak-to-peak voltage than that in Figure 2 because only half of the secondary was referenced to ground via the center-tap and the power supply.  The waveform also looked similar to the one in Figure 2,  but upside-down - that is, the spike was positive-going.  It also drew a bit less current - around 35 mA.  (Cfilt and Ca were omitted and Ra was still 10k).

More experimentation with the circuit in Figure 1:

Because I was interested in the higher voltage I rewired the circuit back to the configuration in Figure 1 and did more testing, this time adding the following circuit to the output:

Figure 4:

This simple circuit converter that will handily convert the negative-going  portion of the waveform to positive and then add it to the positive-going part, which meant that with the circuit in Figure 1 operating from 6 volts you could get an unloaded voltage of over 200 volts DC.

For this testing I added Ca, using a 0.1uF capacitor and when I did this the quiescent current of the circuit dropped from 50-60mA to around 15-20mA when operating from 6 volts.  The output waveform looked about the same as that in Figure 2 but the oscillation frequency was now closer to 1 kHz.  When using the circuit in Figure 4 the voltage was slightly lower - but this was probably due to the high voltage spike occurring less often and keeping the capacitor (C2) charged in spite of the 10 Megohm load of the voltmeter.

For this circuit, C1 and C2 should be at least 0.1uF and rated for 250 volts or more while D1 and D2 should be high voltage diodes such as the 1N4004 or 1N4007 - or, better yet, a high-speed, high-voltage switching diode such as the RGP15G.

The actual values of C1/C2 depend on your load and how much ripple you can tolerate.  At 1-2 kHz, C1/C2 = 0.1uF will produce a fairly clean supply if you are only pulling a few hundred microamps.  For testing I used 0.22 uF for C1 and 0.47 uF for C2.  If you want a "cleaner" supply (i.e. less ripple) than the value of C2 can be increased further.

I decided to do a bit more testing with this circuit at different loads and supply voltages and came up with the following results, measuring the voltage across C2.  (Ra = 10k, Ca = 0.1uF):

6 Volts:
14k load - 52 volts output (3.7mA, approx. 190 mW)
100k load - 102 Volts output (1.02 mA, approx. 104 mW)
10 Meg load - 220 Volts output (22uA, approx. 5 mW)

10 Volts:
14k load - 63 Volts output (4.5mA, approx. 283 mW)
100k load - 155 Volts output (1.55 mA, approx. 240 mW)
10 Meg load - 325 Volts output (32.5 uA, approx. 10.6 mW)

15 Volts:
14 k load - 72 Volts output (5.1 mA, approx. 370 mW)
100k load - 234 Volts output (2.34 mA, approx. 548 mW)
10 Meg load - 460 Volts output (46 uA, approx. 21 mW)

Notes:
  • The values in parentheses indicate the current flowing through the resistor being tested and the total power being dissipated by it.
  • A 14k load was chosen since this was the first resistor that I'd grabbed while the 10 Meg load was that of the meter that I was using to measure the voltage.

Using a high-current transistor:

For the heck of it I changed Q1 from a 2N3904 - a rather generic transistor - to a KSD5041, a specialized, high-current transistor designed specifically for photoflash use:  As compared to the 2N3904's 600 mA capability, the KSD5041 can handle about 5 amps!

As expected, the circuit drew more current when unloaded - around 70 mA or so, but I got much more voltage on the output when operating it from 6 volts:

14k load - 65 volts output (4.6 mA, approx. 297 mW)
100k load - 140 volts output (1.4 mA, approx. 196 mW)
10 Meg load - 500 Volts output (50 uA, approx. 25 mW)

In putting the 'scope on the output the waveform looked much like that in Figure 2, but the spike was much "sharper" and taller - no doubt due to the transistor turning on more firmly and allowing a higher magnetic flux to build up in the transformer.  In looking at the voltage across the collector of Q1, I noted that the waveform peaked up to about 55 volts - somewhat above the 40 volt rating of the KSD5041 transistor!

When I raised the power supply voltage to 10 volts I measured over 650 volts on the output before it started to sag and was accompanied by a dramatic surge in power supply current.  While the circuit still worked, the current was still high when I returned the voltage back to 6 volts and upon pulling the transistor and testing it, its current gain was very low, indicating that it had been damaged - unsurprising since I had already been seeing 55 volts on its collector when I'd been running at just 6 volts!

What's Cfilt for?

You'll notice "Cfilt" on the schematic diagrams.  If you are operating this circuit from a battery with very short leads, you can probably leave this capacitor off since the battery itself - and the short wires - will have a fairly low impedance, an important property for this circuit to function well.

If you are running this from a power supply - particularly one that is shared with other circuits - Cfilt should be used.  A suggested value for this capacitor is 47-220 uF and "low ESR" capacitors are recommended for this.  A word of warning, however:  Even with a good quality filter capacitor this circuit is likely to put noise on the power supply!

Additional comments:

You may substitute a PNP transistor (such as a 2N3906) for Q1 if  you reverse the power supply voltage,  If you do so you will also get a voltage waveform that is an upside-down version of the one in Figure 2.

If you need very low current at a higher voltage you can use just a simple, series diode and filter capacitor, taking advantage of the high voltage "spike" that is produced.

What is this circuit good for?

This circuit can be used for several things:
  • High voltage supply for Neon indicators.
  • It can also be used as the high voltage source for Nixie tubes - provided that both the power dissipation of the transformer/transistor and voltage under load are taken into consideration.
  • Powering of electroluminescent strips including the so-called "EL Wire" - although the cheap inverters sold for that purpose will likely work better!
  • The generation of a plate supply for low-power vacuum tube projects
If you want even more voltage there are several options you can increase the voltage by adding more capacitor/diode stages.  For more information on high voltage multipliers, look at the following web page:

http://en.wikipedia.org/wiki/Voltage_multiplier  (link)

In theory, it should be possible to get thousands of volts from this circuit but remember that as you go up in voltage, the amount of current that you can pull will go down!

Final words:

This circuit is not particularly efficient but with a bit more work and complexity, it could probably be made to be a bit better.  Its biggest advantage is that it uses parts that you are likely to find at your local Radio Shack and in your junk parts pile!

[End]

This page stolen from ka7oei.blogspot.com

Sunday, November 24, 2013

Improving the bass response of a (cheap) subwoofer amplifier system by *reducing* its bass response

Several weeks ago I happened to be at a local electronics type store (I'll admit it, it was Radio Shack!) and they had on clearance - for a pretty good price - a nice-looking set of computer speakers (40-288).  This set consists of a pair of small-ish speakers for the upper-bass, midrange and highs along with a single, larger-ish "subwoofer" for bass.  I didn't get these for a computer, but to reinforce the sound from a small, flat-screen TV that I have near my electronics workbench that has appallingly bad internal speakers.


Figure 1:
The inexpensive speaker/subwoofer system.
Click on the image for a larger version.
Upon connecting them to the TV I was immediately struck by the fact that they sounded OK - except that the bass sounds were frequently breaking up at moderate volumes during musical bass notes and the sound of explosions - which are very common on TV.  I flipped the subwoofer on end and noted that, as expected, it was a ported enclosure (see Figure 3) which is typical for low-frequency speakers, large and small.

Knowing the size of the speaker's enclosure - roughly a cube that is 11.5cm on a side internally - and also the diameter of the speaker itself - about 6cm - I also knew that it could not provide extremely low bass-frequency response.  Based on a guess, I figured that its usable frequency response would extend down to roughly 125 Hz or so:  You just can't get much lower than that with reasonable efficiency using a simple ported box and (inexpensive) bass driver that is that small!

The problem:

The problem with the design of this subwoofer is one that is commonly seen:  If the system is "asked" to amplify frequencies well below the range that may be reproduced by the bass driver and its enclosure, several things are likely to happen:
  • Power will be wasted with the speaker's cone flapping about and frequencies well below those in which it is likely to be able to move air efficiently.  What this means is that instead of working on frequencies that can be reproduced, much of the amplifier's power will be used up (e.g. wasted) on these other "useless" (to the speaker, anyway) frequencies!
  • The speaker itself may be damaged.  On a ported enclosure such as this, driving with too low a frequency, the speaker just can't transfer energy to the air mass efficiently and in so doing, its cone moves too "easily."  If this happens the speaker's excessive cone excursions can cause physical damage and heat can even build up in the voice coil assembly.  The latter is a bit less likely to happen with this small of a speaker and with the modest amplifier power level involved, but it is still possible.
  • It will sound terrible.  With the amplifier clipping, trying to amplify too much low-frequency range content that cannot be reproduced, and with the speaker itself flapping about trying to reproduce the low-frequency sound, you can end up with distortion, popping and buzzing.
Connecting it to an audio generator I swept from about 1 kHz down to 10 Hz or so and as expected, the crossover point from the smaller speakers to the subwoofer was in the general area of 200 Hz - not sharp, but definitely there.

I also saw that the speaker was still being fed power when I got down below 10 Hz, at which point uselessly flapping about as there was no way that it could reasonably be expected to efficiently transduce energy at that frequency - and that was the reason why it sounded like it was breaking up on low bass notes!  Careful observation revealed that the amplifier seemed to have a slight "peaking" effect in the area of 100-200 Hz - likely done to slightly emphasize the frequencies best conveyed by the subwoofer.  (I didn't reverse-engineer the circuit enough to determine if this was intentional or not.)

The "fix"

Figure 2:
 Bottom-side location of the capacitor to be changed along
with the added 10k resistor.
Click on the image for a larger version.
Popping apart the satellite speaker that contained the amplifier I started poking around with an oscilloscope while varying the frequency of the audio generator and quickly found where the wipers of the dual volume control went over to a pair of surface-mount 3.6k resistors and the audio from the left and right channels were combined ("3R1" and "3R2" in Figure 2).  I then followed the audio through a 2.2 uF coupling capacitor (mounted on the other side of the board) and then to the input of the audio amplifier for the subwoofer - a stereo chip configured to drive the subwoofer in bridge mode to achieve maximum power power output for the supply voltage.

Note:  I didn't remove the heat sinks, so I don't know which audio amplifier chips are used in this speaker system.

At this point something struck me:  In comparing with the oscilloscope, the audio level "before" and "after" the 3.6k resistors used to combine the left and right channel I could see that there was practically no difference, indicating that the amplifier itself minimally loaded the audio line beyond that point.  Having just followed this signal path I also knew that there was nothing that limited the low frequency response of the amplifier to something within a reasonable range of what the speaker itself was likely to be able to reproduce!

To satisfy my hunch I replaced the 2.2uF capacitor with a 0.022uF capacitor and noted that it only just started rolling off the frequency response below 100 Hz, indicating that the amplifier's input impedance was likely in the range of 50-100k, so with the 2.2uF coupling capacitor, the amplifier was going to amplify signals down to less than 1 Hz with minimal rolloff! What I needed to do was to limit the frequency range of the amplifier to something more reasonable in terms of what the speaker was likely to be able to reproduce!

To do this, there are two reasonable options:
  • Build a nice, multi-pole high pass filter that will sharply cut off the audio below a certain frequency - say, 100 Hz.  This would require either a transistor or two or an op amp along with a handful of other components and would be built upon a small circuit board that was added into the enclosure and connected inline with the subwoofer amplifier's audio path.
    Figure 3:
    The bottom side of the subwoofer cabinet showing
    the driver and port.  If you throw too-low a frequency at this sort
    of speaker it just thrashes around and doesn't really
    produce much sound.  It's always  best to send only those frequencies
    to the sub's amplifier that the speaker will be able to reproduce!
    Click on the image for a larger version.
  • Just kludge it and make a simple R/C high pass filter.  This wouldn't as sharply cut off the low frequencies, but it would likely do the job of preventing ridiculously low frequencies from getting to the amplifier and cause it to waste effort!
I chose the latter.

In poking around on the audio input pin of the amplifier I saw that there was no DC offset, so I temporarily connected a 10k resistor between it and what appeared to be a nearby ground - at least, it was where there was a capacitor connected across the input to roll off the high frequencies above which the subwoofer was not supposed to amplify.  Temporarily tacking the 2.2uF back into place, I saw with the oscilloscope that the 10k resistor made almost no difference the subwoofer's output level and that its output remained clean.  I then made the 10k resistor a permanent part of the circuit, soldering it on the bottom side of the board as can be seen in Figure 2.

Grabbing a calculator I crunched a few numbers and decided that a 0.1uF capacitor (a nice, round value) in place of the original 2.2uF capacitor would be worth trying as it, in conjunction with the 10k resistor, would provide a -3dB roll off frequency of about 159 Hz - a fact confirmed using the oscilloscope and audio generator.  With the amplifier's slight "peaking" noted above, the power wasn't down by 6dB at 160 Hz, but closer to 100 Hz at the -6dB point.  (I used a plastic capacitor rather than a ceramic capacitor because the latter would have had terrible temperature stability.)

Feeding some music with a lot of low bass into the speaker system, it seemed to sound just fine:  Reasonable low-frequency response and no obvious distortion - even at fairly high audio levels.  Tacking the 2.2uF capacitor back into place the perceived bass response improved slightly, but now the audio amplifier was breaking up badly with obvious clipping and distorting as before.  Taking the 2.2uF capacitor off again I tacked another 0.1uF across the first (for a total of 0.2uF) to set the hypothetical -3dB frequency to about 80 Hz and could hear a very slight increase in amplitude of the bass notes and a bit of occasional clipping at fairly high volume, but it didn't seem to be worth it to have the extra capacitor on there so I left it at just 0.1uF.

Figure 4:
The completed modifications - along with the added
heat sink material.  This is just a scrap of copper - probably from a
piece of water pipe - that I cut down the side, cut tabs to match the chip's
"heat sink" and ground pins on the foil side of the circuit board, and then,
using a very hot soldering iron to get the job done quickly, attached
it to the circuit board.  The foil side of the circuit board faces up
within the box so the heat actually radiates better this way!
Click on the image for a larger version.
While having the unit apart I noticed that the heat sink of the subwoofer's amplifier chip was far too hot to touch after a few minutes of abuse from the signal generator.  Typically, these sorts of chips have built-in thermal protection, so it was not too likely to be damaged by getting hot, but this thermal protection often works by causing the amplifier to cut its power back - usually causing distortion.

To be sure, my reducing the frequency response of the amplifier greatly reduced that amplifier chip's thermal load, but I decided to solder a bit of scrap copper to the heat sink fins on the "bottom" side of the board (which actually faces up when the board is installed) to increase its heat dissipation ability.

Now, with the very low frequencies eliminated from the amplifier it could put more power into reproducing those low frequencies that were well within its capabilities without wasting it on frequencies that were too low.

Putting the entire thing back together, it now works fine in its intended role:  As a half decent sounding speaker system for the small TV!

[End]

This page stolen from ka7oei.blogspot.com

Monday, November 11, 2013

Attention-getting brake light "modulator" for a motorcycle.

Figure 1:
Figuring out how to remove the tail light.  It required
removing the bracket and license-plate holder just to
get to the bolts that hold the light in place.
Click on the image for a larger version.

My brother recently got a Yahama Bolt, a fairly new-model, medium-sized motorcycle.  As is the case with most motorcycle riders, "preventing invisibility" is always a big deal as it is often the case that casual riders of bikes of all sorts (motorized or not!) tangle with a car when the driver of the latter didn't see them!


Among a few other things done to enhance safety and visibility, he wanted to "modulate" the brake light - that is, rather than just going on and off with the application of the brake, that it do "something else" as well.


It is becoming more common that some new-model vehicles blink their brake lights in some sort of attention-getting flash sequence - and doing so makes a lot of sense:  The human brain is very good at detecting when something changes or is out of the ordinary so anything that stands out from the routine is likely to grab a bit of extra attention!  The hope is that if even a single driver is jolted out of a sleepy stupor or their attention drawn from their texting by this sort of thing that it will be worthwhile.


 First, the obligatory warnings and weasel words:
  • The brake light system is a safety device on which your life - and the lives of others - may depend.  Modifying it in any way runs the risk of reducing its reliability, particularly if due care has not been taken during design, building and installation to maximize reliability.
  • There are no warranties or guarantees, expressed or implied, as to the suitability of this project for its intended use, or for any other use.
  • Nothing in this article should be construed as offering an opinion as to the legality of the use of this sort of device.  It is up to YOU to determine if this device is legal/lawful to use.
  • If you choose to construct a device similar to this, it is up to YOU to make it as reliable and safe as possible and YOU assume any risks should any injury to anyone occur as a direct or indirect result of this sort of device!  The author of this article will not be held responsible for any injury or damage or other liability that might result!
  • Improper design, construction and wiring could result in damage to the vehicle's electrical system and/or wiring as well as other safety concerns.  YOU must assure that the work/modification has been done properly to minimize any risks as well as be aware that doing so may void warranties, reduce reliability, cause damage, etc.
  • Finally, the assertion that a "modulated" brake light catching the attention of other motorists and possibly improving overall safety is an opinion rather than a statement based on scientific research or fact and anyone reading this page and/or taking inspiration from it should take it as such!  It is up to YOU to determine if, in fact, this sort of project has positive or negative effects on overall safety!
  • You have been warned!


Figure 2:
 On the bench, the unit  in "dim" (tail light)  mode.
Click on the image for a larger version.
Figuring it out:

First, we analyzed the existing brake/tail light assembly of the Bolt after removing it from the bike.

Using three wires for connection (including a black "ground" wire) it consists of an array of 19 high-brightness red LEDs and internally, it seems to be "diode-ORed" between the two voltage sources.  If voltage is applied to the tail light wire (blue), the 19 LEDs light rather dimly and the entire assembly pulls about 40 milliamps at 14 volts.  If, however, you apply the same voltage to the brake wire (yellow) approximately 400 milliamps is pulled and the result is enough light to give you a bit of a headache and cause you to see red and green spots for several minutes!

Further analysis indicated that the tail light voltage was applied any time that the ignition key was on.  As you might expect, the brake light voltage appeared only when you applied them:  No special PWM (Pulse-width modulation) or anything else was present, this likely due to the fact that this light assembly was (probably) designed to drop in where one might have had an old-style, dual-filament incandescent lamp.

With its using only on/off voltages, this project would be easy!


The build:
Figure 3:
Throwing together the code for the tiny computer.
Click on the image for a larger version.

As strange as it might seem, the easiest way to make a device that flashes the light in a particular pattern is to throw a computer at it!

Fortunately, this is something that is pretty cheap and easy to do these days and I knocked out some very quick "C" code using a compiler for a low-end PIC microprocessor - a PIC12F675.  The device used was an 8-pin DIP (through-hole) processor chip (the same size as a 555 timer) that has a number of useful peripherals like A/D converters, built-in timers and a few other things - but I wouldn't need most of them:  I picked it because it was the smallest, simplest microcontroller that I had laying around.  Some of its features - like the watchdog timer and "brown-out reset" would be used to make sure that it "booted up" reliably and quickly, within a few 100's of microseconds after power was applied, every time.

While the computer code could have been done in assembly, I used C since I have the development tools (suitable tools can also be found for free...) and it was be very easy to bang out quick, dirty, and reliable code just to blink the light!

In the code I defined an array of 0's and 1's in program memory that corresponded to the desired blink pattern (0 = off, 1 = on) and indicating the end of the array is a "255":  The code would simply step through the array from the beginning and stop when it hit "255", leaving the light on.  Between each step a short delay (25 milliseconds) was added to slow down the process and make the blinking perceptible:  Without it, the entire sequence of blinks would have occurred in a few 10's or hundreds of microseconds and may not have even been noticeable!

Figure 4:
 Building the prototype on solderless prototype
board for initial hardware and software debugging.
Click on the image for a larger version.
Just because I was lazy, I defined all of the PIC's pins as outputs (except for the one that can only be used as an input - which I grounded) and the output pin that worked out to be the most conveniently located when I crammed the parts on the board was routed through a series resistor (R3) to an NPN transistor, Q2.  The collector of this transistor was connected to the base of a PNP power transistor (Q1) via another resistor (R2) and when the PIC set the pin to high, the NPN was turned on, yanking down on the PNP's base and turning it on, applying power to the brake light lead.  The total voltage drop across Q1 when the light was on?  Less than 200 millivolts (and a fraction of a watt heat dissipation) - barely even worth mentioning, let alone even noticeable in its effect of the light brightness!

Note:  In the diagram below, I happened to use pin 7 since it was closest to R3, but I could have used any one of the other output pins (shown with no connection in Figure 6) instead.  Do not connect multiple pins together.

To keep the computer happy a 78L05 regulator (U1) was used to drop the 12-15 volts of the motorcycle's power bus to the 5 volts required.  Because vehicular electrical systems are often "noisy" with spikes and glitches, I used a series resistor (R1, 47 ohms) and a filter capacitor (C1, 47 microfarads) to "clean up" the power applied to the regulator.  These components were selected so that not only would spikes be filtered out, but even very brief taps and releases of the brakes would trigger or re-trigger the computer quickly and reliably.  There is also another resistor, R4 which, should the processor NOT boot up for some reason, will pull the base of Q2 high and turn on the light since the hardware default of the processor is to have its pins in a high-Z state:  After all, we do want the light to WORK if your life may be depending on it!

In just a few minutes I had a circuit and its code working on a piece of wireless prototyping board.  After a bit more fiddling of the code to make it flash the desired sequence at the rate that my brother wanted, we were ready to commit ourselves to building a "permanent" version.

Figure 5:
 The newly-built board, ready for testing shown
laying atop the initial version of the
 schematic diagram that was built onto the
prototype board seen in Figure 4.
Click on the image for a larger version.
After analyzing the unused volume inside the tail light enclosure I could see that there was just enough room to cram a small board below the portion of the assembly containing the LEDs (see Figure 8) so I proceeded to build the circuit onto a small piece appropriately-sized phenolic prototype board. As can be seen from the pictures, I didn't make the board any larger or taller than absolutely necessary - at least with through-hole components - nor did I use a socket for the processor since I didn't want there to be the possibility of it falling out.  Were this device to have been built using surface-mount components it could have easily ended up being about the size of a postage stamp!

Once the circuit was built and tested I mixed a big blob of 5-minute 2-part epoxy and liberally coated both sides of the circuit board - this, to completely immobilize the circuitry to protect it from vibration as well as moisture.  Constantly rotating the board for a few minutes to keep the epoxy from dripping off, it soon began to set up and I then used a heat gun to warm it (to about 180F) - just hot enough that I could smell the epoxy, all the while moving the board about since the heat momentarily caused it to re-flow.  After 2-3 minutes of that, the hot epoxy had hardened to the consistency of a rubber pencil eraser so I let it cool.  In another 10 minutes at room temperature it was almost rock-hard, the curing process having been greatly accelerated by the application of heat.

The unit was re-tested and found to be working so we could now wire and mount it within the tail light enclosure.
Figure 6:
 The final version of the schematic diagram of the circuit for "modulating" the brake light.
While pin 7 (CP0) was used to drive Q2, pin 2, 3, 5 or 6 could have been used instead since all of the other pins shown in the diagram as being unconnected flash the sequence as well. While not shown in the above diagram, it is recommended that a resistor with a value of between 10k and 100k be connected between the emitter of
Q1 and the collector of Q2.  Where I to build this again I'd include a 15-18 volt Zener diode across C1 to provide
additional protection against transients.
Click on the image for a larger version.
For wiring onto the existing circuit I bared a short section of the insulation of the light's black wire (ground) and soldered it to the circuit.  Then, cutting the light's original yellow "tail light" wire I put the circuit inline with it, soldering and insulating the connections with heat-shrink tubing.  I then squirted a small blob of silicone seal on the inside of the milky-white plastic housing containing the LEDs where the board would go and plopped it into the small gap where I'd already pre-fit it.  Reassembling tail light housing, it all fit perfectly as seen in Figure 8.

Figure 7:
 The tested and working board, now coated with epoxy and
ready for install.
Click on the image for a larger version.
Testing once again on the workbench to verify that it worked after putting it all back together (it did!) we went back to the garage and after a several minutes of squinting and cramped fingers we managed to get all six of the bolts that hold the light and the shield/license plate holder assembly in place back together using some blue thread locker so that they wouldn't rattle loose.

We now had the light on the bike and working!


What does it flash?

When programming the PIC processor, we changed our minds several times about what, exactly, it would flash.  We first thought of the Morse code "V" which is "di-di-di-dahh" - like the beginning of Beethoven's 5th symphony.

We then tried the word "STOP" in Morse code and adjusted the speed to taste, ending up with a rate of about 44 words-per-minute so that the entire sequence completed in much less than a second.

Ultimately, we ended up with a different Morse message entirely, also sent at around 44 words-per-minute.  This turned out to be a very short, two-word message - the first word being "OH" - the result being a very distinctive, bright, and attention-getting flash sequence.

Can you guess the rest of the message?


Figure 8:
 The completed board, now inside the tail light housing, almost ready to be re-mounted on the bike.  On the underside of the white housing containing the LEDs there is a gap with an angled plastic area, just big enough for the board and the wires entering the enclosure to fit.  Not visible, the board is secured in place to the white plastic using a blob of RTV
(Silicone (tm)) adhesive.
Click on the image for a larger version.


Getting the code:

FWIW, the HEX code for this project - targeted for the PIC12F675 and PIC12F683 - may be found at the link below.

By downloading this .HEX file you indicate your understanding and acceptance of all risks involved in using it, including those that might result in hazard to life and safety and that you have read and understood the warnings near the top of this post.  

There are no warranties expressed or implied and it is up to the end user to determine the suitability and safety for their purpose!

Here are two .HEX files, one targeted for the PIC12F675 and PIC12F683.  The code is identical in function, but allows the builder a choice of processors:
Note:  It was "discovered" that with most programmers, the original .HEX code could not be used due to a hardware conflict with the !MCLR on pin 4.  The .HEX code above and the schematic in Figure 6 have been modified accordingly by tying pin 4 to pin 1.

While I'm not prepared to build custom boards to be installed (it's a matter of time and liability) I can supply a pre-programmed chip at a nominal cost for someone who might be willing to build a board, themselves:  Contact me if you are interested.


[End]

This page stolen from ka7oei.blogspot.com

Tuesday, October 29, 2013

Fun with the Microchip PICKit 3 and the Sure Electronics DB-UD11111 ZIF adapter

For many years now I've been using my old, trusty Picstart Plus programmer for my PIC-based projects.  Having used PICs since about 1990 - and having a reasonable suite of development tools, including the CCS C Compiler.

Since (before?) the introduction of MPLAB-X a while ago, the Picstart Plus was not been actively supported - and it never did/will support some of the newer, fancier devices anyway, so I started to look around for a replacement.

I quickly came to the realization that the most reliable path to the newer chips was the PICKit 3, a USB-based device which is much more convenient - and faster - than the serial-based Picstart Plus, but I soon realized that in order to use it with a wide variety of devices I'd need to have some sort of external board with several different sockets on it:  Unlike the Picstart Plus - which would actually "rewire" itself to program about any PIC you threw at it, the PICkit 3 simply had several pins on it which connected to the user's board or to an external socket using the ICSP (In-Circuit Serial Programming) capabilities of modern PIC processors.

In looking around the web I spotted the Sure Electronics DB-UD11111 for just $9.95 - and it looked as though it would fit my needs:  It was fairly cheap and it looked as though it would be able to handle most of what I needed it to do having 40, 20 and 18 pin ZIF (Zero-Insertion-Force) sockets to accommodate the different PICs.  While it appears to have been originally designed for the PICkit 2, the same ICSP programming is used in the newer PICkit 3 so it would work equally well for both.  At $9.95, I knew that I would probably have trouble even buying three ZIF sockets for that price!

Comment:
It would appear that the Sure Electronics DB-UD11111 has vanished from the above web site (at least I couldn't find it there!)  It does seem to be available from other vendors on the web for a higher price than the original $9.95 and, at the time of this update (August 2015) it seems to be available on EvilBay, being sold by Sure Electronics in their very own store for around $15 - search for "DB-UD11111".
I'm sure that there are other ZIF socket arrangements that will permit the PicKit 3 to work with a wide variety of devices, but I am not familiar with them.

Several weeks after placing the order with Sure, both it and the PICkit 3 arrived from China and I sat down to study the board.

Unfortunately, the documentation supplied is very sparse to say the least as it is just a .PDF of the schematic diagram of the board!  In looking at the board - which seems to be fairly well built but a bit awkward to use (more about that shortly) - I could see that it was labeled for 18, 20 and 40 pin devices.


What about programming  8, 14 and 28 pin devices?

In seeing the 18, 20 and 40 pin sockets, I wondered about the other devices.

To answer this question looked at the data sheets for typical 8, 14 and 28 pin devices (e.g. PIC12F675/683, PIC16F688 and PIC18F2620, respectively) on the Microchip web site and compared them to the schematic of this ZIF board to satisfy a hunch - which I verified to be correct:  Microchip had thoughtfully placed the Vdd, Vss, Vpp, PGC and PGD pins - everything that you'd need to program modern PICs - in locations that physically translated to the the appropriate pins on different package sizes of these PICs.

In other words:
  • 18 pin PICs:  You program those in the 18 pin socket - that's obvious!
  • 28 pin PICs:  The programming pins on the 40 pin socket also align physically with those on the 28 pin PICs, so pin 1 of the 28 pin devices go in pin 1 of the 40 pin socket.
  • Figure 1: 
    The PICkit 3.  As you can see I
    added a label to remind me of the
    "power" configuration to make it
    work with devices plugged into
    the passive ZIF socket adapter.
  • 20, 8 and 14 pin PICs:  The connections on the 20 pin socket physically align with those required on both 8 and 14 pin PICs, so use that socket, aligning pin 1 of the 8 and 14 pin devices with the socket's pin 1.

Making it work:

After getting the PICkit 3 and firing up MPLAB, I initially had trouble getting it to see any PICs at all - that is, until I remembered that the PICkit 3 had the option of powering the PIC chip being programmed - or not. As it turned out, it defaults to "not" so I had to go into the "power" sub-menu and check the box that told the PICkit to power the target device.

After that, I could read and write to a PIC16F88.  "Great!", I thought,  so I tried a PIC12F683 - an 8 pin device.

No dice!

Hmmm...

Using an ohmmeter I verified that all of the pins went where the schematic said that they should go (they did) so why didn't the PICKit 3 "see" the 12F683?

On a hunch I put the voltmeter on the power supply pins of the PIC and saw about 4.75 volts - lower than the 5.00 volts that I'd selected in the "power" menu.  Setting it to 5.5 volts, I saw no change, so I dropped it to 4.5 volts and not only did the voltage on the PIC now read 4.55 volts (close enough!), but I could now read and write to the PIC12F683!

What's the deal, then?

As it turns out, the PICkit 3 gets its voltage for powering the PIC being programmed from the computer's USB port which, by definition, is somewhere around 5 volts - and in the case of this particular computer was right at 4.85 volts.  What this means is that the PICKit3 could never supply more than about 4.75 volts to the PIC as there is about 0.1 volts drop within its circuitry.
Figure 2:
The Sure DB-UD11111 socket adapter.
It's pretty well built, but the cover gets
in the way of the levers!  After
taking this picture I took the cover
off, saving it by sandwiching it
on the bottom cover to avoid
losing it somewhere.

What seemed to be happening was that at a voltage that was "too high" to be supplied by USB connection, the Vdd being supplied to the PIC could not be regulated by the PICkit 3 and was likely "dirty."

Setting it to a lower voltage safely below that which was provided on the USB port - say, 4.5 volts - "fixed" this problem.

Unfortunately, there doesn't appear to be a way in MPLAB to have it supply power to the target device by default so I have to remember to re-select these anytime I make a change to the configuration or start the program.  After a bit of fiddling I "discovered" that if you exit MPLAB (Version 8.9x) with the unit configured for 4.5 volts that it may remember that voltage setting next time it is powered up - but it still seems to require you to tick the box for the PICkit supplying power to the target device and verify that the programming voltage is still set to 4.5 volts.

In further testing with a few different PICs I found that I could read/write them at least as low as 3.5 volts, but I couldn't immediately find a specification as to the low end of Vdd range.  Since I was not using LVP (Low Voltage Programming) and the PICkit 3 was supplying the Vpp, this specification is likely somewhat relaxed for most devices.

One suggestion that has been made online is to connect the PICkit 3 to a powered USB hub that is supplied with 5.25 volts.  Interestingly, the voltage specification for USB 2.0 is 5.0 volts +/- 0.25 volts so their inclusion of 5.5 volts as a  valid programming voltage would never be satisfied by an in-spec USB connection!

A few more comments about the Sure DB-UD11111 socket adapter:

This socket adapter is built fairly well, but I removed the translucent top cover after taking the picture in Figure 2 as it also somewhat obscured the silkscreen notation on the board, including the indication of the location of pin 1 of the connecting cable. (it's the white wire on the right, if you are curious).

Another problem with this cover is that it gets in the way of the levers on the ZIF sockets:  You may need to use either your fingernails or a small tool to operate some of these levers unless you have fairly small fingers.

Was removing this cover much of a loss?  No, since I'll just make some labels, anyway to remind me where/how to orient 8, 14 and 28 pin devices.

On the bottom plastic cover on the board I attached some small, stick-on rubber feet to keep the unit from sliding around on the desk, as well.

Some final comments on the PICkit 3:

In the forums, blogs and comment boards, the PICkit 3 has been oft-maligned - and I can see why:  It is decidedly less user-friendly and idiot proof than the Picstart Plus in many ways as there are many things that can go wrong - particularly if you have integrated a PIC with ICSP in your project where there is more than jut the PIC being programmed to deal with.

To be sure, the "problem" with the Vdd supply being derived from the USB power source is a problem for those who use the PICkit 3 to supply power to the target device - and it would be really nice if there was the option in MPLAB to allow all of the power options to "stick":  A warning comes up anyway about powering 3.3 volt devices from 5 volts, so why not have that warning include any settings that you have overridden, too?

In my (thusfar) limited use, it is much faster than the Picstart Plus and it has been very reliable - once you know the tricks - with it being powered entirely by the USB interface, which is much more convenient than the Picstart with which required not only a USB-to-serial adapter to work with my laptop, but also a "wall wart" just to power the programmer.

Additional comment:

I occasionally have trouble programming PIC12F675's and PIC12F683's with the PICkit 3 because of this same problem.  In those cases, attaching a separate Vdd supply of 5 volts to the programming socket - to power the chip being programmed - always solves the problem.

I have no idea why it works most of the time and then fails at other times...

Why PICs?

These days, the PICs seem a bit passe to many as the Arduinos and their variants have caught the fancy of many experimenters.  True, there are many "shield" modules with lots of cool peripherals to be found and, perhaps most attractive of all, huge libraries of code available to get done what you might want to do.

While I have used the pre-built Atmel/Arduino devices peripherally (pun intended!) and they look cool, they have usually been a bit of an overkill - and certainly much more expensive (hardware-wise) than just a PIC and a few parts.  In most cases, when I have a project, it would take a bit of effort to shoehorn an already-made Arduino board into place to fit my needs than it would have been to simply design the device from the ground up to do just what I need:  After all, to get the processor, alone, working it may take as little as a capacitor, IC socket (in some cases, less than $2 in parts) and the processor itself to provide the basis of the hardware to which the rest of the project to which you'd need to connect any processor that you might use (PIC or not) to the rest of the project!

Since I have long had the development tools for the PIC (e.g. CCS C compiler, since the "Version 2" days) and was familiar with it, I already have a fairly large library of my own code from which to borrow - and occasionally, I may even "borrow" some ideas from other platforms as well!

In doing my PIC projects I have found the 8-pin devices to be the most all-around useful as it is often the case that just 6 I/O pins is enough to do what I need to do - anything from flashing some lights to controlling a fire siren to even doing some audio DSP/filtering - and I've probably dropped hundreds of these things into projects that I did on my own and for others.  Where 6 pins of I/O isn't enough, the 18 pin devices are about the right size for most other things - but I have used the 14, 28 and 40 pin devices where it made sense to do so!

Having said that, the Arduinos do look fun and one of these days I may just try one of the "canned" boards and then think how I might incorporate that into another project.  More likely, though, I'd probably just build something around the raw chip itself - just as I've been doing for years now with the PICs...


Update:
Since this was post was originally written I got another PicKit 3 and DB-UD11111 adapter - just so that I would have two:  One for the bench, and one for "on the go" when I needed to haul the programmer somewhere else, or for those times that I can't find the other one because there's too much junk on the workbench!

[End]

This page stolen from ka7oei.blogspot.com

Monday, October 28, 2013

Repair of the speedometer on a Polaris Sportsman 500 4-wheeler

Important:
If you are at this page you probably have a Polaris with a bad speedometer which means that you can't put it in 4 wheel drive and your reverse override doesn't work.
If this has happened to you, you probably ran it without a good battery - or with no battery at all:  Read on to find out why you should never do that if you can help it!
There are at least two versions of speedometers used in the late 1990's and early 2000s - the one that, inside, looks like Figure 4 with "through-hole" components and a slightly newer version that largely uses surface-mount components.  While both versions seem to have the same fate when used with a bad (or no) battery - and the "fix" is likely similar, I have not personally seen the newer surface-mount version, but you can find information on its repair near the bottom of this article as provided by one of the readers.
If you have successfully repaired one of these newer versions and are willing to share the specifics, I'd be happy to post it here.  If you have a "dead" speedometer of the newer version and would likely me to take a crack at fixing it (absolutely no guarantees about success!) then feel free to contact me via comments, below.

Last year, a friend of mine had the battery go bad on his 1999 Polaris Sportsman 500 4-wheeler.  Aside from the inconvenience of having to pull-start it, it seemed to work OK.

Sort of.

Soon, it was noticed that the speedometer had died and interestingly, a few other things quit working at the same time such as the ability to put it into four-wheel drive. When the battery was finally replaced the speedometer still did not work so a he dug around in the internet and found that this is quite a common problem with that vintage of Polaris vehicles - and it seems to work out this way:

The charging system's voltage regulator on these vehicles are fairly simple, but they depend strongly on the presence of the battery to moderate the wildly pulsating DC coming out of the alternator/regulator system to maintain the average voltage in the range of 13.5-14.2 volts or so.  If the battery goes completely bad or is removed, the charging system goes haywire and the voltage can (apparently) exceed 20 volts (and is probably higher) and one can risk burning out the various indicator, marker and headlights.

Another fatality under this conditions seems to be the speedometer module itself!

What (probably) happens:

It's probably not the high voltage that actually kills the speedometer:  The voltage regulator circuit in the speedometer seems to be fairly robust, using high voltage (>=300 volt) transistors to withstand the voltage spikes that are endemic to any vehicle electrical system.  What seems to kill these things is heat.

Let me explain.

The job of the voltage regulator circuit inside the speedometer is to assure that the voltage feeding the circuit inside doesn't exceed about 15 volts or so and from there, it is regulated down even lower by other circuitry for the computer that provides the odometer readings and (probably) the speedometer as well as having something to do with the reverse limiter designed to prevent you from accidentally driving backwards at a high speed and the lockout/controls for the all-wheel drive switch.  There are also several small light bulbs inside the speedometer that provide backlighting for the display at night and these, too, are protected from high voltage by the 15 volt regulator.

Under normal conditions the voltage on the vehicle's electrical system is around 14 volts or so and the regulator's job is to suppress spikes and brief excursions above that and in this mode, the regulator itself isn't doing much.  If the voltage rises, however, it has to drop the excessive voltage and and a natural by-product of this is that it develops heat.

Apparently, quite a bit of it!  In testing the speedometer after the repair I applied 20 volts to it and the main regulator transistor soon got too hot to touch:  If this had been a hot, summer day with the transistor crammed inside the waterproof speedometer casing with no free air ventilation, it would have been much hotter.

So, with the bad battery and a subsequently malfunctioning charging system it is easily likely that the speedometer's regulator saw an average of 20-30 volts on its input.  At some point the transistor overheated and eventually failed internally, shorting itself out.  Fortunately, the majority of the circuits in the speedometer seemed to survive this since once the regulator itself had quit, all power feeding the rest of the circuit was lost completely, preventing further damage.

While a new speedometer is available as a replacement part, it will cost you several hundred dollars, new!

Fortunately, it may be that you can fix it!

The obligatory warnings, etc.
  • Assume from the beginning that the speedometer is a total write-off and that you would have to replace it, anyway.  This way, if you can fix it, you will be money ahead - but if you can't, you haven't lost anything more! 
  • Before you start, read this entire posting so that you'll know what you are in for!
  • Repair of the speedometer requires some knowledge of electronics and board-level electrical components.
  • Repair also requires good unsoldering and soldering skills and equipment - and a soldering "gun" doesn't count.  If you don't have the proper tools and experience in the replacement and installation of individual, through-hole components, do not even attempt this!
  • The speedometer is part of the electrical system of the vehicle and as such, it is possible that its malfunction - possibly due to a failed repair - could cause additional damage to other components.
  • No, I won't repair your speedometer as with shipping, time, "hassle factor" and labor, I'd have to charge a sizable percentage of the cost of a new one.  I suggest that you find someone versed in electronics to help you out if you need to do so.
  • I know ONLY about the speedometers on Polaris Sportsman 500's for the years 1999 and 2000:  If you ask me about speedometers for any other make, year or model, I can't help you!  (They may be the same - they may not - I don't know.) 
  • You do this repair at your own risk!  Do not get mad at me if you blow something up, set fire to your four-wheeler or cause all of your dog's hair to fall out! 
  • Again, there seems to be a (newer?) version of the speedometer with more surface-mount parts that can suffer the same fate.  While I have not seen one of these, personally, one of the readers has provided information about his successful repair:  With his permission, I have posted this update near the end of this article.
  • You have been warned!

How to do it

Remove the speedometer:
 
The first step is to remove the speedometer from the vehicle.  It's a bit of a pain, but it's not terribly difficult to do as it is almost the same procedure as would be followed for replacing the headlight.

Inside the housing that covers the headlight you'll find two connectors that snap into the speedometer, held in place with release tabs, as well as two nuts that hold the bracket in place:  Note how these go together before taking them off - make a drawing and/or take a picture before you take everything off if you aren't sure.


Open the speedometer:

Place the speedometer face down on a clean, un-cluttered work area on a surface that you don't mind scratching:  It's recommended that you put a rag or old towel between the face of the speedometer and the work surface.

Now, notice the soft, aluminum ring around its perimeter:  This holds the clear, plastic cover to the body of the speedometer by virtue of crimping between those two pieces a rubber gasket.


Wearing leather gloves to prevent being stabbed during this step, use a medium-sized blade screwdriver - preferably one that is somewhat worn out with rounded edges - and slide it between the aluminum ring and the plastic body of the speedometer on the back side, prying the ring open as you go along, straightening it out.  With a bit of practice you can firmly slide the screwdriver along the perimeter and straighten out that soft, aluminum ring and you will probably have to go around several times to do the job.

Figure 1:
The soft, black, aluminum ring around the perimeter of the speedometer that holds the faceplate to the body.  Carefully pry this straight.
(This picture was taken after I'd already opened and repaired it - and partially closed it again.)
Click on the image for a larger version.

Once you get 75-90% of the backside of the ring straightened out, you'll be able to pop the ring off the front:  Set it aside.  With the ring removed you should be able to use your fingernails and pry the front, clear cover from the body of the speedometer.

Be careful with the black plastic rod under the push button, noting carefully how it is installed and taking care that it doesn't fly off somewhere!

Once you have the cover off, set it aside with the black, plastic rod laying inside the cover.

Remove the needle:

This is sort of tricky and it is possible to ruin the speedometer with this step:  Since you have already declared the speedometer to be a total loss, you shouldn't feel too bad if you do.


First, note how far the needle is pushed on to the spindle:  You'll want to remember this when putting it back on.

If you have very strong fingernails, try pulling the needle straight off the speedometer, but whatever you do, apply tensions EVENLY - that is, pull straight out on the needle as you do not want to bend the spindle!  When you pull on the needle make sure that the speedometer is on the workbench with padding on it because if it comes off suddenly, you don't want to slam your hand or the speedometer into the workbench and break something!

If you can't remove the needle with our fingers, you'll need to apply a bit more force.  Cut some pieces of paper or thin cardboard (such as from a cereal box) so that you cover the entire face of the speedometer, but allow access to the needle and its spindle - this being done to prevent you from accidentally marking up the speedometer face.

Now, using two medium-size blade screwdrivers, pry the needle evenly off the spindle using the paper/cardboard to prevent damaging the speedometer face:  You may want to wrap a rag around the body of the speedometer and clamp it gently - but firmly - in a vise.  Hopefully, the needle will come up without breaking anything else!  If you do break something else, save up for a new speedo!

Remove the speedometer module from the body:

Using a small screwdriver blade or, preferably, a similarly-sized and shaped piece of plastic, carefully pry up on the face of the speedometer.  The face is actually printed on a piece of fairly heavy, self-adhesive plastic that is about as thick as a postcard - and it is this, not the actual body of the speedometer itself - that you want to pry up.  It can be a bit tricky to get purchase on the speedometer face and you might bend into a hook a small piece of metal such as a paper clip to act as a tool.

Figure 2:
By carefully prying up the speedometer face's plastic, you can access the three screws that hold the module in the body.  The other two screws are located 1/3rd of the way around, at approximately "10" and "40" MPH.  If you can't get the needle off before this step, make sure that you move it out of the way when you pry up on the face plate so that you don't accidentally break it.
Click on the image for a larger version.


Start by prying up on the plastic face below and in the middle of the LCD odometer display, at the bottom of the speedometer and once you lift it a little bit, you will see underneath it a Philips type screw:  Holding the speedometer face up with a small screwdriver, use another screwdriver to remove that screw.

There are two other screws, each located 1/3rd of the way around on either side:  Remove those, too.

Now, the only thing holding the speedometer module inside the case is friction and the silicone used to seal around the wiring connector pins on the back.  Using a small blade screwdriver, work your way around the perimeter of the inside of the speedometer, wedging gently between the outer body of the speedometer and the module itself, reaching down slightly past the face of the speedometer to do it.  After going around several times, applying a bit of twisting and/or prying force, the module will hopefully break loose and gradually come out.

When it does this, the pins from the electrical connectors on the back will be pulled through the case and soon, you'll have the module separated from the case.

IMPORTANT NOTE:
  • There are one or two cylinders with granules packed inside them in the case that contain moisture-absorbing compound.  As you  remove the body of the module, they may come out, or they may be (at least temporarily) stuck in place in their own crevice inside the module - but in any case, note where they originally sit.   Take them out and place them in a "Zip-Lock" (tm) bag and suck out the air to protect them from additional moisture while you are working on the speedometer.

Removing the LCD and accessing the back of the circuit board for soldering:

In order to get access to the "solder" side of the circuit board you'll need to remove the portion with the face plate, after you have removed the needle.  In so-doing, you'll also be removing the LCD odometer display.  It is recommended that you do this over a workbench covered by a rag or towel in case the fragile LCD falls out.

On the back side of the speedometer module (the "component" side of the circuit board) you'll find four black screws that correspond approximately with the four corners of the LCD display.  Laying the speedometer face-down on a piece of cloth, remove these four screws:  The front faceplate portion will separate from the circuit board.


This front portion also retains the LCD in place and it may fall out.  If it doesn't come out on its own, carefully remove it - noting the markings on the LCD and which way they were oriented with respect to the board.

Figure 3:
The repaired board showing the LCD.  Note the orientation of the writing on the LCD with respect to the board.  If you look carefully, you will notice markings on the upper-left edge of the LCD which may be used to indicate which way is up.
 Toward the 2-o'clock position of the speedometer board you can see the repair to the damaged trace.  Because the board is coated with a sticky conformal coating compound used for moisture protection it's difficult to avoid discoloring when soldering due to the heat and flux.   
Click on the image for a larger version.

The LCD's electrical connections to the circuit board are made via two small strips of pink-ish conductive rubber sandwiching darker rubber (often called "Zebra Strips") and these usually stick to the LCD.  If they are stuck to the board, very carefully remove them, but if they are stuck to the LCD, don't worry and leave them in place.  Set the LCD and the rubber strips aside in a clean, dust-free place such as a clean, dry food container.  You may notice that the LCD itself has a part number printed on it:  Note its orientation so that you can reinstall it correctly.

You now have access to both sides of the circuit board.

Identifying the bad components:

Important note (again) about through-hole versus surface-mount versions:

The pictures and descriptions below assume a through-hole version of the speedometer.  It would seem that a later model of this same speedometer uses surface-mount components for some of those that fail.
While I have not seen a surface mount version of this speedometer in person, one of the readers of this blog entry with a failed surface-mount version of the speedometer was sufficiently inspired to attempt a repair - and was successful!
With his kind permission, some details on the repair of a surface-mount version may be found at the bottom of this blog entry.

It seems that the one part that is sure to go is a large-ish power transistor, but there can be two components next to it that are also destroyed - and this damage may be evidenced by some burn marks on the circuit board:  See Figure 4, below, for identification of these components.

Figure 4:
Location of the likely bad part(s).  When I took this picture I had already replaced the TIP48 and the MPSA42 - but not the Zener diode.  There have been reported instances where the parts have gotten so hot that the solder has melted and that they have simply fallen out:  If this is the case with your speedometer, be sure to test the parts before reinstalling them or, if you don't have the facility to do that, simply replace them.
Click on the image for a larger version.

Even though only one or two of these components may be bad, I would recommend replacing all three of them.  These are:
  • A TIP48 high-voltage NPN power transistor.  This is the most likely component to be damaged and is a transistor with a metal tab.  In Figure 4, above, the leads are, left to right, B-C-E.  (The NTE equivalent is the NTE-198.  Note that previously I'd inadvertently listed the '197, which was incorrect.)
  • An MPSA42 high-voltage NPN low-power transistor.  This is a small, black transistor located next to the TIP48.  In Figure 4, the leads are C-B-E from top-to-bottom.  (The NTE equivalent is the NTE-287.)
  • A 1N5245 15 volt, 1/2 watt Zener diode.  This is located next to the MPSA42 transistor and is a small, (usually) red/orange glass device on axial leads.  In Figure 4, the "banded" end is the lower end.  (The NTE equivalent could be the NTE-5024A or its 1-watt version, the NTE-145A.)
The only critical things about the two transistors are the fact that they are NPN devices rated for at least 300 volts to withstand the normal transients found in a vehicle electrical system.  If you are unfamiliar with electronics I would suggest that you replace these with exact types which are readily available from Mouser Electronics or Digi-Key Electronics - or you can get cross-reference equivalents in the NTE family (noted above) from MCM Electronics or even find a local distributor that carries the NTE parts.

If you are familiar with electronic components:
  • The TIP48 may be replaced with about any NPN bipolar transistor found on the "mains" side of an AC-powered switching power supply - such as a dead computer supply.   Typically, these transistors  are rated for more than 400 volts and are in a TO-220 style case - often with a plastic or insulated tab - which really doesn't matter in this application.  Just make sure that it's rated for at least 300 volts and has the same pinout (B-C-E as viewed left-to-right with the leads facing down and the label facing you) as the original TIP48!  Chances are this transistor will have a number that begins with "2SC" (or just "C") followed by 4 digits:  Look up the device's data sheet online and verify that it is, in fact, a high-voltage NPN device.  The one that I happened to used came from a junked VCR, was rated for 500 volts and happened to have a plastic tab rather than the metal tab of the original device.
  • The MPSA42 is a high-voltage, low-power NPN transistor of the type typically used in video drivers for cathode-ray tubes on older TVs and suitable equivalents may be found on the small circuit board attached to the end of a CRT on a discarded television.  I happened to have some ZTX458 transistors - devices that had equal or better voltage/current specs than the original - laying around from another project and used one of them.  Just make sure that you take into account any differences in the pinout of the replacement transistor!
  • I didn't have a 1N5245 1/2 watt, 15 volt Zener around, but I did have a 1N4744 Zener which is a  somewhat beefier 1 watt version with the same voltage rating, so I used it.
Replacing the components: 

First:
  • Unless you are experienced in component replacement and circuit board repair, I would not suggest you do this procedure at all!
  • Use a temperature-controlled soldering iron.  Too little heat, you'll damage the board trying to get the components off.  Too much, you'll damage it that way, as well.
  • Do NOT use a soldering gun for this repair work:  If that's all that you have, you really should not try it as you'll likely ruin the board! 
  • Using your phone or camera, take some close-up pictures of both sides of the board before you start as a possible aid in reassembly.
  • You must have proper desoldering equipment.  A vacuum-operated desoldering tool is the ideal, but "Solder Wick" (tm) or even a spring-loaded "solder sucker" or "desolder bulb" will work.  If you don't have any of these it will be challenging to get the through-holes cleared to install the replacement components without tearing traces off the board. 
  • Both sides of the circuit board and most of the components are covered with a moisture resistant coating.  This coating is slightly rubbery and when soldered, it gets discolored.  Fortunately, you can "solder through" it although extra care should be taken to assure that the solder joints are clean and good.  When you are done soldering, you can clean the flux with alcohol and a cotton swab, but the discoloration will probably remain.  (If your solder uses water-based flux, make absolutely certain that you have removed it using clean water as many of these types of fluxes can slowly corrode connections.)
  • When removing the old components (the two transistors and the Zener diode) it may be easiest to just clip them from the board first using small, sharp diagonal-cut pliers.  This will remove the body of the device and allow each lead to be removed independently. 
Using "solder-wick" or a vacuum desoldering device, remove the two transistors and the Zener Diode, noting the original orientation of each device.  Make sure that you also clean out the holes through the board!

In my case, the heat of the original TIP48's destruction and its subsequent removal from the board actually damaged a trace so I had to repair it with a short piece of wire (I used #30 wire-wrap wire) on the bottom-side (that's the short green wire visible in Figure 3) but it's likely that your damage won't be that severe.

After inspecting for damaged traces, install the new components.  The notes above indicate which lead is which when replacing the two transistors and the diode.

Figure 5:
The newly-repaired speedometer.  It shows a speed because I was injecting a signal on the back to simulate input from a wheel sensor.
If you look carefully you might note that the 10th's of a mile digit on the LCD is missing part of its top half:  To fix it I had to take it apart again, clean the rubber pad ("zebra strip") the circuit board contacts and the LCD with some denatured alcohol and reassemble it to remove the mote of dust that prevented part of that particular digit from working properly.
Click on the image for a larger version.

Putting it back together:

As they say, "Assembly is the reverse of disassembly"!


A few comments:
  • When putting the LCD back in place, it may be a good idea to wipe down the top and bottom edges of the rubber strips with an alcohol-wetted cotton swab, and this should also be done for all surfaces of the LCD itself and the metal contacts on the circuit board.  Doing this will make sure that there aren't any dust particles, fibers or hair that may cause one or more of the LCD's segments to not work.
  • The two rubber strips for the LCD just sit in place, on edge, in the LCD mount and the LCD goes on top of it.  When mating the face of the speedometer back to the circuit board, make sure that you have re-installed the LCD right-side up and oriented properly (remember when you made note of the marks on the LCD?) so that you don't accidentally crush and break it when putting the speedometer face back into place.  Make sure that the four black screws are tightened firmly - but not so tight that you crack the plastic.
  • Before sealing everything up, carefully remove obvious fingerprints from the LCD (using a cotton swab) and the inside of the face plate as well as the speedometer. 
  • If you have a bench-type power supply capable of 12 volts at about 600 milliamps, you can do some preliminary testing of the speedometer by +12 volts to pin "A" and the ground to pin "B".  If all goes well, the lights will turn on and you'll see the odometer displaying numbers.  See below for a description if the pinout.
  • If you have applied power and everything looks OK, gently push the needle partway onto the spindle, aligning it with "0".  With the power applied, move the needle up scale (say, to 20-40 miles-per-hour) and watch it go back down to zero:  If it stops slightly off zero (it may take 10-15 seconds to settle when the unit is powered up) then pull the pointer off and re-align it, re-doing the above steps again until you get it to land on zero.
  • If you can't power up the speedometer, line the pointer up with zero and then move it up-scale to 20 or so.  After 5-10 minutes (yes, it may take that long to slowly move back!) look again to see where it is pointing:  If it isn't at zero, remove and re-align the pointer and try it again.
  • Once you are satisfied that the pointer is correct, firmly push it in on the spindle as far as you noted that it had been pushed before you'd removed it.  Move the needle up-scale by hand again and verify that it will (slowly) move down, indicating that it isn't binding anywhere.  If the pointer isn't pushed in far enough it can jam on the inside of the faceplate.
  • In the case you may have noted one or two small cylinders with granules inside them that are either still in place, or had previously fallen out and it was recommended that they be put in a sealed storage bag.  These are moisture absorbers and they sit in a slight recess one one side of the case.  It is recommended that these be reinstalled
  • When you put the speedometer module back into the case make sure that you move the needle out of the way when you pry up on edges of the speedometer face to reinstall the three screws.
  • Strongly recommended to maintain waterproofing:  Apply a thin layer of silicone grease to the gasket that goes between the body of the speedometer and the clear front plate, taking care not to get it on the face plate where you can see it.  (Just wipe the grease off if you do get it on the display or the back side of the clear cover.)  You may use silicone-based "Plumber's Grease" available at practically any hardware/home improvement store.  Do not use a petroleum-based grease for this!
  • When putting the face plate back on, remember to re-install the black push-rod that operates the button!
  • Test-fit the face plate to make sure that you pushed the needle on far enough and is not rubbing on the inside face plate. 
  • Slide the aluminum ring back into place.  With the speedometer face-down in a cloth (preferably a gap to accommodate the button on the front panel) use a piece of wood to re-crimp the aluminum ring to attach the face plate to the body.  You'll probably have to go around the perimeter several times to get it tight.
  • Squirt a dab of silicone grease (but not silicone seal!) this in each of the electrical connectors on the back side:  This will help prevent ingress of moisture as well as prevent possible corrosion of the electrical connectors.  Again, "Plumber's Grease" or the sort used to lubricate "O" rings is this same sort of grease and will work fine and this is available anywhere you can buy plumbing supplies and parts - including big-box home-improvement stores like "Lowes-Depot."  Remember:  It is not recommended that one use "normal" petroleum grease (e.g. axle grease, Vaseline (tm)) as this will degrade the plastic and connectors!

Comments about pin-out and testing:

Note:  If you do an internet search, you should be able to locate some online drawings showing the pinouts of the speedometer's connectors.  If you do this testing, you would do so before reinstalling it in the case.

With the speedometer facing down, orient it so that the 6 pins of the larger connector are toward the top running horizontally and that the 3 pins of the smaller connector (the one for the wheel sensor) is to the right of it with its pins running vertically.

For the large connector, pin "A" is on the left and they are designated on available drawings as A-F, left-to-right.  For the 3-pin connector they are A-C starting from the top and working down.

Applying voltage to these pins using a regulated, current-limited power supply set to 12-15 volts at a maximum current of 600 milliamps to 1 amp, you should be able to power up the speedometer.
  • Do NOT power the speedometer being tested directly from a battery as that could supply virtually unlimited current in the event of an accidental short or fault.
  • DO NOT connect the polarity backwards - even for an instant.
  • If your current-limited power supply "sees" a dead short, remove power immediately and check for solder bridges around the components that were replaced.

If it works, the lights should come on and if you move the speedometer needle with your finger, up-scale, it should reset itself to zero much more quickly than it had with the power off.  An additional test is that if you increase the voltage above 14-15 volts (but not above 20 volts!) the lights will not get any brighter - a sure sign that the regulator is now working properly.  If you do this, now is the time to double-check that the needle points at zero.

If you are curious, you can apply a square wave signal from an audio generator (3-5 volts RMS) between pins B and C of the 3-pin connector and vary it from about 5 Hz to 200 Hz and you should see the speedometer go up with increasing frequency as you simulate, with your audio generator or "function generator", the input from the wheel sensor.  Pin "C" is ground while pin "B" is the signal input.  The unit must be powered up in order for the speedometer - and odometer, for that matter - to indicate.  If you do not have a piece of test equipment to generate such a signal, a "555" timer chip may be wired up (with the appropriate components) to generate a variable frequency square wave train.

Final words:

If all goes well, your speedometer, 4-wheel drive switch, "reverse override" button and odometer will now work properly again!

Note that there's no guarantee that it will be as waterproof as it was before since you probably lack the special machine required to properly crimp that aluminum ring down so it's probably best to keep it out of rain as much as possible - a good practice, anyway!


Comment:  I occasionally get asked a question via this blog's comment tool.  Unless you include a return email address, you'll have to check back here to see if I've answered it as I won't be able to reply any other way.

Update:
As of October, 2015 August 2016 October 2017 November 2018 the repaired speedometer is still working fine.

Repairing the Surface-Mount version of the Speedometer

One of the readers (Mathias) was inspired by this blog entry and decided to attempt a repair of the newer surface-mount version of this same speedometer.  It is not known, exactly, over which model numbers and years this speedometer was in use (or if it still is!)

What follows below details the repair of a unit from a 2000 Polaris Sportsman 335.  Again, unless you are familiar with work on small electronic components and have the appropriate tools to do so, please seek out someone who does have the the familiarity/tools before attempting a repair!  You have been warned!

Figure 6
 Used by permission of Mathias, this is a photograph of the surface-mount version found in a 2000 Polaris Sportsman 335.  It is believed to be (more or less) the same circuitry as that shown in figure 4, above - but using more surface-mount components.
The thread of the related conversation - including a reference to the picture above - may be found in the comments below:  Look for those related to user "Mathias999us".
Click on the image for a larger version.
Figure 6, above, shows the surface-mount version that seems to suffer the same fate when the unit is run without a battery to moderate the voltage.  The above drawing is annotated with some clarifications added below:
  • TIP48 - This is the same power transistor (through-hole) as used in the older version.
  • "SMD marked 1Dt" - This is the same function as the MPSA42 used in the older version, except surface mount.  The case marking of "1Dt" (assuming that the writing was deciphered correctly) is a bit ambiguous, but it refers to an NPN transistor.  It is believed to be a BC846 transistor - a general-purposes NPN device that is rated for 65 volts.
    • It should be noted that the MPSA42 is available in the same SMD footprint as the above and is known as the "PMBTA42".  This may be a better choice than the BC846 in terms of being able to handle voltage spikes, should the Polaris be operated without a battery.
  • "Unidentified diode" - There are two of these:
    • The large one appears to be just a standard diode.  If open/shorted, the surface-mount version of the 1N4003 (through 1N4007) should be fine.
    • The small one is likely a surface-mount version of the Zener diode called out above - namely a 15 volt unit.
  • Capacitors:  These aren't marked in Figure 6, but they are the large, metal cans next to the TIP42.
    • These are often damaged by the heat and voltage when the speedometer is run without a battery.
    • If one/both of these capacitors look at all bulged or swollen, if it looks like their plastic labels have shrunk and split and/or if there is some sort of liquid coming out of them - either from the seam on the top or at the circuit board - they MUST be replaced!  
    • These are reportedly 470uF, 25 volt capacitors.
    • Before removing them note which end of the capacitors are marked with the minus sign so that the new ones may be installed correctly.


[End]

This page stolen from ka7oei.blogspot.com