Tuesday, 13 October 2015

Tektronix 453 High Voltage

Filed under: Uncategorized — Michael @ 14:21

A while back I acquired a Tektronix 453 oscilloscope. It functioned just fine and was in quite good condition. A little cleanup and it joined my test equipment roster.

Tek453-FrontPanel

Recently, however, it developed a problem somewhere in the high voltage supply. When I turned it on, it made a sizzling sound and the display was compressed and very bright. I removed the cover over the high voltage box and saw that on power up, one of the 5642 rectifier tubes was internally arcing. (Thinking back, there was probably arcing elsewhere but I didn’t want to leave it on long enough to poke around!)
‘Aha, bad tube’, I thought. I found a couple of NOS Sylvania tubes on eBay and a few days later, the ‘scope seemed to be running fine again. Then, a couple of weeks later, the same sizzling sound. Again, a look at the high voltage box and there was arcing deep inside. On the suggestion of a couple of people on the Yahoo TekScopes group, I opened up the high voltage box and cleaned it out with IPA and put it back together. Again, the problem seemed to be fixed. But a fews days later, it was back.

Here is the high voltage box with covers off, looking at the bottom (remember, the box is ‘upside down’ in the bottom of the ‘scope).
Tek453-HV-Orig

I unsoldered the anode lead and lifted the high voltage ‘chassis’ from the plastic box so I could see the top. (Once the anode lead is free, you can gently lift the chassis out, pivoting it toward the back of the ‘scope, hinging on the row of wires at the back. I had done this before when I cleaned the inside of the box. This image is from later in the disassembly, but helps to show what I mean.)
Tek453-HV-Chassis

I switched the power on and the arcing appeared across the neon lamps and the string of 5.6 MegOhm resistors. I quickly switched it off. I suspected the grid bias section. If it fails, the voltage from the cathode supply could find its way across these components. Actually, just a guess. Whatever the problem, though, it was going to mean a pretty major disassembly to get at all of the parts for testing. So, as long as I was going inside, I figured I would just rebuild the whole high voltage box.

Here is the schematic of the high voltage power section. The color highlighting indicates the component location on the chassis.
Tek453-HV-Schematic

First the search for parts. I assumed that the transformer was OK, partly because the ‘scope had worked between reoccurrences of the problem and mostly because I couldn’t find one. The two high voltage diodes, Tek 152-0192-00, I found as NOS at Vernonia Northern. (Last I checked, they didn’t have any more. But they do have a ton of other Tek parts.) The high voltage ceramic capacitors and neon lamps were purchased at Mouser. The grid bias potentiometer and a few resistor values that I didn’t have came from TME. (For a complete list of the parts I used, you can view or download this PDF Tek453-HV-PartsList.pdf.) Once I had all of the parts on-hand I took a deep breath and started.

Update:
A note about the resistors. I used what I had on hand which are Yageo MF0207 series metal film, 0.6W resistors. They have a maximum working voltage of 350 V. This is actually too low for many of resistors used in the circuit. For example, in the series of five 5.6 MegOhm resistors in the grid bias circuit, each resistor has ~400 V across it. The parts I used do work but likely have a compromised lifetime. You can use 1 Watt parts which have a working voltage of 500 V or use more resistors of smaller values for the critical resistor series (grid bias and focus circuits).

I took plenty of pictures to document parts placement and wiring. The chassis has components on three layers, a separate piece at the top (held on with a Nylon screw) where the resistor strings are mounted (blue highlight on the schematic, above), the middle layer with the grid bias supply and part of the anode supply (washed out red on the schematic) and the bottom (the layer you see when you take the cover off) has the cathode supply and the 5642 tubes, and a capacitor, for the anode (orange highlight). The layers are interconnected and the whole circuit connected to the outside with numerous color-coded wires. The pictures will help when reassembling.
Tek453-HV-Wiring

I only un-soldered wires as necessary. One note, the ceramic wiring blocks require a fair amount of heat and good heat transfer to get the solder to flow. I used a tip temperature of 350 and a smallish chisel tip to get into the slot. Keep your tip well tinned and use a solder that contains some silver so as not to ruin the metal-to-ceramic plating. For getting the old solder out of the slot, desoldering braid came in handy and in a few places I was able to use a vacuum desoldering iron (heating the slot with my iron at the same time).

Here is the top level, before and after.
Tek453-HV-B-Orig
Tek453-HV-B-Wired

This is the middle level.
Tek453-HV-M-Orig
Tek453-HV-M-Wired

A closeup of the anode supply capacitor placement.
Tek453-HV-M-Anode

And, finally, the bottom level, rewired.
Tek453-HV-Wired

The time finally came to power up the ‘scope. I held my breath and flipped the switch. Whew!, no magic smoke, no sizzling. So far, so good. A few seconds later and the trace moved into position on the CRT. Everything looked perfect. Even the focus was good. Twiddling the intensity control worked and it was obvious that the display was capable of higher intensity than before. The focus control worked as expected. All good indications that the high voltages were there and correct. I grabbed the high voltage probe and the -1950 V test point measured -1945. The anode voltage was 7750. Practically perfect. It appears that the rebuild was a total success.

So, what was the problem? As I mentioned back at the start, I suspected the fault was in the grid bias supply section. I measured all the components once I had removed them and they all tested OK. Until I came to the CRT grid bias adjustment potentiometer. It first measured open. When I tried to turn the shaft it pulled out from the pot. But the meter now showed a reasonable resistance value. The potentiometer wiper was intermittent at best. The potentiometer is wired as a variable resistor, just the wiper and one end are connected. So, an intermittent wiper would open that circuit. I am going with the assumption that that was the problem. (Of course, if that was the only problem, I replaced a lot of stuff when only two solder connections would have been necessary. But then again, I likely wouldn’t have found this without quite a bit of disassembly. Oh well.)

I’m really glad to have my 453 back in working condition. Aside from working again, the rebuild had additional payoffs. With everything new, the trace appears faster and settles down quickly. And it doesn’t grow dimmer for the first few minutes like before. Though not simple or easy, the rebuild went well. If you decide to do this, I suggest getting familiar with the circuits and to take your time. It took me a number of sessions working a couple of hours at a time. Document as you go! Don’t assume you’ll remember which wire went where or which wiring block slot this or that part was mounted to.

Thanks for reading! Feel free to post a comment with your experiences or any questions. (Comments are moderated, so it might be a few hours before they appear.)

Also, I have a set of parts for sale. This includes the high voltage ceramic capacitors, the three NE-2V (A2B) neon lamps and the grid bias control potentiometer (I always order extras, just in case). All for 30€ including post (Europe only!) If anyone is interested, let me know.

Acknowledgment:
I posted a link to this post on the Yahoo TekScopes group. A number of people have responded and I want thank you all for your interest and comments. They are much appreciated.

Friday, 25 July 2014

The Belfry is soon to be a basement

Filed under: Uncategorized — Michael @ 0:26

The last few weeks have been a pretty busy time! The Belfry has moved. For some many years now, my electronics room (as well as Blackcat’s and my residence) was in the upper floor of an old house. Now, we’ve relocated to a house of our own. We’re really happy to have found this place as it’s in the same neighborhood, literally just around the corner, so we can stay in close contact with our friends here.
The move means that I must rebuild my hobby lab, this time in the basement. It is a great big space and I am sure it will be even better than what I had. But it will take some time to get everything set up. Then there’s a lot I want to do. I have a number of projects on hold. I’ve got the design for an upgrade kit for the Fluke 8050A LCD display to finish. And I have a couple of recent oscilloscope acquisitions to restore, a Tektronix 453 and a 465.
Even though it’s no longer a Belfry, there are still bats flitting about outside in the evening. So, I’ll keep the name the same.
Thanks for reading.

Thursday, 1 May 2014

Tektronix 2225 Repair

Filed under: Uncategorized — Michael @ 16:24

Among my various pieces of old test gear is a Tektronix 2225 oscilloscope. This is a very capable 2-channel, 50MHz scope from the late ’80s. I bought this off eBay some years ago and was pleased that it was in near perfect working order. The only problem was that the exterior was quite dirty and the front panel potentiometers were very noisy. After a good clean, it looked good but the pots were still a problem. Even so, I use it regularly and always thought I would get around to pulling the front panel board someday and give it a good alcohol bath. Then, a couple of weeks back, I stumbled across a web-shop that sells old Tek parts. And they had a front panel board for the 2225! The shop is www.qservice.tv and they have tons of stuff for all kinds of old gear, not just Tek. The price was very reasonable so I ordered the board and received it within a couple of days. And they even guarantee it for a month!
Now, with a ‘new’ front panel board in hand, I got down to the repair. Following the instructions in the service manual, it went smoothly. It required removing the attenuator board and then the front panel board. Here’s a shot of the ’empty’ scope.
IMG_0001

Here is the stuff that came out. That’s the attenuator board on the left.
IMG_0002

One thing that required some effort was transferring the seven ribbon cables from the old board to the new one. (A recently acquired vacuum desoldering station was a big help.)
IMG_0003

Once the boards were back in, there was a small amount of re-wiring. Since the AC-GND-DC switch on the front panel board is ‘between’ the BNC connector and the attenuator there’s a few resistors that needed to be soldered in place and ground wires reconnected. The resistors are standard values and I just replaced them with new ones.
IMG_0004

Here it is all back together.
IMG_0005

And, it works! Even though the ‘new’ board was removed from another scope, it’s a huge improvement over the original controls and was well worth the cost of the board and effort to install it.
Long live the 2225!

Wednesday, 2 April 2014

A new graphic display for a Fluke 8050A multimeter

Filed under: Uncategorized — Michael @ 17:47

In a previous post, I described my take on a new LED display for a Fluke 8050A digital multimeter. While gathering information about that project, I ran across a really fine upgrade at Ken’s Electronic Projects, Fluke8050A Hi Res Display, using an LCD graphic display. Well, I have since picked up another Fluke 8050A and, with Ken’s work as inspiration, this time I thought I would give it a new graphic display.

More than just 5 digits

The Fluke 8050A is really quite a capable instrument. It measures not just voltage, current and resistance but also decibels (at various reference impedances) and conductance. And it has a relative mode. Unfortunately, there’s only a little symbol for REL and dB, so you have no visual indication of the relative offset or the dB reference impedance or even what unit you’re measuring. So, I went into this with the goal to display these bits of information as well the value being measured. Another goal was to leave the Fluke meter completely unmodified. I think I achieved these goals pretty well. I’ll let the photos tell most of the story.

Pictures tell the story

Here is the meter in simple voltage mode. The background is dark green and the digits are white. (I still need to come up with something to hide the edges of the display.)
IMG_0001

This shows the meter in relative mode. The relative offset voltage is displayed at the bottom. For all of the unit indicators and relative values, I used color-coding that follows from the Fluke panel colors. V is light green, A is light red, Ω is yellow, S is grey, dB is light blue and Z is a darker blue. (It’s subtle and doesn’t show up that well in some pictures.)
IMG_0002

This is in dB mode. The reference impedance is also displayed.
IMG_0004

Of course, dB works in relative mode as well.
IMG_0005

This shows the low-battery indicator. It is actually in red. By the way, the line under the main display turns red when the Fluke sets the high-voltage indicator.
IMG_0009

Construction

The 8050A is not modified in any way with one small exception (I’ll point that out when we get to it). The LCD display module is removed intact. All of the signals needed (except one) are available at the microcontroller in the Fluke.
In order to not have to solder anything to the meter, I built this little piggyback carrier to bring out the Fluke’s microcontroller pins.
IMG_0018

IMG_0019

For the extended processing I used an Atmega32u4 breakout board from Adafruit. (I removed the two LEDs from the board. First, because there’s no need to light up the inside of the meter. Second, and more importantly, I needed the PE6 pin as an interrupt and not as a communication monitor.)
IMG_0023

The breakout board is mounted to a bit of perf-board with pins to match the sockets on the piggyback board. There’s an 8-pin connector to the display and the low battery sense. Yes, that is actually wire-wrap.
IMG_0025

The display is also from Adafruit, their 2.2″ TFT LCD display. As Ken mentions in his article, the breakout board for the display is too big for the opening in the meter. I carefully made the board the same size as the display. I glued a connector to the back of the board after wiring it to the appropriate locations. (The breakout board supplies 5V/3.3V level-shifting and a 3.3V regulator for the display power.) Also, the SD card reader was removed. The CS signal is hard-wired to ground on the LCD board. The backlight PWM control pin is not used and neither, of course, is the SD card CS pin. This leaves just 5 lines RST, DC, MOSI, MISO (not really needed) and SCK in addition to GND and 5V. These seven wires, together with the low battery signal, plug into the 8-pin header on the piggyback board.

IMG_0012

The display is mounted to a bracket that fits the screw mounts for the main circuit board. (This is not the final bracket. I needed to move the display farther forward to avoid having to trim the Fluke display board.)
IMG_0015

Here it is all together. Well, almost.
IMG_0026

As I mentioned, the Fluke is unmodified. That is, except for the addition of one header pin soldered to the display board. My unit has the battery option and the low battery signal is generated on the display board. Fortunately, there is a via in the routing of this signal to the original display driver chip. You can see the pin in the picture above between U14 and U15. The black wire from the piggyback board attaches there.

Software

I am still fine tuning the software and will post it here shortly. I may make a few changes to the font and symbol bitmaps, as well. If you can’t wait, add a comment and I’ll get back to you.
I have been using the meter with the new display for a little while now and feel pretty confident that the software is in order.

You can download the project files here (last updated 7. August 2015).

Unzip the file somewhere. Move the Modified_Adafruit_ILI9340 folder to your Arduino libraries folder. This is the Adafruit_ILI9340 display library but stripped down to just what is needed. I did this for size and speed. The Arduino sketch folder is named TFT_8050A. Just move this entire folder to your Arduino directory. The folder contains the .ino file and the header files that define the character and symbol bitmaps used.
Be sure to select the Arduino Leonardo board in the Arduino environment if you are compiling the sketch there.
At some point, I’ll get a description of the code here. If you have any questions, you can post a comment or send me an e-mail (the address is in the .ino file).

Conclusion

This is just intended as a better-than-original display replacement. The Fluke is a solid measurement front-end and with a bit more effort you could extend it, using added computation, even further. You could display a graph showing trends, for example. With USB support (the Atmega32u4 has it) you could provide logging. I have no need for these things and I’ve wasted, uh, invested enough time in this already. As good as it is, the 8050A is old-school, with big, physical switches, no auto-ranging, etc. Still, it does the job and this one is now back in service, maybe for another 30 years.
Thanks for your interest. Your comments are welcome.

UPDATE: 05. Feb. 2017
Thank you all very much for your interest in this project! Some of you have asked if a schematic is available and a couple have inquired about a kit. (I am sorry that for many of you, this update is rather late.) In fact I did look into developing an upgrade kit but thought it would be too expensive to really make it worthwhile. I figured it would cost upwards of $60 and that was with little or no profit. Oh well.
Anyway, at that time I did create a schematic (no PC layout, though!) but kind of resisted posting it. It does not exactly represent the project described in the post (uses ‘raw’ parts and not breakout boards). And I thought it was best to derive a schematic from the pin assignments in the code.
But anyway, here goes. This is the latest version of the schematic I could find.

I’m pretty sure that this is correct but I can’t make any guarantees. I think I used the same pin assignments as in the code. If not, change either the schematic or code to conform.
Again, thank you all for your interest. It pleases me greatly that this project and my LED upgrade have inspired people all over the globe. Just to let you know, my meters are still going strong and get used regularly. I hope yours are too!
And if one of you ever does develop this into an upgrade kit, let me know. I have a couple more 8050As myself!

Friday, 14 March 2014

A Calibration Standard and Accuracy vs. Resolution

Filed under: Uncategorized — Michael @ 1:13

From my previous post you know that I have a Fluke 8050A digital multimeter (DMM). I also have a couple of other bench meters, an HP 34703A/34750A and a Philips PM2422A, as well as a BK Precision 2709B handheld DMM.

I have been giving some thought as to how I can keep these instruments adjusted to some kind of reasonable accuracy. Except for the BK Precision meter, all of these measurement tools are pretty old (the HP and the Philips are 40!). So, are they accurate? Comparing them with the BK (my newest) shows that the Fluke is in good agreement but the the HP is “out”. So, do I calibrate everything to the BK? (I did just that with the Philips.) Better would be to have some kind of standard, so I built one. I’ll get into the details in a moment. But first some observations about accuracy and resolution.

The Fluke 8050A is a 20000 count meter. The count indicates the display resolution. Here, 20000 means that the meter can display any number from 0 to 19999. That number can indicate 0 to 1.9999 Volts or 0 to 199.99 Volts, or Ohms or milliAmps, whatever, depending on the meter setting. The HP 34703A/34750A meter has 200000 counts (pretty high resolution), the Philips PM2422A has 2000 counts (not that much resolution but it has a Nixie tube display which is cool) and the BK Precision 2709B has 6600 counts (yes, it can display from 0 to 6599). If the Fluke is in it’s 20kOhm range, the least significant digit is showing 1 Ohm. The HP in the same range displays to a tenth of an ohm, ten times more resolution.

But resolution is not the same as accuracy. The Fluke meter has a stated accuracy (for the 20 V range) of +/- .03% + 2 counts. That means that exactly 10 volts could be displayed as anything from 9.995 [(10 – .03% = 9.997) – 2 counts] to 10.005 [(10 + .03% = 10.003) + 2 counts]. So that last digit is really kind of an “about” indicator. The HP has ten times the resolution so it is also ten times more accurate, right? Well, wrong. The stated accuracy of the HP in its 10 V range (0-19.9999 volts) is +/- .04% + 10 counts. That means that the HP could display exactly 10 volts as 9.9950 to 10.0050. The same as the Fluke. Actually, this level of accuracy is quite good. For the Philips it’s +/- .1% + 2 counts and for the BK Precision, +/- .5% + 2 counts. For most of my work, absolute accuracy is not that important. But if the meter is too far out of specification I might be putting more (or less) voltage into my circuit than I want. So, maybe absolute accuracy is not so important a but a reasonable level of accuracy is.

Back to resolution. So, what good is that HP with more digits than its accuracy needs? Sometimes, a high resolution measurement can be pretty useful (even if the accuracy is poor). As an example, let’s say I need a voltage divider based on two matched resistors with a value of 10000 (10k) Ohms. In most cases the actual value is not that critical. If the resistors are 9000 or 11000 (+/- 10%), that would be fine. But they must be the same value or as close as I can get them. Then resolution is a nice thing to have. I may need to measure a lot of resistors to find two that match to the resolution of the 200000 count HP meter (which is a resolution of .1 Ohm for a 10k resistor!) but the matching would be be very good.

Another aspect of measurement is repeatability. This means that when I measure something and get a certain value, I should get the same value if I measure it again. Repeatability (and accuracy) depends on a lot of factors, such as good measurement practices and things like temperature, etc., but I won’t be getting into that here.

A voltage reference

A reasonable level of accuracy is important and that leads to the main point of this post. How can I adjust my meters so that I can have a reasonable level of confidence that the values they report are correct? I could send one of the meters to a calibration service and then use that to adjust the others, but that is expensive, costing more than I paid for the thing in the first place. And as I said, absolute accuracy is, at least for me, not that important. So, I decided to build a simple standard based on the Maxim MAX6350 precision voltage regulator. This is a 5 Volt regulator with an initial tolerance of .02%. This is only slightly better than the accuracy of the Fluke or HP, so not good enough to calibrate these meters to the accuracy they are capable of (a standard should be at least a factor of ten more accurate than the meter to be calibrated). But good enough for my purposes. The Maxim datasheet for the device shows a circuit using an opamp voltage inverter to provide + and – 5 Volt regulated outputs. That can also be used as a single 10 Volt regulated output accurate to pretty close to .02%. That is what I built. The power is supplied by two 9 Volt batteries. I used an OPA2134 dual op amp from my parts bin, one half for the voltage inverter and the other half as a comparator to warn when the (positive-side) battery voltage falls below 8 Volts (the minimum input voltage for the regulator according to the datasheet).

One more point regarding accuracy versus resolution. Consider the adjustment of the voltage inverter. It doesn’t need an accurate meter at all. Just adjust the inverter output to be the same as the reference output to the best resolution possible.

Sunday, 25 August 2013

A new LED display for a Fluke 8050A multimeter

Filed under: Uncategorized — Michael @ 22:38

Keeping old test equipment alive is not just fun, it is how I can support my electronics hobby with good gear on the cheap. Most of the equipment on my bench is over 25 years old. One piece of equipment that sees a lot of use is a Fluke 8050A multimeter.

The Fluke 8050A multimeter was made in the early 1980’s and was a popular instrument so a lot of them are still around. The meter uses an LCD display and it is this display that has proved to be the weak point. Many otherwise functional meters are unuseable because the LCD has gone black or is unresponsive. A few people have rescued their meters by replacing the LCD with an LED display. The results are good, looking even better than the original LCD. My 8050A is still working but the LCD is showing its age and has very low contrast. I thought an LED replacement was in order so here is my take on an LED upgrade for the 8050A.

8050A with LED display

The approaches I’ve seen involve wiring the individual LED segments directly to the LCD driver chips. (For example here and here.) This has the advantage of few additional active components. The main disadvantage is that there is a lot of wiring to the 8050A, soldering directly to the IC pins with a current-limiting resistor for every segment. Also, since the LCD drivers can only sink a couple of milliamps this limits the display brightness (but since the display is not multiplexed, in the upgrades I’ve seen this doesn’t seem to be a problem).

My approach differs from the others by using a microcontroller (ATmega328P, I used an Arduino UNO for development) and LED driver (MAX7219) to decode the display drive information from the 8050A (just 11 lines) and multiplex the LEDs. This description focuses mainly on the software, the Arduino sketch, and not so much on the hardware. In my prototype, I used what I had on-hand. It’s all through-hole parts on perfboard. I am sure that a PC board with surface mount components based on this circuit or a similar approach could result in an almost drop-in replacement for the LCD. If there is any interest and/or you would like to help with this, let me know.

The Project Code

You can download the Arduino project here. There are two sketches, LED_8050A, which is described below, and an 8050A emulator, Strobe_8050A, that generates strobe and data signals for testing.

Inside the Fluke 8050A

The Fluke 8050A drives the LCD display using multiplexed (strobed) data from a 3870 microcontroller. There are five strobe lines and six data lines. These lines are all available at connector J1 on the display board. Also, power for the LCD is supplied (system ground and -5V) and there’s a voltage reference for the low battery indicator (not used in my meter).

8050A display board J1

The following table lists the applicable connector pin numbers. (In the image, pin 1 is in the upper-right corner in the box.)

J1 Pin Strobe/Data Line
2 GND
3 -5V
6 batt Vref
10 ST4
11 ST3
12 ST2
13 ST1
14 Z
15 Y
16 X
17 W
18 ST0
20 HV
21 DP

The lines ST0-4 are the five strobe lines. The W, X, Y and Z lines carry BCD number data, W is the most-significant-bit, and the DP and HV lines are for the decimal points and high voltage indicator.

The LCD digit segments and indicators are driven by seven LCD driver ICs, type 4054 and 4056, that decode and latch the strobed data. The 4054/4055/4056 datasheet indicates that the data is latched on the strobe falling edge. The strobe timing, as measured in my 8050A, is as follows.

8050A display strobe timing

Pin Change Interrupts

The five strobes are handled by pin change interrupts on the Arduino. A little background. (Refer to the ATmega328 datasheet for more detailed information.) To specify the interrupt pin (or pins) to listen to, you have to set which of three banks of pins and the pin(s) in that bank. A separate ISR (interrupt service routine, i.e., the code you want to run when an interrupt occurs) can be set for each bank. It breaks down like this.

ATmega328 Bank Name ATMega328 Pin Names Arduino UNO Pins
PCIE0 PCINT0-7 8-13 (14,15 not available)
PCIE1 PCINT8-14 (15 not used) A0-5 (6,7 not available)
PCIE2 PCINT16-23 0-7

You specify the banks you want to listen on for interrupts using the ATmega328 register PCICR. The bank name in the table is actually the name of a bit in that register. So, in your code you would enable pin change interrupts for Arduino pins A0-A5 by setting the PCIE1 bit in the PCICR register. For example.

PCICR = _BV( PCIE1 );

(The macro _BV(bit) converts a bit number to a byte value with the corresponding bit set. It is implemented as (1<<(bit)). The Arduino language also has bit manipulation functions such as
bitSet(), bit(), etc.)

Once you have enabled a bank of pins for pin change interrupts, you need to tell the ATmega which pins in the bank to actually listen to. (You can listen to one or to multiple pins.) There are three registers for this, one for each bank, named PCMSK0, PCMSK1 and PCMSK2. In my code, I’m using bank 1 (PCIE1, Arduino pins A0-A5) so I need to set the appropriate bits in PCMSK1. I’m using the pin change interrupts to trigger a read of the data lines for each strobe. So, I need to listen to each strobe line sequentially. I initialize the PCMSK1 register with the bit corresponding to the pin assigned to ST0 (strobe 0). In the code, ST0 is on Arduino pin A0 which is the bit position PCINT8.

PCMSK1 = _BV( PCINT8 );

The Interrupt Service Routine (ISR)

The operation is simple. The ISR is triggered by a change on the specified pin for the current strobe number (held in the variable st). An interrupt is generated for any change on the pin. We’re interested in the falling edge, so a quick test. The scancode lines are read into a two-dimensional array, strobes by scancodes. In order to sample the data for each strobe line, the ISR switches to the next strobe (or wraps around back to ST0) after reading the data. Once all five strobes have been read, the updateDisplay flag is set. This causes the displayUpdate() function, which is called in the loop(), to format the display digits and write them to the LED driver. The displayUpdate() function then clears the updateDisplay flag. There’s plenty of time to update the display between the five strobes so, the formatting is pretty straight ahead.

Here is the ISR code.

// pin change interrupt service routine
// - reads the scancode values from the 8050A
// - sets the displayUpdate flag when all strobes are read
ISR( STROBE_INTERRUPT_VECTOR )
{
  if ( digitalRead( StrobePins[ st ] ) == LOW )
  {
    // that was a falling transition
    // (In the 4054/55/56 LCD drivers datasheet, it shows
    // the data being latched on the strobe falling edge.)
    // now, read the scan code values
    for ( uint8_t i = SC0; i < NUM_SCANCODES; i++ )
    {
      scanCodes[ st ][ i ] = digitalRead( ScanCodePins[ i ] );
    }
    // next time, next strobe
    st++;
    if ( st >= NUM_STROBES )
    {
      // scancodes for all strobes are read
      st = ST0; // reset strobe counter
      // now is the time to update the display
      displayUpdate = true;
    }
    // enable the appropriate strobe pin
    PCMSK0 = StrobePin2PCINT[ st ];
  }
}

The pins for the scancodes are in the array ScanCodePins[] and the pins (the PCINTn values) corresponding to the 8050A strobe lines are held in the array Strobe2PCINT[]. This allows for flexible pin assignments, but the strobe pins must all be in the same PCIEn/PCMSKn bank.

Before anyone says "hey, you can use port reads for the scancodes and store the results in a single byte." Well, I wrote a version that did that and it really didn’t save any time or space. And since there is plenty of both (the ISR runs in less than 90 microseconds with an 8MHz clock and the whole sketch is a little more than 1800 bytes), I figured that making the code a little easier to understand and allowing for more flexible pin assignments was more important than a few microseconds or bytes.

Driving the MAX7219 LED Driver

A quick look at the MAX7219 LED driver and the code to talk to it. (Refer to the datasheet for more detailed information.) The device is capable of scanning up to eight 7-segment LEDs plus decimal points. We’ll use six. The segment decode can be set for Code B, regular 7-segment numbers from BCD (binary coded decimal), or no decode for individual segment control. I chose to call digit 0 the most significant. The sketch uses digits 0 and 5 in no-decode mode and digits 1-4 in Code B (BCD) mode. The LED brightness is determined by setting the internal current source with a resistor and can also be changed with PWM. All of these things are programmed by writing to various registers.

When powered up, the MAX7219 initializes to a minimalist state and enters shutdown mode. It only scans one digit, it doesn’t do any decode and the PWM brightness is at minimum. So, we need to set these things for our use and bring it out of shutdown mode in the Arduino setup() function.

void setup()
{
  . . . 
  // initialize MAX7219 registers
  writeRegister( REGISTER_SCAN_LIMIT, REGISTER_DATA_SCAN_LIMIT );
  writeRegister( REGISTER_DECODE_MODE, REGISTER_DATA_DECODE_MODE );
  writeRegister( REGISTER_INTENSITY, REGISTER_DATA_INTENSITY );
  // load initial digit data
  writeDigits();
  // turn on the display
  writeRegister( REGISTER_SHUTDOWN, 0x01 );
  . . . 
}

The 7219 registers are sixteen bits with the high-order byte the register address and the low-order the register data. Writing the registers is straightforward using a three-wire protocol. Here is the writeRegister() function.

void writeRegister( uint8_t regAddr, uint8_t data ) {
  // combine the address and data to a 16-bit value
  uint16_t reg = regAddr;
  reg <<= 8;
  reg += data;
  uint16_t mask = 0x8000;
  // (from the datasheet)
  // For the MAX7219, serial data at DIN, sent in 16-bit packets,
  // is shifted into the internal 16-bit shift register with each
  // rising edge of CLK regardless of the state of LOAD. The data
  // is then latched...on the rising edge of LOAD.
  digitalWrite( PIN_LOAD, LOW );
  while ( mask )
  {
    digitalWrite( PIN_CLK, LOW );
    digitalWrite( PIN_DIN, reg & mask ? HIGH : LOW );
      // The test to HIGH/LOW is needed because reg is 16-bit
      // and function expects (truncates to) 8-bit. 
    digitalWrite( PIN_CLK, HIGH );
    mask >>= 1;
  }
  digitalWrite( PIN_LOAD, HIGH );
}

Testing

To test the circuit, I also wrote an emulator to send 8050A signals to the display breadboard. It is a very simple Arduino sketch that loops the strobes and takes user input to send the appropriate scancodes.

Hardware notes

The display in the 8050A is 4-1/2 digits with indicators for dB (decibel mode), HV (high voltage warning), REL (relative mode) and BT (low battery indicator for battery equipped meters, mine is not). I used six green 7-segment LEDs. Digit 0, the MSD, is the minus sign and numeral 1, digits 1-4 display 0-9 and digit 5 uses the a, g and d segments for db, HV and REL, respectively. (You could use the a segment of digit 0 for the BT indicator.) This mimics the original 8050A display. The LEDs are wired on a small bit of perfboard and the two ICs, with a 14-pin header and bypass capacitors on another bit of board that is affixed behind the LED board. This two-board package fills the space that was occupied by the original LCD and its plastic housing. I used a bit of green plastic fitted to the original display frame piece. Except for the 14-conductor ribbon cable soldered to the J1 vias, the 8050A is not modified in any way.

Thursday, 26 July 2012

Sous Vide cooker with Arduino

Filed under: Uncategorized — Michael @ 15:28

A while back I came across Sous Vide cooking. (I also occasionally cook, among my other interests.) Sous Vide is French for “under vacuum” and refers to a style of cooking where the food is sealed in a bag and cooked at a controlled temperature in a water bath. I tried a couple of experiments using a pot of water on the stove with me as the temperature controller, switching the stove on/off while watching a thermometer. The results were certainly worthwhile and prompted me to explore the possibility of building a temperature controller using the Arduino, a very capable micro-controller hardware/software platform, and a hot plate. A search of the inter-tubes quickly showed that I was not alone and that many had traveled this or a similar road. (One reason for DIY is the relatively high cost of commercial Sous Vide appliances. At least in my case it was. And besides, hacking something together would be fun.) Most of the existing DIY attempts were either pretty crude or too sophisticated for me (and my budget). And I’m kind of a re-invent the wheel sort, anyway.
I figured a good first place to start would be to get a sketch going that would read the temperature. (‘Sketch’ is an application program in Arduino-speak.) The result is the library I described in the last post.
I knew I wanted the end result to be stand-alone and that meant some kind of user interface. The great folks at Adafruit had just introduced their LCD Shield with a 16×2 display and input buttons. I ordered one and started work on a display/menu system. Soon, I was able to set the desired temperature and display the actual vs. goal temperatures. It was easy enough, then, to send a control signal, based on the water temperature difference, to the hot plate.
Now, I needed to turn on/off the 230V mains using a 5V signal from the Arduino. The answer was a solid state relay but they aren’t cheap so I built one. I used the MOC3041M triac driver and a BT139/600 triac using the basic circuit described in the Fairchild Semi MOC3041M datasheet. The triac is mounted to a processor heatsink (way bigger than necessary) salvaged from an old PC. It easily controls power to the 230V, 1800W hot plate I am using.
Putting it all together, the first tests showed that, in concept, everything worked! But the hysteresis of the system was way too large, swinging 15-20 degrees over the goal temperature. So, simple on/off control was not going to work. A post to the Adafruit forums and within minutes I learned that what I needed was a PID control algorithm. That’s Proportional/Integral/Derivative and it’s a basic concept in systems control. I had something new to learn about! The Arduino Playground page had a couple of implementations of PID. I chose the PID Library written by Brett Beauregard. (For this purpose, it is slightly modified and is the PID_SV library in the attached code.)
I added to the menu/display code to allow setting the PID parameters and monitoring the PID output on the display. It is still just in the breadboard stage but all is working very well allowing temperature control within a couple of tenths of a degree. Here is a picture of the system spread out on my workbench.

The next step is to package this all up. For the electronics, I have a chassis that is just the right size for the hot plate to sit on. And I’ll make a separate unit to place in the pot that holds the temperature sensor and a circulation motor/propeller.
If you want to see the current state of the code, click here to download a zip file with the sketch and the necessary libraries. I have run this on the Arduino Duemilanove and Uno.

Sunday, 1 July 2012

Arduino library for DS18x20 temperature sensor

Filed under: Uncategorized — Michael @ 22:11

I wrote an Arduino library for the MAXIM DS18B20 temperature sensor sold at Adafruit Industries. (The library also works with the DS18S20.) Based on the Arduino OneWire library, I think it’s a pretty good start for anyone who wants to use this device. To download, right-click here and save it somewhere.
Let me know if it’s useful to you.

Tuesday, 2 August 2011

An active crossover for my 2.1 HiFi

Filed under: Music,Uncategorized — Michael @ 7:55

It’s been a long time since my last post. I have been doing stuff, though, and I thought I would post about a modification I did to add a subwoofer crossover to my hi-fi system. It came out pretty well, I think.
What I have is an NAD C315BEE integrated amp. This is their entry model from a couple of years ago and it has no separate pre-amp out or subwoofer out. Speakers are B&W 685s with an ASW610 subwoofer. (A ‘2.1’ system.) I was using the subwoofer’s speaker-level inputs and internal low-pass filter and the system sounded OK. But I got to thinking that the low frequencies were also going to the main speakers and even though they can’t reproduce, say, 30Hz they still get the signal. So I thought about “bi-amping” with the active subwoofer amp and the NAD and with an active crossover. I got a hold of the service manual for the NAD and found that there are actually jumpers on the circuit board between the pre-amp and power sections, all I needed to do was build in some connectors for a pre-amp out/in.
First, I went ahead and built the crossover. It is a standard Linkwitz-Riley 24dB/octave circuit set for crossover at 59Hz. (I just added 10Hz to the -3dB frequency for the 685 speakers.) Graphing the response showed all was in order, no phase problems and crossover frequency just where I’d calculated. Cool!
Now it was time to open up the NAD and see about removing the jumpers and adding the connectors. Turned out that it was really easy to work on. They even have a panel on the bottom that, when removed, allows access to the underside of the circuit board. Anyway, once I got the covers off it looked like there would be room to actually mount the crossover inside. I knew from the schematic that there was +/-17V in there which could power the crossover (it only draws like 30mA so I wasn’t worried about that).
So, this last weekend I wired it all up and was truly surprised at how much clearer the lower notes sound. Whether rock, jazz, or concert orchestra, the low-end is just more transparent and real sounding.
I attached a few pictures. The first shows the added subwoofer-out jacks (lower-left) with the location of the two removed jumpers (upper-middle, just to the right of a tall heatsink). The two jumpers just above the upper removed jumper are +/-17V. I removed them and replaced them with new jumpers with a little loop to solder to. I also drilled 5 small holes in the audio ground plane for the ground wires. The second picture shows the wiring in place. The third shows the crossover in place. The last two show the amp with the crossover and the new backside.
Thanks for looking!

Saturday, 5 June 2010

Mozart, The Magic Flute, and Sewage

Filed under: Uncategorized — Michael @ 13:47

Intrigued by the title of this post? Check out the post on my Magic Flute site.