|
|||||||
| Home | Forums | Articles | Links | Blogs | Register | Donations | FAQ | Calendar | Search | Today's Posts | Mark Forums Read | Search |
| Chip Amps Amplifiers based on integrated circuits |
|
We're saving for a new server - help us to serve you by Donating Today and become a friend with benefits!
Ads on/off / Custom Title / 2009 Tshirt / More PMs / Bigger Images / Advanced printing |
|
![]() |
|
|
Thread Tools |
|
|
#21 |
|
diyAudio Member
Join Date: Aug 2008
|
The only reason most people have for not including a tone control is that they want the cleanest sound possible out of their amp.
Digikey and Mouser should only be $8 shipping to Canada. www.digikey.ca and ca.mouser.com for the Canadian ones. With the cheapest shipping it usually gets to me (rural) in about 2-3 days. What gets me most is that I can usually only get half of what I want from each place. I wouldn't worry about increasing the gain for the tone control. I doubt it'll have that much difference. You can just turn the volume up a little to compensate. |
|
|
|
#22 |
|
diyAudio Member
Join Date: Nov 2005
Location: Here am I
|
Thanks for your time.
I'll see what I can get from both of them. It's been a while since I ordered some part .I'm currently trying to design the PCB for my "Master control" and I think I just su** at it. I can't for the love of god find the right place for the right component... and route everything neatly... I'm only using single sided PCB so maybe that's why it's that hard. Anyway, if any of you have tips for beginner in PCB design, I'll greatly appreciate it. I'm considering putting the the digital pots on another PCB with only the I2C bus and 5v/Gnd connector.... or maybe I could use jumpers! Anyway I'll try to post more information on the IR control digital potentiometer and yadayada so anyone can contribute to it. I've seen some IR volume control on ebay and just think they are way too overpriced and would love to bring a DIY version so anyone would be able to use build it. |
|
|
|
#23 |
|
diyAudio Member
Join Date: Nov 2005
Location: Here am I
|
For now, here is the current code (Sketch in Arduino world)
Code:
// IR Pot Control
// by Andre Quirion
// Use IR command to control 2 channel volume potentiometer
// Read and write data to an DS1807 dual taper digital pot using I2C
// Thanks to any contributor, direct or indirect.
// Most of the core code was found on the internet and on many arduino related forum, thanks ... internet!
// Created 28 June 2009
#include "Wire.h"
#include "WProgram.h"
#include "EEPROM.h"
#define WRITE_0 B10101001
#define WRITE_1 B10101010
#define POT_0_BANK 0
#define POT_1_BANK 1
#define ir_pin 2 //Sensor pin 1 wired through a 220 ohm resistor#define led_pin 13
#define MAX_POT_VALUE 63
#include "WProgram.h"
int debug = 0; //Serial connection must be started to debug
int start_bit = 2000; //Start bit threshold (Microseconds)
int bin_1 = 1000; //Binary 1 threshold (Microseconds)
int bin_0 = 400; //Binary 0 threshold (Microseconds)
int longpulse=1; //If longpulse==0 it means pulseIn() timed out
int ds1807_r = B01010001 >> 1;
int ds1807_w = B01010000 >> 1;
int pot0value;
int pot1value;
bool bChanged = false;
byte remoteOn = 0; // ==1, means remote has been pressed
void setup(){
pinMode(ir_pin, INPUT);
digitalWrite(ir_pin, HIGH); //We are not using a resistor in IR detector. Pull up
Wire.begin();
Serial.begin(57600); // start serial for output
pot0value = EEPROM.read(POT_0_BANK);
pot1value = EEPROM.read(POT_1_BANK);
writePot0(pot0value);
writePot1(pot1value);
attachInterrupt (0, remoting, RISING);
}
void loop(){
while (remoteOn==1){
int key = getIRKey(); //Fetch the key
Serial.print("Key Recieved: ");
Serial.println(key);
remoteOn=0; //reset flag
longpulse=1; //reset longpulse
if(key == 154){
//up
pot0value++;
pot1value++;
if(pot0value > MAX_POT_VALUE){
pot0value = MAX_POT_VALUE;
}
if(pot1value > MAX_POT_VALUE){
pot1value = MAX_POT_VALUE;
}
bChanged = true;
}
if(key == 158){
//down
pot0value--;
pot1value--;
if(pot0value < 0){
pot0value = 0;
}
if(pot1value < 0){
pot1value = 0;
}
bChanged = true;
}
}
if(bChanged){
writePot0(pot0value);
writePot1(pot1value);
bChanged = false;
Serial.print(pot0value, DEC);
Serial.print(" ");
Serial.print(pot1value, DEC);
Serial.print("\n\r");
EEPROM.write(POT_0_BANK, pot0value);
EEPROM.write(POT_1_BANK, pot1value);
}
}
void writePot0(int value){
Wire.beginTransmission(ds1807_w);
Wire.send(WRITE_0);
Wire.send(value);
Wire.endTransmission();
}
void writePot1(int value){
Wire.beginTransmission(ds1807_w);
Wire.send(WRITE_1);
Wire.send(value);
Wire.endTransmission();
}
void readPots(){
Wire.requestFrom(ds1807_r, 2); // request 6 bytes from slave device #2
pot0value = Wire.receive();
pot1value = Wire.receive();
}
int getIRKey() {
int data[12];
int noPulse = 0;
while((longpulse=pulseIn(ir_pin, LOW)) < 2200)
{
if(longpulse==0) // if timed out
{
noPulse = 1;
break;
}
}
if(noPulse){ // (Andre Q) My little addition to skip the 12 pulseIn command! It was hanging the UC for 12 second.
return 0;
}
data[0] = pulseIn(ir_pin, LOW); //Start measuring bits, I only want low pulses
data[1] = pulseIn(ir_pin, LOW);
data[2] = pulseIn(ir_pin, LOW);
data[3] = pulseIn(ir_pin, LOW);
data[4] = pulseIn(ir_pin, LOW);
data[5] = pulseIn(ir_pin, LOW);
data[6] = pulseIn(ir_pin, LOW);
data[7] = pulseIn(ir_pin, LOW);
data[8] = pulseIn(ir_pin, LOW);
data[9] = pulseIn(ir_pin, LOW);
data[10] = pulseIn(ir_pin, LOW);
data[11] = pulseIn(ir_pin, LOW);
delay(50); // to slow down the loop if needed
if(debug == 1) {
Serial.println("-----");
}
for(int i=0;i<11;i++) { //Parse them
if (debug == 1) {
Serial.println(data[i]);
}
if(data[i] > bin_1) { //is it a 1?
data[i] = 1;
} else {
if(data[i] > bin_0) { //is it a 0?
data[i] = 0;
} else {
data[i] = 2; //Flag the data as invalid; I don't know what it is!
}
}
}
for(int i=0;i<11;i++) { //Pre-check data for errors
if(data[i] > 1) {
return -1; //Return -1 on invalid data
}
}
int result = 0;
int seed = 1;
for(int i=0;i<11;i++) { //Convert bits to integer
if(data[i] == 1) {
result += seed;
}
seed = seed * 2;
}
return result; //Return key number
}
void remoting() // The ISR
{
remoteOn=1;
}
The hardest part was to communicate with the DS1807. I'll change many variable name (pot0, pot1...to "volume"!). I'll try to keep you updated on the change and hope to have some input! As a little note, which I don't think would change a thing, I'm using "my" custom Arduino bootloader... Actually, its the ADABoot running a 12mhz... as I didn't have any 16mhz crystal around. I'm pretty sure this sketch will run the same on any Arduino platform. |
|
|
|
#24 |
|
diyAudio Member
Join Date: Aug 2008
|
As far as layout, I won't be much help, I've only ever tried to design dual layer boards.
For the code though, you're in luck. I have experience with IR and ATMegas, and I've been developing software for over 10 years. One thing I found indispensable was an oscilloscope for debugging the timing of the IR sampling. I would suggest rather than polling, for the Sony IR standard, the simplest way I can think of would be to have an interrupt trigger on each falling edge, and calculate the time difference to determine whether it's a 1 or a 0. But perhaps this isn't the place for software discussions (you can PM me, or start a thread in another sub-forum). |
|
|
|
#25 |
|
diyAudio Member
Join Date: Nov 2005
Location: Here am I
|
I'll see if I can improve the IR part. This was found on an Arduino related forum and I didn't take time to look at it closely.
I've started a thread in the electronic forum so anyone can contribute : [PROJECT] Digitial Volume/Power Control Board |
|
|
|
#26 |
|
diyAudio Member
Join Date: Jun 2009
|
looking good. I was thinking of doing something similar, just using arduino to do the volume tone thing, not so much the IR.
I have been looking possibly hooking the arduino up to Wifi or ether and controlling it from my lap top, and perhaps trying to figure out some sort of streaming. but that might be a little ambitious ![]() keep us up to date on how it goes! |
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| LM3886 stereo - PCB design | Razor_x | Chip Amps | 2 | 3rd July 2009 01:18 PM |
| Cooling fan in my LM3886 stereo amp | Painkiller82 | Chip Amps | 5 | 10th October 2007 07:52 PM |
| Distortion in stereo LM3886 amp | umut1001 | Chip Amps | 2 | 21st August 2007 07:03 PM |
| lm3886 stereo setup | rs1026 | Chip Amps | 1 | 30th September 2004 07:25 AM |
| Stereo LM3886 amp who wants to be mono! | Gabster | Solid State | 22 | 15th September 2003 09:16 PM |
| New To Site? | Need Help? |
| Page generated in 0.17265511 seconds (82.83% PHP - 17.17% MySQL) with 11 queries |