I am very new to the Arduino and also a novice with electronics.
I have begun using an Arduino Mega 2560 as I would like to build a fully functional pre-amp with a MiniDSP at it's core. It will have 4 switched analogue inputs, 4 switched digital inputs, 8 channels of output (four way stereo speakers) and be controlled by IR remote and rotary encoders. Later I would like to add 6 channels of volume controled input for surround from a Blu-Ray or Computer. Quite a large project for a beginner like me!
First things first: I would like to switch the analog inputs with a relay based set up I bought on ebay before I decided to use a micro-controler to do the switching. This currently uses a rotary switch to put 12V through the centre pin of a transistor, which in turn opens a relay.
Am I right in thinking that if I give the Arduino a common ground to the switching plane of the relay board, I will be able to change the resistor/transistor/both to allow me to control the relays with a 5V digital pin (four pins in total) from the Arduino? Basically I want the Arduino to take the place of the rotary switch but it has a 5V output rather than 12V.
If so, can somebody help me calculate/spec which resistors and/or transistors I will need to acomplish this? In side my case I intend on fitting a 12V DC power supply for the DSP and switching with a regulator to give me 5V for the Arduino; so powering the setup should be covered.
Many thanks in advance for any help you can give a beginner!
Yes you are right. In fact it will likely work just fine with no changes whatsoever. Worst case reduce the values of the base resistors to something like 680 ohms if the relays don't actuate. I doubt you'll need to. The transistors should have enough gain to work with the circuit as is.
I have exactly the same relay board (probably from the same eBay guy) acting as an input selector for some powered speakers, and an Arduino controlling the inputs - I didn't need to change the resistors, just wired the Arduino outputs directly to the board in place of the rotary switch.
Good luck with the project! At least it sounds like something you can build and get working one module at a time... bite sized chunks, that's the key
I will have a go at it tonight and post the results here and to my blog.
Last night I managed to get an LCD plumbed in and displaying a potentiometer input as : Volume: 45% . As you change the potentiometer it maps to give a value of 0 - 100. Very basic but it's getting there. Next I want to add some buttons and use them to control this selector.
If I supply it with a an 18-0-18 vac transformer, it will spit out a regulated 12V. Perfect for my MiniDSP 2x8. From this I will be able to use a regulator to give me 5v for the arduino. Should save me having to have too many power supplies in the case. In fact the 18-0-18 transformer could also supply the +/- 15v low noise power supply I have for the phon stage, but I am worried about noise getting into it from this board. What do you guys think?
I wrote a very simple program to cycle through the inputs. Open a relay for two seconds, close it for half a second, then open the next. Very exciting....
/*
Simple program to turn on and off input relays - Jai Stanley - 28/03/2012
*/
int Phono = 53;
int Tape = 51;
int iPod = 49;
int Aux = 47;
void setup()
{
pinMode(Phono, OUTPUT);
pinMode(Tape, OUTPUT);
pinMode(iPod, OUTPUT);
pinMode(Aux, OUTPUT);
}
void loop()
{
digitalWrite(Phono, HIGH);
delay(2000);
digitalWrite(Phono, LOW);
delay(500);
digitalWrite(Tape, HIGH);
delay(2000);
digitalWrite(Tape, LOW);
delay(500);
digitalWrite(iPod, HIGH);
delay(2000);
digitalWrite(iPod, LOW);
delay(500);
digitalWrite(Aux, HIGH);
delay(2000);
digitalWrite(Aux, LOW);
delay(500);
}
I will busy myself making the LCD echo the current output and 'volume' from the pot. My fiancée just told me I made the leap from geek to nerd. Excellent. Now I just need a lab and a devious plan to take the leap to evil genius.