IR sensor don't work when too much power

Hello,
I have a problem and i dont know why…
My objectiv is to active a motor and choose a speed for it (half or full speed) without motor shield , so i have done a plan with transistor, it work pretty good.
To change my speed i use an ir controller , i have put the ir receptor in the interrupt mod , when i send a 5v to the motor its ok , but when i switch to the second mode (full speed 9-10v) the IR sensor don’t work anymore. It detect some signal but no the correct one …
Do you know why?

There is my code :

const int pilote_trans_2 = 12;
const int pilote_trans = 13;
const int ledR = 3;
const int ledG = 5;
const int ledB = 6;
const int piezo = 11;
const int broche_ir = 2;
int color_musique;
int already_played;


int stade = 0;

IRrecv reception_ir(broche_ir);
decode_results decode_ir;

void setup() {
  Serial.begin(9600);
  reception_ir.enableIRIn();

  pinMode(pilote_trans,OUTPUT);
  pinMode(pilote_trans_2,OUTPUT);
  pinMode(ledR,OUTPUT);
  pinMode(ledG,OUTPUT);
  pinMode(ledB,OUTPUT);
  pinMode(piezo,OUTPUT);
  pinMode(broche_ir, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(broche_ir), info_ir, CHANGE);

}

void loop() {
  switch(stade)
  {
    case 0:
      allumerRouge();
      digitalWrite(pilote_trans,LOW);
      digitalWrite(pilote_trans_2,LOW);
      digitalWrite(piezo,LOW);
      break;
    case 1:
      allumerBleu();
      digitalWrite(pilote_trans,HIGH);
      digitalWrite(pilote_trans_2,LOW);
      digitalWrite(piezo,LOW);
      break;
    case 2:
      allumerVert();
      digitalWrite(pilote_trans,LOW);
      digitalWrite(pilote_trans_2,HIGH);
      digitalWrite(piezo,LOW);
      break;
    case 3:
      digitalWrite(pilote_trans,HIGH);
      digitalWrite(pilote_trans_2,LOW);
      chanson_mario();
      allumerPastel();
      break;
    default:
      break;
  }
}
void allumerRouge(){
  // allume rouge 
  digitalWrite(ledB,LOW);
  digitalWrite(ledG,LOW);
  digitalWrite(ledR,HIGH);
}
void allumerBleu(){
  // allume bleu 
  digitalWrite(ledB,HIGH);
  digitalWrite(ledG,LOW);
  digitalWrite(ledR,LOW);
}
void allumerVert(){
  // allume vert 
  digitalWrite(ledB,LOW);
  digitalWrite(ledG,HIGH);
  digitalWrite(ledR,LOW);
}
void allumerPastel(){
  // allume vert 
  analogWrite(ledB,80);
  analogWrite(ledG,0);
  analogWrite(ledR,80);
}

void info_ir()
{
  if(reception_ir.decode(&decode_ir))
  {
    Serial.println(decode_ir.value, HEX);
    switch(decode_ir.value)
    {
      case 0xFF30CF:
        stade = 0;
        break;
      case 0xFF18E7:
        stade = 1;
        break;
      case 0xFF7A85:
        stade = 2;
        break;
      case 0xFF10EF:
        already_played = 0;
        stade = 3;
        break;
      default:
        break;
    }
    reception_ir.resume();
  }
}

And my plan :
(see attachments) R6 is the motor equivalent

And i’m on an arduino UNO
Thanks for you help.

Capture.PNG

Two things I see right off.

  1. you can't Serial.print() in an interrupt function.

  2. you specify an interrupt on change, so you get one interrupt when light goes on and another when it goes off. Is this what you want?

Paul

Thanks for you reply ,

  1. I use serial print on the interrupt just for the test , but after i will remove this line
  2. Not specially i just want when light come , but this dont seem to make problem on my sketch , because when i dont make the motor at full speed the IR sensor work 100% like a want..