A remote control preamp in the works - diyAudio
Go Back   Home > Forums > Source & Line > Analog Line Level

Analog Line Level Preamplifiers , Passive Pre-amps, Crossovers, etc.

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 23rd August 2013, 05:21 AM   #1
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default A remote control preamp in the works

I'm just starting on a new preamp - the analog circuitry will be based on Rod Elliott's P88 and my Bugle 2 phono preamp, and the control circuitry will use an Arduino with a pile of relays, motorized pot, infra-red, bluetooth, and a rotary encoder. In addition to these elements, I will also be integrating a Mini-DSP for room correction, and an oDAC to provide music from my server.

All the signal flows will be in the analog domain once they are inside the box. The oDAC takes USB in, and the MiniDSP has built-in ADC and DAC.

The idea is ultimately to be able to control the whole system from my phone or a tablet over bluetooth, but also to support an IR remote and direct manipulation at the front panel.

It's going to take some time - the analog piece is pretty straightforward, but I want to write my own software and assemble all the hardware myself from a variety of sources.

As I go I'll try to share the software as it develops, and to document the process in case anyone here is in need of a soporific.

I don't imagine any of this is really new, but it might be interesting to someone wanting to implement some parts of the system.

Also, I'll probably be asking for help when my head gets lost in the spaghetti
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote
Old 23rd August 2013, 06:02 AM   #2
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Assembling the bits...

Here are some of the components: I'm still waiting for the microcontroller and the motorized pot...

This is a standard 20x2 display of the kind that you can buy for $5 or so (depending on where...China is cheapest). It interfaces directly to the Arduino using six pins, and will display the source and volume, and any other information I can think of. The Arduino LCD library makes talking to this very simple.

Display.jpg

This is an H-bridge board I found for about $6 - it will control a couple of motors using two pins plus an enable pin per motor. I will be using it to drive the DC motor on the back of a motorized potentiometer. I'm getting a pot with extra gangs, so I can use one as a sense channel. I'll read the voltage across one gang so I know where the wiper is. That way I can tell when the user manually manipulates the pot. (That's the theory - I haven't tested it yet).

H-Bridge.jpg

If I have enough pins, I'd like to use these power relays to control off-board power - that way I can use the preamp to turn other equipment on and off. The relays are rated at 10A at 125V or 250V.

Power-Relay.jpg

This is really the heart of the control system - eight DPDT signal relays. I'll use five for sources (phono, CD, DAC, tuner, tape/aux); one for tape source/monitor, one to switch the DSP in or out of circuit, and one for system muting.

The relays are controlled by one wire each. I'll probably use a shift register connected to the 8 control wires - that means I can get away with only three connections to the arduino (enable, clock, data). There are standard Arduino functions for writing data to the shift register, so I'm hoping this will be straightforward.

Signal-Relays.jpg
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote
Old 23rd August 2013, 06:20 AM   #3
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default The build plan

I think the software will be the most complex element, although I'll probably have to be careful with layout and power supplies to keep digital noise out of the analog world. Here's what I'm thinking.
  1. Start writing the software. Test what I can on a breadboard.
  2. Build the analog system - +-15V power supply, preamp, volume control, one set of RCA inputs. Test. Listen to some music.
  3. Build the digital power supplies. I'll need 5V for the Arduino and relay switching and display. I think the pot / H-bridge needs 24V, but I'll know more when it arrives and I can test it. I'll keep the digital power supplies separate from the analog side.
  4. Integrate the Arduino (Leonardo is the current plan) with a display and rotary encoder. Prove I can read the encoder, update internal variables, and display status. At this stage the analog and digital systems do not interact.
  5. Add the signal relay board. This probably requires a small PCB / stripboard for the shift register. Get the source relay switching working from the rotary encoder. Build out the source control system and add a bushel of RCA plugs. Make sure there's no sound degradation.
  6. Add the wiring for the mute, DSP and tape/monitor relays. Add the new controls into the Arduino (rotary encoder-driven).
  7. Develop the volume control code and hardware. This is a bit more complex: i need to measure the state of the volume control, update the screen accordingly. This is the first phase, before I have other ways to alter volume (IR and bluetooth).
  8. Add IR capability and train from an Apple remote. Nothing too complicated: volume up/down, source up/down, mute, DSP in/out will be a good start.
  9. Develop volume control driver software for the H-bridge to implement volume messages from the IR remote.
  10. Add the bluetooth module. It's basically a serial port. I need to figure out how to drive it from my phone in an elegant way. It will do the same things the infrared remote will do, but it might have a nicer UI.
It seems like a lot of work, but I think if I break it down, and test it piece by piece, it should be possible. I'm sure there's more I'll think of as I go through it...
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote
Old 24th August 2013, 05:05 AM   #4
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Arduino pin assignments

The Arduino Leonardo has 20 sense pins. I need all of them, I think, even using a shift register to drive the signal relays. And I guess I don't have enough pins to run the external relays.

Strictly speaking I don't need a separate mute relay - it will be enough to turn off all the inputs - but it seems cleaner somehow to have a relay at the output. We'll see how well it works.

Here's my pin assignment table:

Code:
// preamp_01.h
// Port definitions and constants

#define BT_RX         0                 // Bluetooth / serial receive data
#define BT_TX         1                 // Bluetooth / serial transmit data        
#define IR            2                 // The Infrared sensor
#define LCD_PORTS     3, 4, 5, 6, 7, 8  // two control and four data
#define VOL_SENSE    A0                 // analog in to read pot position
#define VOL_ADVANCE  10                 // H-bridge up
#define VOL_REDUCE   11                 // H-bridge down
#define VOL_ENABLE   12                 // H-bridge motor enable
#define ENC_SWITCH   13                 // the encoder push-button switch
#define ENC_1        A1                 // two pins to read the encoder
#define ENC_2        A2                 // 
#define RELAY_DS     A3                 // shift register data send
#define RELAY_CLK    A4                 // shift register clock
#define RELAY_STO    A5                 // shift register latch (store) data
Pins 0 and 1 are already set up to work with the serial port, so I will keep them so assigned, and they will be the in and out for the serial bluetooth module.

The IR module only needs a single pin.

The LCD display has two control pins and four data pins. They are driven by the LCD library provided with the Arduino - all I need to do is hook them up.

VOL_SENSE is an analog input, generating a value from 0 to 1023 from an analog voltage from 0 to 5V using the internal 10 bit DAC. I'll hook up one gang of the pot between 5V and 0 and measure the position of the wiper to figure out what my current volume setting is.

The next three pins are to drive the H-bridge that turns the pot motor clockwise or anti-clockwise. Two set the direction, and one is used to enable or disable the motor. It can be fed from a pulse-width modulated output, so I can set a suitable rotational speed.

The rotary encoder has three active pins. Two provide overlapping square waves from which I can tell which way the encoder is turning, and one is a momentary push switch that I can use to change a setting.

Finally, three pins to control the shift register that will control the relays.

My understanding is that the analog pins can also be used as digital, so the last six are used to sense the rotary encoder and drive the relays via the shift register.
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote
Old 27th August 2013, 07:34 PM   #5
diyAudio Member
 
Join Date: Aug 2013
Hi,

This is my first post here and I am very interested in your project. I've previously built a couple of small electrical projects and played around with an RPi but never used an Arduino. I am particularly interested in the part where you mentioned interacting with your phone via bluetooth - can I ask what type of phone you have and how you plan to do this?
  Reply With Quote
Old 28th August 2013, 05:14 AM   #6
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Quote:
Originally Posted by Anima999 View Post
Hi,

This is my first post here and I am very interested in your project. I've previously built a couple of small electrical projects and played around with an RPi but never used an Arduino. I am particularly interested in the part where you mentioned interacting with your phone via bluetooth - can I ask what type of phone you have and how you plan to do this?
Here's the theory: I don't yet have the bluetooth gadget, so I haven't tested it.

The Arduino has built-in serial communications - you can read and write characters to and from the serial port. Normally this is used for communicating to a PC via a USB or other connection. But this Bluetooth device plugs onto the serial connection, and it sets up a serial connection between the Arduino and anything that is paired to it. Then you can send information back and forth using the serial protocol.

So my plan is to create a small application for my iPhone that responds to key pressed by sending single characters to the preamp via bluetooth. The preamp will listen to the serial connection, and depending on what characters come through, it will take the appropriate action.

In a second version, I may try to make the communications bi-directional - writing status information back to the phone using the same mechanism. But I don't know yet how easy or hard this will be. I may prototype the connection using my Mac, which has a bluetooth capability, and which can easily send serial data.

This is a link to the same kind of bluetooth module (Ebay).

And a picture:
Click the image to open in full size.

Does that make sense?

tim
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote
Old 28th August 2013, 05:43 AM   #7
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Figuring out IR Control

I have a Vishay IR receiver TSOP4838 for infrared communications, and I want to use Apple remotes to control my preamp.

I set up a quick breadboard to test and figure out the codes:

IR Test copy.jpg

It was initially a bit confusing, because two different remotes gave different codes for the same functions. I eventually found that there were three bits from the long string of bits that were consistent and that correlated with the function being sent, so by masking out the rest, and switching in the code based just on those three bits, I was able to set up a simple command loop.

Here's the test code:

Code:
void IRCommand() 
{
  if (irrecv.decode(&results))  // if a command has been received
  {
    if (results.value == 4294967295)  // if it's a repeat command
      {
         lcd.setCursor(3, 3);
         lcd.print("Repeat...");
         irrecv.resume();   // go get another comand
         return;
      }
  // otherwise, this is the main part of the function
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("Command received: ");
    lcd.setCursor(0, 1);
    lcd.print(results.value, HEX);    // print it out in hexadecimal
    lcd.setCursor(0, 2);
    lcd.print((results.value & 0x00007000) / 0x1000, HEX); // the bits we want
    lcd.print(" ");
    
    switch ((results.value & 0x00007000) / 0x1000)
    {                            // these work for the two Apple remotes I have...
      case 5:
         lcd.print("Volume Up");
         break;
      case 3:
         lcd.print("Volume Down");
         break;
      case 1:
         lcd.print("Mode -1");
         break;
      case 6:
         lcd.print("Mode +1");
         break;
      case 2:
         lcd.print("Mode Set");
         break;
      case 4:
         lcd.print("Standby");
         break;
      default:
         break;
    }
    
    irrecv.resume();  // go and listen for the next command
  }
}
First part gets the value, and checks to see if it's the code for "repeat what I said last". If so, we print it. This code is the same for a range of different remotes.

Then we print the value out in HEX so I can tell what's coming through.

Next I mask and divide, so the relevant three bits are the only bits left, and I run a switch based on the remaining bits. This will be replaced in the final code with actions to increase or decrease the volume, change a mode (tape monitor, DSP enable/disable; mute/unmute).
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote
Old 28th August 2013, 11:19 AM   #8
diyAudio Member
 
Join Date: Aug 2013
Thanks Tim.
  Reply With Quote
Old 1st September 2013, 03:32 AM   #9
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Thinking about the layout

There's quite a lot of stuff. Here's what I'm thinking of doing. I am looking at an enclosure that's 15" wide, and 11.5" deep - or perhaps 12" to make things a bit easier to fit in.

This doesn't allow me to fit in the mains transformer, but I quite like having that in a separate container and location. I think it makes sense to put the regulators in the main enclosure, because I can keep the analog an digital power supplies completely separated from the diode bridges onwards. That, I hope, will reduce the likelihood of digital noise reaching the analog circuitry.

The phono preamp will be my recently built Bugle2, which has its own power supply. I think that's justified given the sensitivity / high gain of the stage.

The DAC is an oDAC, which is powered from the USB that feeds its data.

The MiniDSP can be powered from USB, but I'll probably give it a 5V supply from the same source as the Arduino.

Here's a scale drawing, although I don't yet have the pot, and the regulators have not been built.

"mode" is the rotary encoder; "gain" is the motorized pot, and "balance" is an analog pot that I plan to set and forget. It will not have digital control.

Any thoughts about the layout? This is intended to keep low level signals short, and to separate analog from digital as much as possible.

Panels-02.png
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote
Old 2nd September 2013, 09:33 PM   #10
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Laying out the digital hardware

The microcontroller is an Arduino Leonardo (still waiting for it to arrive), and I just need a bit of glue to connect all the devices.

It seems as though the easy way to connect everything is to use a proto shield - I have one from SeeedStudio.
2013-09-02 14.18.59.jpg

Here's a rough indication of the layout, created with DIYLC.
Protoshield.png

The main purpose of the shield is to give each peripheral it's own plug and socket, using 0.1" Molex connectors. While I hate connecting wires to the little metal bits, I like the flexibility and tidiness. I bought a 10' roll of ribbon cable which will let me make a lifetime's worth of little peripheral connectors.

I still need to check the polarity of a few things - the good news is that if I accidentally reverse data connections, I can fix that in software (with a few exceptions like the serial port, and where I need analog read capability or interrupt capability.
__________________
Townshend Rock III w/ DC motor, Hagerman Bugle 2, Naim CD5i, Voyage MPD, ODAC, MiniDSP, Pass BA-3 and F4, Parham Pi Sevens
RC Preamp (in progress), DIY Silver cables, Open Baffle BOFU, DIY subwoofer, GainClone, o2 Headphone Amp
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ES9023 DAC(subbu) + Tube Preamp with Remote and R2R volume control(Danzup) rvrazvan Tubes / Valves 5 20th December 2012 08:56 AM
remote control for preamp slr 5000 Solid State 7 29th April 2008 02:42 AM
Remote volume control for existing remote? theAnonymous1 Parts 7 6th August 2007 08:22 AM
Ratshack Remote control for preamp dine1967 Solid State 1 7th March 2003 06:02 PM


New To Site? Need Help?

All times are GMT. The time now is 12:59 AM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2