Hiro's Home Page
Making Electric Volume (Feb. 28 2010)
Index
Why?
After finishing Time-Domain Speaker, my concern was to change audio volume easily. As I explained in the report of TD Speaker I am using BEHRINGER FBQ1502 and ALESIS RA150, both of them does not have the feature to control volume my remote controller, which annoys me very much. I though it was the time I make a remote volume controller for my audio system!!
Basic feature
The basic feature is
TC9210 and LM1972/3 can control attenuation down to -80dB. Having 50 level for attenuation should be enough.
Because attenuation is always negative, Seven Segment displays attenuation level WITHOUT minus (-) sign.
Although IR remote controller is the main to control attenuation in normal operation, we need a Rotary-Encoder to set attenuation level when the system is IR key code and preset learning mode.
To support various remote controller, IR key code learning feature is necessary. Having the feature we do not need to know the actual code sent by remote; only we have to do is to remember the codes sent by a remote controller in learning mode.
Hardware design
I decided to use LM1973. I actually wanted to use LM1972, however, it was not possible at the time. LM1973 is as almost same as LM1972. The difference is LM1973 has 3 audio channels while LM1972 has two channels. We just can disconnect one channel if we do now need it.
PIC16F88 is a reasonable chip to achieve the functionality of my volume controller since
It seems LM1972/3 works with single power, +12V, but I provide two powers, +12V, +6V (or, +6V and -6V). I simply used two 10kΩ resistors to generate 6V from 12V for Analog-GND of LM1973, using two voltage regulators, such as LM7806 for example, is ideal, though.
The pare of 120&Omega resistors inserted in front of LM1973 audio input are for 6dB reduction of input level. After testing on a breadboard (protoboard), I realized that there was noise in LM1972/3 output. Since the noise existed for higher level input, it seemed input audio higher than a certain level was clopped for some reason. So, I inserted two 120Ω resistors to level-down input for 6dB. I am not sure the real cause of the noise, but 6dB reduction works well.
The pull-up 10k&Omega resistor and the decoupling circuit (240&Omega and 4,7μF) for IR receiver PL-IRM0101-3 is referred from LM1973 data sheet. It is said that a decoupling circuit is necessary to avoid noise since PL-IRM0101-3 is very sensitive.
Here is the port assignment for PIC16F88:
| PORT NAME | Input/Output | Function |
|---|---|---|
| RA0 | O | Seven segment selection (lower digit) |
| RA1 | O | Seven segment selection (higher digit) |
| RA2 | I | Rotary encoder phase A |
| RA3 | I | Rotary encoder phase B |
| RA4 | O | LM1973 Load/Shift |
| RA5 | I | Push button |
| RA6 | O | LM1973 Data |
| RA7 | O | LM1973 CLOCK |
| RB0-6 | O | Seven segment control (a-g) |
| RB7 | I | IR receiver PL-IRM0101-3 |
Software design
The basic software feature is
Although it is not mandatory to have task switching feature for such a small system, having the feature makes it easy to design functions for each I/O. Since it is not possible for us to manipulate PC stack in PIC16F88, the task switching is not REAL one; each task is responsible to finish and return to give time for other tasks. The main function, main(), takes the roll of task switching after initializing timer (TIMER0 and TIMER1) and interrupt, such as PORTB Change Interrupt, settings.
System clock is driven by internal oscillator to save I/O ports (INTIO2 mode). The oscillator is set 8MHz.
TIMER0 interrupt is set 2 mili-second interval and used for task switching.
TIMER1 is used for free run incremental counter. The counter is extendind 8 more bits, using TIMER1 interrupt, and can measure from 4μ seconds up-to about 60 seconds. TIMER1 counter is supported with a library to read-out.
The push button and the rotary encoder is controlled by simply watching PORTA with a certain interval (see source code for detail).
IR signal from PL-IRM0101-3 is received using PORTB Change Interrupt and TIMER1 free run incremental counter.
IR key codes and presets are saved in EEPROM and read out (at the to of main() function) when power is up.
Please refer to Software Design and source code for more detail.
Known bugs and problems
There is a problem that
When IR signal is received or Rotary-Encoder is turned, Seven Segment is incidentally muted, probably due to timing issue. The muting quickly recovers with following IR code or Rotary-Encoder input, and does not cause any serious problem on the system. You can disable the muting feature by commenting out the part of the source code in Seven Segment control task (see source code).
Noise reconsideration
The cause of the noise that I mentioned in Hardware design may be due to wrong referencing of Digital GND level. According to this persons schematics(refer Mirror of the ALTOR.SYTES.NET) Digital GND is wired commonly to Analog GND, which should be 6V level in my previous schematics. The right schematics may works without the two pairs of 120&Omega resistors in front of LM1972/3 for 6dB reduction although I have not tested it yet.
I did not take care of this point when I designed my schematics since the digital part and analog part in LM1972/3 seemed to be well isolated according to datasheet.
Conclusion
It was quite a fan to make an electric volume, which is my first try to use PIC micro-computer. I took most of the time to make hardware and studying IR code system, but enjoyed learning new thing very much.
Here are images of my electric volume....
I am now thinking about what I should try next... maybe a bit harder one.
I hope my article will be useful for others who are about to start learning PIC micro computers.
References
Articles for volume control:
Articles using PICs:
Welcome to Einstein's electronic lab!
Articles regarding developing environment:
MPLAB Integrated Development Environment
SDCC - Small Device C Compiler
Articles regarding IR code system:
To know PIC assembly instructions:
Download
You can download the source code by clicking HERE.


