Sunday 22 February 2015

A new step attenuator

It's been a few years now since I built this project and the signal generator is still going strong and getting plenty of use.

The step attenuator didn't fare so well though. I never did get round to boxing it up and I left it next to the damp wall in my workshop. Over the course of the winter and due to my not cleaning the flux off the boards thoroughly it has turned into a bit of a rotten mess.

It's probably possible to rescue it but it's never worked that well and the switches were pretty unreliable. So I had a look on ebay and saw this:
A switched attenuator with 0-127dB in 1dB steps. After some confusion (the ebay ad said it was TTL and had SMA connectors - it actually needs around 15V on the inputs and the connectors are TNC) I got started on a control circuit for it.

I've decided I want something simple but not too simple. It just needs up/down push buttons and a readout. I've added some nice features too:

  • fast up down if button held
  • outputs only update after the buttons have been released for ~1/4 second to save on relay chatter
  • outputs turn on / off individually - with low bits to high bits in turn - this to avoid sudden surges of current overloading supply
  • outputs turn on / off individually in two passes - one for attenuators on one for attenuators off - this means that there is never a state where the attenuation is less than it should be to avoid overloading sensitive circuit
  • outputs have series resistors bypassed by capacitors - this give a high current initially to help turn the relay on then a lower "hold current" to keep the relay on.
I bought some simple DC-DC converts off ebay for a few pounds (XTW-SY-8) and from Pomeroni I bought some tiny seven segment 4 digit calculator LEDs which look cute.

I knocked up a prototype first using a PIC uController and a Matrix Multimedia breakout board.
I wrote the software in C in the latest version of MPLab - this took a while to get installed and working but once installed is nicer to use than the older versions.
Next I put the circuit into KiCad and designed a board. The actual board I designed had a few mistakes:
  • The labels for the attenuator outputs were reversed
  • I'd misunderstood the attenuator and thought there were 2 x 64dB instead of 3 x 32dB
I've corrected these mistakes in the attached files
I've just bought a a laser printer and decided to use that to print the PCB layouts. I used inkjet transparencies and printed onto the rough side. I found that two passes through the printer gave a good enough contrast. Careful alignment of the paper on the first and second passes is key and give the ink time to set between passes to avoid smudges. 
My first attempt was not great - I'd tried to be too greedy, passing very fine tracks between pins and there were a lot of bridged tracks and a few of the very fine tracks had breaks, also the pads were too small for drilling. On my second attempt I got a satisfactory board which worked first time - apart from the labels being wrong!



I placed the buttons and LED on the back of the PCB and intend to bolt that to the front panel with holes cut for buttons and LEDs.

Here's the MPLAB and KiCad (corrected) files: http://authorityfile.co.uk/NBSC/Home/OtherStuff

No comments:

Post a Comment