problem with serial data - which powersource?

Hei

I am making my final exam project in electronic science on high school level. It is an electronic wireless flute. As an added feature I have made a processing program that is supposed to make a visualisation of the tones the flute is playing.

I use an Duemilanove to send the data to the computer. My problem is that when I connect the Duemilanove to the outputs of the dekoder that dekodes the wireless serial data the arduino somehow produce an output. i can hear this because the same legs on the dekoder are connected to some astable multivibrators that drives a buzzer each and they become activated when the Duemilanove is connected even though no input to activate them is received from the wireless communication.

I think the problem lies in the way I get power to the arduino. right now the VIN is connected to my +5V supply line on the breadboard and GND is connected to ground.

Someone who has any idea what’s going on? the program code for the Duemilanove is belov:

/*Variabeldeklaration, jeg definerer 
her på hvilke ben hver af tonesignalerne
går ind på Atmel microcontrolleren. 
*/
int c = 0;
int d = 1;
int e = 2;
int f = 3;
int g = 4;
int a = 5;
int b = 6;
int C = 7;

//samt hvilke ben volumen går ind på
int vol0 = 8;
int vol1 = 9;
int vol2 = 10;
int vol3 = 11;

//en variabel der indeholder volumen
int vol = 0;

void setup() 
//Denne funktion kører en gang når microcontrolleren starter
{ 
  pinMode(c,INPUT);
  pinMode(d,INPUT);
  pinMode(e,INPUT);
  pinMode(f,INPUT);
  pinMode(g,INPUT);
  pinMode(a,INPUT);
  pinMode(b,INPUT);
  pinMode(C,INPUT);
  pinMode(vol0,INPUT);
  pinMode(vol1,INPUT);
  pinMode(vol2,INPUT);
  pinMode(vol3,INPUT);
  
  Serial.begin(9600); //jeg starter seriel kommunikation med computeren
}

void loop() //Denne funktion kører kontinuert efter at setup() har kørt
{
  //først gemmes den binære værdi af volumen i vol  
  vol = digitalRead(vol3)*8+digitalRead(vol2)*4+digitalRead(vol1)*2+digitalRead(vol0);
  
  /*
  jeg sender en række af tekststrenge til computeren der ser således ud:
  c<værdi på ben 0>
  d<værdi på ben 1>
  e<værdi på ben 2>
  f<værdi på ben 3>
  g<værdi på ben 4>
  a<værdi på ben 5>
  b<værdi på ben 6>
  C<værdi på ben 7>
  v<værdi af variablen vol>
    
  "newline" karakteren som afslutter hver tekststreng samt hvad
  hver tekststreng starter med fortæller om hvilken variabel der bliver overført
  */
  Serial.print("v");
  Serial.println(vol);
  delay(200);
  Serial.print("c");
  Serial.println(digitalRead(c));
  delay(200);
  Serial.print("d");
  Serial.println(digitalRead(d));
  delay(200);
  Serial.print("e");
  Serial.println(digitalRead(e));
  delay(200);
  Serial.print("f");
  Serial.println(digitalRead(f));
  delay(200);
  Serial.print("g");
  Serial.println(digitalRead(g));
  delay(200);
  Serial.print("a");
  Serial.println(digitalRead(a));
  delay(200);
  Serial.print("b");
  Serial.println(digitalRead(b));
  delay(200);
  Serial.print("C");
  Serial.println(digitalRead(C));
  delay(200);
}

the delays are for debugging

Can you post a schematic of your setup? It's very hard to find a problem like this with just a verbal description of the circuit.

A picture says more than a thousand words ;-) here is the picture of the schematic: the 4 unconnected wires are in fact connected to an D/A converter that controls the voltagedrop over the eight buzzers.

If it would help I could also translate the Danish comments in the program but the program itself is just a variation of the Virtual Color Mixer example

Again, I think the problem is how to connect the powersource of the Duemilanove with the rest of the circuit.

okay I found the problem myself. When I connected the arduino to an external powersource it began to misbehave. when it was powered by the usb itself but still connected to the rest of the circuits ground it worked as intended. Well at least with a little test I have just done on a prototyping board. I have still to try it when it's connected to the encoder. I'll write how that went tomorrow.