![]() |
![]() |
| Mark's Project Pages/Audio Projects/Hi-Fi Preamp/Control Hardware | |
|
Hi-Fi Preamp - Control Hardware: The preamp control system is based on a PIC16F877 which controls relays and the volume control IC's via simple serial interfaces. These interfaces are only active when processing commands, resulting in minimal impact to the audio signal. In addition, the output muting relays are controlled by a power-fail circuit.
Display: I thought about the choice of display for a long time... as mentioned before, I had some difficulty finding a suitable LCD display that could be clearly read from across the room without looking too horrible close-up. Part of the problem is caused by sitting at an angle to the hi-fi, causing a loss of contrast. Market research suggested that LCD's are a bit 'lo-end', as very few quality products use them. So, despite the cost, I decided to buy a vacuum display module. It's an excellent device, being compatible with the industry-standard LCD interface, making it a drop-in replacement. It incorporates an onboard DC-DC converter, so it only requires a single +5V supply. There's no contrast adjustment, and the display brightness is controlled by software, which simplifies the control hardware... Another advantage of these displays is the huge range of display colours. The normal output is blue-green, but filters let you choose almost any colour. Shown opposite are some of the better choices...
Update - 17/11/2002: Graphic VFD Module: Just as soon as I finish the preamp, Noritake-Itron decided to bring out a new range of Graphic VFD modules that are extremely affordable. Typical! However, I quickly noticed that the GU140X16 had very similar physical dimensions to the 20-by-2 text display that I was already using. The interface of the unit I was examining (with a -7002 suffix) was a relatively straightforward 8-bit affair, and as I had some spare ports on the PIC, I guessed that with some simple mods to my control PCB I could incorporate the new display. At the same time, I noticed that Farnell were stocking a whole load of new displays. Their GU140X16 had a -7806 suffix - I quickly discovered that this module was an LCD-compatible design! Ok, it wasn't quite as powerful as the -7002 (fewer fonts and graphics commands), but it would drop straight into my preamp...
This picture shows the GU140X16G-7806 next to the CU20025ECPB-U1J text-only module. As it turned out, the physical dimensions are identical - even the 14-way ribbon cable connection is in the same place! Thank you, Noritake-Itron! And the price? Including VAT, £40. Virtually the same as the text-only unit. The Farnell part number is 412-8795. Check out the User-Interface page for some screen-shots.
PIC Upgrade: Another key stage in the development was to find a grown-up PIC. I was constantly struggling with the 16F84's feeble 1K program memory and limited IO Lines, so I made the brave step of buying a 16F877. This really is the Rolls Royce of midrange PICs, and is very affordable (£5.67+vat from Farnell - 300-2690). As well as a massive (!) 8K program memory, there is much more RAM and EEPROM available, and many more peripherals, including an 8-channel ADC This device is serially programmable in the same way as a 16F84 - for development purposes I made an adapter cable that plugs into the 18-pin socket on the PIC programmer and a header on the test board. There was a bit of a learning-curve, mainly because most of the new exotic peripherals are enabled by default and if you want to use the IO ports as standard ports, you have to explicitly set them up at the start of your programme. Then you have to learn all about memory management and PCLATH, etc, etc. All the information you need is in the excellent data sheet, but at 215 pages it's hard work! You definitely need a paper copy, so you'd better buy a ream of paper if you can't persuade Microchip to send you a hard copy... The device led to an instant simplification of the hardware, and an expansion of the user interface...
Circuit details: Referring to the complete schematic, you can see that the control circuit is very straightforward. Note that there are only 12 connections between it and the rest of the preamp - this is the big advantage of serial control. If I'd located the source-select relay drivers on the control board then the numbers of connections would have doubled. The PIC runs at 4MHz and requires no external reset circuitry.
Local switches: Rather than separate or multiplexed IO lines, I decided to use the ADC on the PIC. This means that each switch presents a different voltage to the ADC, and software decides which switch was pressed and determines if the switch is pressed, held or released. This port is measured every 30mS, and a valid keypress is determined from 3 of these samples. The routines to do this caused much headscratching, but I'm pleased (or proud, even!) of the final result. Sony use a similar scheme in some of their products, so it's nothing new, but I've found it's an excellent way of simplifying hardware and a good learning experience... The resistor values chosen result in a voltage that rises by 0.3V as each switch down the chain is pressed. The resistor values to do this worked out to be nice, round E12 preferred values, which was pleasantly surprising. As current consumption isn't an issue, I decided on relatively low values for good noise-immunity. If this was a portable instrument, I'd consider using values from the next decade. I've provided a test point on the PCB for the input to the ADC - this might prove useful for faultfinding in the future... As you can see from the diagram, the resistor chain is continued between the two front panel PCB's and this involves several connectors which might become unreliable with age... Each switch has an integral LED, apart from Store which uses an external LED to light the button. These are connected directly to ports on the PIC apart from the seven input select switches. To save connections these are controlled by a shift register which is surface-mounted on the switch PCB and daisy-chained from the UDN5821 relay drivers. Apart from saving connections, this has the advantage of being able to display completely different states compared to the input select relays. This brings two distinct benefits - the first is that the relay drivers can have an arbitrary output assignments. This means that the pinout of the relay drivers can be chosen in a manner that is most convenient for PCB layout - a look-up table in the firmware translates source number to a physical pin on the IC's. The second benefit of the LED's being able to show any state is the addition of a "Listen-Source" option to the Record-Out menu. With this selected, the Minidisc and Tape buttons become tape-monitor switches. This is rather neat - the record-out relays follow the listen relays unless you want to listen to a tape-loop - thus providing proper tape-monitoring. Another minor feature that I'm considering adding to the software is to use the source LED's to echo the Record-Out selection when you are in that menu mode. As well as making things seem slightly clearer, the input select buttons could be used to change the Record-Out selection (this would be in addition to turning the rotary encoder)...
Volume control: The volume control is a rotary encoder. I'd experimented successfully with the cheap contacting versions, but on rescuing an expensive optical unit from the skip at work, I was immediately won over by the superior mechanical feel of the device. Given that it'll be the most frequently used control, I felt it was worth the expense. Unfortunately, the rescued device only worked for a few minutes at a time, and my repair attempt just resulted in more damage... Farnell sell them (part number 328-2338) for £30+VAT - this is the third most expensive item after the box and VFD display! The optical unit has a high resolution of 128 cycles per revolution, which is quite good fun for volume adjustment, but useless for driving the menus. I've implemented software-controlled tracking speed, so the resolution is reduced to around 20 cycles per revolution when in a menu mode. The resolution in normal (volume) mode might be a user-option eventually... The device uses the RB4 port change interrupt, and has protection resistors to prevent damage when the circuit is first powered up (in case the PIC tries to assert a state before the software has configured the two IO lines to be inputs)
Remote control: The hardware for this is nice and simple - an integrated receiver/preamp produces nice TTL-compatible square-waves which are fed into RB0. The firmware uses the RB0 interrupt to decode the Philips RC5 commands. The preamp is mounted on the left-switches PCB and is decoupled by a surface-mount tantalum capacitor. Example part numbers for these integrated IR receivers include 414-2822 and 414-2834, both of these cost £1.83 plus VAT at the time of writing.
Muting:
There are muting relays on all power amp outputs and the headphone output. These are controlled by two distinct circuits - the first is the power-fail detect circuit on the power supply PCB which generates +UNMUTE. This supply is removed as soon as the mains voltage falls below around 200V. There is a time-delay before this rail is established, giving the PIC time to reset and address the PGA2310's correctly before the audio outputs are enabled. The second circuit is controlled by a switch in the headphone socket, and generates the -UNMUTE rail. It's not really a supply rail in the conventional sense as the output of this circuit is an open-collector, but it seems logical to regard it this way. This is connected to all output relays apart from the headphone output (for obvious reasons!)
12V Triggers: Based around an octal high-side Darlington driver, there are 8 12V trigger outputs available on a rear-mounted 9-way female D-type. While these would normally drive opto-isolated inputs, they are capable of driving relay coils directly if required. Two outputs are controlled by spare buttons on the remote control - these are ports on the PIC connected directly to the Darlington driver. The remaining 6 are fed from a shift-register. Three of these are intended to control power amplifiers (main, surround and bass) and the remaining 3 are set on a per-input basis, controllable by the user. The Darlington driver is protected by a self-resetting semiconductor fuse - when in the tripped state a transistor lights the Standby LED at a much greater than normal brightness.
Source code: A brief word about the source code. Many people have emailed to request the source code, so I should state the position here: At the moment, I don't think that I'm prepared to release the code. Partly because it is far from finished, but the main reason is just about every line of code is original and entirely my own work. This might change at some point in the future... Eventually I'll get a chance to work on the programming guide in the PIC section of this site. When that happens, a lot of the routines that I have written for this project will be detailed there (things like time delays, LCD stuff - writing words, scrolling text, defining UDC's, making bargraphs, etc) There is a possible option if I don't decide to make the code public-domain - I could consider programming 16F877's for people who wanted to build this project. This is something that I will think about once the code is sufficiently complete.
Control Conclusion: After much thought and experimentation, the control hardware turned out to be rather simple. This is thanks to using a PIC with enough ports (meaning the complex multiplexing seen in the 16F84 version was no longer required), and using serial control of most of the preamp. Also, using the ADC for the local switches makes things easier. On the other hand, simplifying the hardware makes the software more complicated! But, this is normal practice for commercial products - you only have to write the software once, whereas you might have to build the hardware millions of times! As this is my first 'real product' to use software to this extent, it has been an interesting experience. At the moment the software is basically functional and reliable, but there are several functions that I have yet to finish. Also, I keep thinking up new things to add! The bottom line is that this project will remain much more 'fluid' than previous projects, as it will be so easy to add new features and functionality. To add a single extra function to my NICAM tuner would probably require the control board to be rebuilt!
On to the Power Supply and mechanical details...
|
©2004 Mark Hennessy
Contact Me | Site Map
| Disclaimer