A remote control preamp in the works - Page 2 - 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 8th September 2013, 07:50 PM   #11
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Analog progress

I've populated the preamp board and built a power supply for it...

2013-09-08 12.33.18.jpg

The power supply is a simple linear regulated supply with a CRC smoother before the LM7815 / 7915. I'm using a toroidal transformer from Antek.

2013-09-08 12.32.20.jpg
It's really a bit ridiculous to be building all this digital stuff to go with a simple, clean preamp like this, but the nice thing about DIY is the ability to indulge oneself.

I'm still thinking about which output caps to use...not really sure how much of a difference it makes. I'm also still waiting for the op amps to arrive from Mouser.

I'm still waiting for the pot to arrive as well - four channel Alps. Until that comes I can't really test much.
__________________
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 9th September 2013, 04:18 AM   #12
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Digital system progress

The wiring of the control board has begun - my first attempt at using a protoboard like this. There are multiple challenges - figuring out where to put stuff, lots of solder connections, checking and re-checking.

As power is coming through the Arduino, I am concerned that a wiring error could blow up the regulator or do various other kinds of overload damage, as the Arduino has very little built-in protection.

Here's the proto-board, top and bottom:
2013-09-08 12.33.47.jpg

2013-09-08 12.33.57.jpg

And here's what it looks like attached to the Arduino.

2013-09-08 21.02.13.jpg

I'm using 2.54mm connectors - the process of making them is pretty nasty. For the first few I used solder and pliers, but I found a crimping tool at Fry's for $18, and it seemed like a good investment. The connectors are still very small and easy to misalign, so I'm wasting a few. My hope is that using these connectors will make it easier to assemble, test and maintain, but they will only help if the connections are reliable, which seems not so easy to do.
__________________
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 9th September 2013, 07:19 AM   #13
diyAudio Member
 
Join Date: Apr 2010
Location: Hungary
Looks good Tim!
For communication, it is advised to send data packets, not only characters. Or a bunch of characters. So you define a comminucation protocol for yourself, something line that:
[Header] [Command] [Value] [Checksum][End]

If you are controlling the volume, you could send back the current position to your app.
If you make a simple application with buttons, you can set those buttons to send the commands to the preamp. And a feedback graphic or text to show the current valuest, let it be the volume or the input channel (if you have analog input too).

This is a long work you have started. But this will be very unique. Keep going.
__________________
My web page: www.8thnote.eu
  Reply With Quote
Old 9th September 2013, 03:58 PM   #14
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Quote:
Originally Posted by Earfanatic View Post
Looks good Tim!
For communication, it is advised to send data packets, not only characters. Or a bunch of characters. So you define a comminucation protocol for yourself, something line that:
[Header] [Command] [Value] [Checksum][End]
Thanks for the encouragement. It does look like a long project. But I am hoping that if I test as I go, one function at a time, it should be possible to get it all working.

I agree - a protocol for the Bluetooth communication will be more reliable. I may start with the simplest thing I can get working, and then make it more robust - after all, that's just software. Right now I'm not sure of the best way to create the phone app - I don't want to have to learn Objective C, and I haven't found a suitable app framework I can use on IOS. I may be able to code it as a web app with a server on my desktop computer - not sure of the range of the Bluetooth connection.

I am also hoping to have bi-directional communication eventually. It's great to have immediate feedback on the screen.
__________________
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 10th September 2013, 01:51 PM   #15
diyAudio Member
 
Join Date: Apr 2010
Location: Hungary
I am just a noob as well in mobile programming, but as I heard QT is a nice framework, and using that You can make apps for different targets, like iOS and Android.
__________________
My web page: www.8thnote.eu
  Reply With Quote
Old 10th September 2013, 04:30 PM   #16
diyAudio Member
 
Join Date: May 2012
Outstanding thread! Keep it up. I'm looking into making an 8ch preamp controlled with Arduino myself and have a feeling I'll need to reference this thread a bit.

Brandon
  Reply With Quote
Old 11th September 2013, 05:17 AM   #17
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Quote:
Originally Posted by Earfanatic View Post
I am just a noob as well in mobile programming, but as I heard QT is a nice framework, and using that You can make apps for different targets, like iOS and Android.
It's many years since I even thought about QT - I didn't realize it had come so far.

I'll look into the port to iOS - it looks as though it can be programmed in Javascript / ECMAscript as well, which might be a good way to build something simple.

Qt (framework) - Wikipedia, the free encyclopedia
__________________
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 12th September 2013, 04:16 AM   #18
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Code: the main program - initialization

I thought I'd start to look at the code to drive the control system. This will be developed incrementally, and I'm trying to keep things structured so I can test each piece separately.

Like any Arduino sketch, there's a setup() function, and a loop() function.

I also have to set up some global variables. Because I'm controlling hardware, it's useful to keep track of the global state of various things, and let each function fiddle with state as needed. I know it's not the greatest programming practice - very little information hiding - but it's going to have to do for now.

Here's the initialization code that sets up the global variables:

Code:
#include "globals.h"
#include <LiquidCrystal.h>
#include <IRremote.h>
#include <Encoder.h>
#include <EEPROM.h>

// Global Variables

boolean Standby = false;               // 0 means all is off and quiet; 1 is operating
LiquidCrystal Lcd(LCD_PORTS);          // LCD in 4-pin mode
IRrecv Irrecv(IR_PORT);                // Single pin to read IR data
decode_results Results;                // Output from IR receiver
Encoder Enc(ENC_1, ENC_2);             // Create an encoder object
long EncPos = 2;                       // Accumulator for encoder state change recognition, init to DSP
int Volume;                            // Value read from potentiometer via VOL_SENSE
byte Input = 1;                        // Default to CD input for first boot-up
byte CommandMode = 1;                  // IR and Rotary Controller (and maybe Bluetooth) "focus"
boolean CommandActive = false;         // true if we're processing a command
unsigned long CommandActiveTime;       // Time of start of new command active state
boolean Monitor = false;               // Default to source, not monitor
boolean Dsp = true;                    // DSP is active by default
boolean Mute = true;                   // MUTE is active at startup
byte RelayState = 0b10000000;          // Initialize to default state of the 8 relays
static char * Relays[] = {
  "Phono   ", "CD      ", "DAC     ", "Tuner   ", "Tape    ", "Monitor ", "DSP     ", "MUTE ALL"};
int source = 0;
First I load the different library header files, then I create a set of variables as defined above.

The system has a standby mode, during which the display sleeps, and the system is muted. The microprocessor will still be running.

The display, IR receiver, and encoder are all using libraries, so I just have to initialize them using the definitions in my global constants list that I showed in post 4 above.

The system has two operating modes: command mode and listen mode - in command mode there's something going on - usually the rotary encoder has been moved. Command mode ends with a timeout or when the button is pressed to implement a command like changing the input or muting / unmuting.

RelayState is used to feed the shift register with values for the 8 relays. The Relays variable describes the functions of the 8 relays, and the potential modes / operating conditions for the preamp.

As a naming convention, the global variables begin with an uppercase letter. Constants are all caps, and local variables and functions begin with lower case.

I'll cover the setup() and loop() functions in a separate post.
__________________
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 12th September 2013, 04:26 AM   #19
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Code: setup()

The setup function runs once at the beginning of system operation. It sets up all the initial conditions so we have a clean start.

Code:
void setup() 
{
  // Initialize relay ports and set all to their default states (using initialized value of RelayState)
  updateShiftRegister(RelayState);                  // Initialize all relays to default state
  // Mute is 1 (enabled); all others are zero

  // Initialize display ports and print splash screen
  displaySplash(1000);                              // Show splash screen for 1 second

  // Initialize rotary encoder ports
  encoderInit();

  // Initialize IR port
    IRInit();

   // Initialize bluetooth
   
   Serial.begin(9600);     // Bluetooth dongle attached to the serial port

  // Initialize volume control input and motor controls

  pinMode(VOL_SENSE, INPUT);
  Volume = volumeGet();

  // Recall source, DSP settings and set signal path
  if (EEPROM.read(ACTIVE_INPUT == 255)) 
  {                                  // First time: set default values into EEPROM
    EEPROM.write(ACTIVE_INPUT, Input);
    EEPROM.write(ACTIVE_DSP, Dsp);
    EEPROM.write(ACTIVE_MONITOR, Monitor);
  }
  // Now get values (either as saved or new values just written)
  Input   = EEPROM.read(ACTIVE_INPUT);
  Dsp     = EEPROM.read(ACTIVE_DSP);
  Monitor = EEPROM.read(ACTIVE_MONITOR);

  inputSet(Input);                  // set the selected input to be active (connected)
  DSPSet(Dsp);                       // set the DSP on or off
  monitorSet(Monitor);               // set the tape monitor on or off

  // Unmute the output
  muteSet(Mute = true);           // set the mute variable and update the register

  // Display source, volume, DSP flag
  Lcd.clear();
  updateDisplay();
}
The basic elements are obvious from the comments. We set up the shift register to initialize all the relays. We don't want any sources turned on or any sound to be produced while we're going through the setup.

We put up a splash screen and waste some time so I can have the satisfaction of seeing a custom message at startup, then we initialize the rotary encoder, IR and bluetooth functions.

Volume is a bit different - we read the position of the volume control - we want the displayed volume to reflect the actual volume.

The EEPROM stores state information between runs, so nothing important is lost at power down (so long as you remember to go to standby).

Reading the EEPROM is free, but the hardware is designed for a limited number of write cycles, so we don't initialize it except for the very first time we run. The EEPROM is storing which input is active, the state of the tape monitor function, and whether or not the MiniDSP is in-circuit.

After we've read all that, we set the relays appropriately, unmute, clear and reset the display. I am writing separate functions for different elements of the system. I'll describe them later.
__________________
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 12th September 2013, 04:33 AM   #20
diyAudio Member
 
timbarnes's Avatar
 
Join Date: Dec 2004
Location: Los Gatos
Default Code: loop()

The loop code is very simple, and I'm not sure how well it's going to work.

The idea is that we just sequentially check each source of commands, and if there is one, we process it. This could possibly break if someone interleaves inputs from different sources - for example moving the rotary encoder and then sending a signal from the remote or bluetooth.

I think I can make it work if each function leaves the system in a clean state that the next function can work from. We'll see.

Here's the loop code:

Code:
void loop() 
{
  // Operating assumption is that everything is in a valid state.
  // The job of the loop is to recognize commands that change system state,
  // and to implement the change. 
  // Each input source tests for an input, interprets it, calls the
  // appropriate implementation function, and updates the display.
  // Each subroutine blocks until it's finished processing a command, if there's one to handle.

  if (Standby)
    Standby = !encoderSwitch();            // check to see if the encoder switch has been pressed
  else
  {  // Process commands from each source in turn

    encoderCommand();                      // Used for source selection, and monitor / DSP / Mute / Standby.

    volumeUpdate();                        // Check for manual alteration of the volume knob.
    // We store the volume and display it for the user.
    IRCommand();                           // Listen for a command: volume, source, other controls.
    bluetoothCommand();                    // Bluetooth interface: same commands as IR.
  }
}
First we check for standby mode. Only pushing the button on the rotary encoder will pop us out of standby. If we're not in standby, we just call a function for each command source: rotary encoder, volume control, infrared, and bluetooth.

Each of these functions is going to do one atomic thing, and put everything back into a clean state ready for what happens next.
__________________
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:20 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