Posts with «volume control» label

Mix It Up with a Multi-Volume Controller

What’s the use of waiting around for something to break in order to hack into something else? As long as it’s just sitting around not being used, who cares? [OmniSaiRen] had a  Behringer MIDI controller just taking up space. Instead of selling it, they decided to build it into something they would definitely use — a multi-volume controller with mute keys and other useful macros.

After gutting the case, [OmniSaiRen] gave it a couple coats of glossy white paint that looks really nice with the black keycaps and knobs. The plan was to use the original encoders, but [OmniSaiRen] replaced them with potentiometers when they couldn’t get the encoders working with the Arduino Nano. We are sad to report that Cherry Blues only made it to the build because they have all black housings and were also lying around taking up space, but maybe [OmniSaiRen] will grow to love them.

If you’re tired of all the mousing and clicking it takes to turn down this or that volume, you need to build one of these things. It runs on deej, an open source volume mixer that works with Linux and Windows, so what are you waiting for? If you only want a single hardware volume knob, you can’t go wrong dialing it in rotary style.

Via r/duino

Rotary Controller Dials in PC Volume

As wonderful as mechanical keyboards are, most of the pre-fab and group buy models out there have zero media controls. If you want rotary encoders and OLED screens to show what function layer you’re working in, you’ll probably have to build your own keyboard from the ground up.

Hackaday alum [Cameron Coward] got around this problem by building an electromechanical buddy for his keyboard that works as a volume control. Now that we don’t rely on them to make phone calls, rotary dials are a fun throwback to a time that seems simpler based on its robust and rudimentary technology. This one is from a lovely burnt orange Bell Trimline phone, which was peak rotary dial and one of the idea’s last gasps before tone dialing took over completely.

Operationally speaking, [Cameron] is reading in the dial’s pulses with an Arduino Nano and using a Python script to monitor the serial connection and translate the pulses to volume control. We like that this is isn’t a volume knob in the traditional sense — it’s a game of percentages. Dialing ‘2’ gives 20% volume across all programs, and ‘8’ raises it to 80% of maximum. Need to mute? Just dial ‘0’, and you’ll begin to understand why people wanted to move on from rotary dialing. It won’t take that long, but it’s not instant. Check out the demo after the break.

This isn’t the first time we’ve seen a rotary dial used to control volume, but that’s one of the minor selling points of this rotary cell phone.

Making a Gesture

When [krich] switched keyboards he lost his volume control. So he decided to hack one together out of an Arduino, an old floppy disc case, and a Hover Labs Hover board (not the Back to the Future kind). You can see the result in the videos below.

You’ll notice in the video that the device reads a “spin” motion to resemble a round volume control. The program sends simulated keyboard presses to the PC to control the audio. In the write-up, [krich] mentions it may be the first gesture-based volume control. However,we’ve done it before and so have others.

The Hoverboard does all the hard work, of course. It passes data to the Arduino via I2C. The PC side is handled by some Windows on screen display software, 3RVX.

Still, this one seems to work well with the Hover board. Hard to argue against anything that upcycles a floppy disc container.


Filed under: Android Hacks

USB Volume Control

If you buy expensive computer speakers, they often have a volume knob you can mount somewhere on your desk so you aren’t dependent on the onboard volume control. [Kris S] decided to build his own version of the remote volume control. Not surprisingly, it uses an Arduino-compatible Digispark board and a rotary controller. The Digispark (that [Kris S] bought for $2) is compatible with the Adafruit Trinket. This is key because the Trinket libraries are what make it easy to send media keys over the USB (using the HID interface) to control the volume.

Really, though, the best part of the build is the good looking knob made out of a pill bottle (see the video below). The micro Digispark is small enough to fit in the lid of the pill bottle, and some wax and pellets add some heft to the volume control.

The standard Arduino library has trouble sending multimedia keys, but in a previous post I built a gesture-based volume control that managed to pull it off.  We’ve also covered a similar volume control in the past. That one is also very good looking, but was a more complicated build than what [Kris S] pulled off here.


Filed under: Arduino Hacks, peripherals hacks

TRUE ANALOG AUDIO VOLUME CONTROL (T.A.A.V.C.).

 

More:   Video1   and   Video2

Now my Arduino can precisely measure audio input (VU meter),   and obviously, next thing that comes to mind right after measurements, is regulation or control. There are many different ways how to electronically adjust audio volume or level of AC signal.  I’ll name a few:

  • Specifically design IC, Digital potentiometers.
  • Mechanical potentiometers, driven by servo / motors.
  • Vacuum tubes amplifiers in “variable-mu” configuration.
  • Resistive opto-isolators.

First category (#1) fits nicely for arduino project. But it’s not interesting to me. My apologies to someone, who was searching an example of interface between arduino and digital pot. Other people don’t tolerate semiconductors in audio path ( tube sound lovers ). Third option would make them happy, only (#3) requires high voltage and difficult to accomplish on low hobbyist budget, so I left it out of the scope. Mechanical pot (#2) would be good solution to satisfy Hi-Fi perfectionists and arduino fans. The same time response time of mechanical parts is too slow, verdict – discarded.  (#4) have been in use since 1960s, but would you like your lovely music to be adjusted by highly toxic CdSe / CdS ?  I don’t think so. Wiki says opto-isolators have low THD distortion level, less than 0.1%. Probably true, but apart from technical aspect, there is always psychological, poisonous CdSe affects my perception.

How about variable resistor in it’s simplest form – tungsten wire? Where you can get one? In the electrical bulb. Perfect material for audiophiles – where distortion could get into ? – It’s pure metal ! And here is my design of the “basic cell” – True Analog Audio Volume Control (T.A.A.V.C.)

As you can see, cell consists of 5 bulbs plus 1 resistor. All elements form 2 attenuation stages, basically – voltage dividers with variable resistors. Resistive values of bulbs proportional to temperature, which is easy to control passing DC current through. To make it work with the biggest possible dynamic range, middle bulb is also heated up by current flow from two differential control lines / phases.

 Hardware prototype / Proof of Concept.

Differential Power Amplifier (PA) IC LM4863  is used as DC current source for control lines. Circuitry powered from 5V regulated switching power supply (4A).  Bulbs – clear mini lights, 2.5V, approximately 200 mA. Cold state resistance about 1.2 – 1.5 Ohm, hot state resistance is rising up to 15 Ohm.  Volume regulator could be connected to any audio source with output impedance no more than 32 Ohm, for example, headphones output. For test I used second channel of the PA, that shown in “optional” box on the left side. Second channel is a “nice to have” feature  in stereo version of the project, when both channels would drive two separate TAAVC cells, so using it as a “buffer” amplifier may be not an option.

Results.

  Measured attenuation  range of the “basic cell” is  20 dB, or 10 x times.

 to be continue…

 Chart, PWM (Voltage) to Attenuation:

 Quite interesting, isn’t it? I was not expecting it’s to be linear, but changing direction surprised me. There is one things, which could explain such abnormality, is that when voltage on the control lines 1 and 2 ( LM4863 outputs ) is approaching power rails, output impedance of the power amplifier is increasing, and consequently, attenuation characteristics of the basic cell deteriorate. It means, that in order to keep attenuation curve gradually declining, more powerful PA necessary. For now, I limited PWM to 0 – 200 range.

I’m thinking, STA540  powered from +12V, and 5 V bulbs would make sense to try next time.  Probably, replacing middle bulb for less current hungry, will increase max attenuation per cell up to 30-35 dB.

 O’K, after I get this data, how could I “straighten it up” for practical use ?  Volume control device, could be linear or logarithmic, but chart doesn’t resemble nether of this. And this is exactly what I need Arduino for.

Linearization.

 If you, by chance, have read this page, than you know how to do this part. Polynomial approximation. Unfortunately,  2-nd degree polynomial I used last time is not enough for VERY non-linear curve like I have. So, I “upgraded” my calibration subroutine (method: LEAST SQUARES) up to 3-rd degree:

void calibrate()
{
 //Least squares 3-rd degree polynomial coefficient calculation
 float arr[10][5] ={{0},{0}}, err[10] = {0}, coeff[10] = {0};

 err[0] = 10;
 for(uint8_t i = 1; i < 7; i++)
 {
  err[i] = 0;
  for(uint8_t j = 0; j < 10; j++)
  {
   err[i] += pow(level_table[j], i);
  }
 }

 for(uint8_t i = 0; i < 4; i++)
 {
  for(uint8_t j = 0; j < 4; j++)
  {
   arr[i][j] = err[i+j];
  }
 }

 for(uint8_t i = 0; i < 4; i++)
 {
  arr[i][4] = 0;
  for(uint8_t j = 0; j < 10; j++)
  {
   if (i==0) arr[i][4] += calibration[j];
   else arr[i][4] += calibration[j] * pow(level_table[j], i);
  }
 }

 for(uint8_t k = 0; k < 4; k++)
 {
  for(uint8_t i = 0; i < 4; i++)
  {
   if ( i != k )
   {
    for(uint8_t j = (k + 1); j < 5; j++)
    {
     arr[i][j] -= ((arr[i][k] * arr[k][j]) / arr[k][k]);
    }
   }
  }
 }

 union split_float {
 uint16_t tegri[2];
 float loatf;
 } sf; 

 for(uint8_t i = 0; i < 4; i++)
 {
  coeff[i] = ( arr[i][4] / arr[i][i]);
  sf.loatf = coeff[i];
  store_entry(( 2 * i ), sf.tegri[0] );
  store_entry(( 1 + (2 * i)), sf.tegri[1] );
 }
}

Procedure takes 10 data samples as input, calculates 4 coefficients and stores them in EEPROM memory.

VU meter based on Arduino UNO ( in minimum configuration Arduino and DC offsetting circuit ) should be connected right to T.A.A.V.C. output. Everything works in automatic mode, with results printed on serial monitor for review. Stable AC input is necessary, which easy to get from any PC sound card based signal generator, recorded media file or lab sine-wave generator. Arduino also provides PWM for T.A.A.V.C       via pin D3 (TIMER2 OCR2B).

Link to download Arduino UNO sketch: T.A.A.V.C.

to be continue…audio compressor, .

Last part,

Dynamic Range Compressor.

There are two important parameters defined in the beginning of the sketch:

#define          CMP_THRE                     -10             // Compression Threshold 
#define          CMP_RATE                        4             // Compression Ratio 4 : 1

Threshold and Ratio. I’m not into explaining all bunch of the details about compressors or what for do you need one, rather forward you to this link.  I only want to say, that I didn’t find any evidence that someone ever used electrical bulbs as compressors “engine”. So, this is my idea, and my implementation.

Technical specification of this design is quite modest, having close to 20 dB maximum attenuation and setting ratio to 2:1, threshold couldn’t be set lower than -40 dB. Good news, that for practical use in home environment it’s  really unlikely, that you ‘d need more. It’s also should be enough to solve a problem with annoying TV or Radio commercial / advertisement.

Compare to VU Meter project, I’ve made a few “relaxing” changes to the code, as it appears there are no strict industry standard on Dynamic Range Regulation. I reduce sampling rate down to 10 kHz,  and  split Low Pass Filtering in two sections. One is the same, as in VU Meter, inside sampling interruption subroutine, only with lower time constants. First LPF section is responsible for “shaping” attack and decay timing. Using quite inertial electrical bulbs in the project, reduce importance of this timing. Here attack and release mostly defined  by thermal responsiveness of the bulbs, which isn’t very high. Decreasing software LPF time constants helps to improve sensitivity. Other LPF section included inside LCD drawing function, works to overcome display slowness, suppressing LCD flickering. Other changes from simple VU Meter, is that finally I “scaled” everything correctly,  and “0″ db corresponds exactly to 1.228 V RMS at the input. Threshold level -10 expressed in dB as well. You may see threshold “mark” above the log scale. Indicator “needle” just below it, small 5×2 pixels only, but you can make it bigger if you wish.

I already described calibration procedure, to do it right, you need to connect arduino to output of the TAAVC cell.  Polynomial coefficients and minimum / maximum constants stored in EEPROM, so you don’t have to do this procedure each time after power cycling.  In normal mode arduino getting input measurements from the cell input:

Finished.  I’ll do a video “on demand” -);  If I had time…

Arduino UNO sketch:  Audio Dynamic Range Compressor. (TAAVC part 3).