Higher Voltage on H-Bridge is triggering interrupt

I am using an Arduino UNO, an L293D H-bridge to drive a 5V dc motor and a cheap cutedigi encoder. When I attach an 11V LiPo battery to the H-Bridge VMotor pin it automatically triggers both interrupts. However if I am using the 5V from the UNO it works just fine. I do not have either interrupt pin connected to the H-Bridge. In the attached wiring diagram the white wire is the Vmotor pin so it changes from being connected to the UNo 5V to the battery’s 11V. The purple wire and the adjacent GRD/5V are to represent the encoder, no object for it. just the wiring.

So, with the code below, when using the UNO 5V it does not return and value until I put the encoder over the disk but when I attach the 11V it start to count up even if I completely disconnect the wire from the breadboard.

int sensorA = 3; // just a reminder what PIN the encoder sensor A in on

int enablePin = 5; //h bridge enable pin
int input1 = 8; // input 1 also called in1Pin
int input2 = 9; //input 2 also called in2Pin

volatile int x;

void setup()
  attachInterrupt(1, readEncoder, CHANGE);
  pinMode(enablePin, OUTPUT);
  pinMode(input1, OUTPUT);
  pinMode(input2, OUTPUT);

void loop()
  analogWrite(enablePin, 255);
  digitalWrite(input1, HIGH);
  digitalWrite(input2, LOW);

void readEncoder()


Perhaps you should be setting the interrupt pin to INPUT_PULLUP with pinMode() or adding an external pullup or pulldown resistor to it?

Perhaps you should be setting the interrupt pin to INPUT_PULLUP with pinMode() or adding an external pullup or pulldown resistor to it?

Unfortunately that did not help. I tried a resistor and setting it to INPUT_PULLUP. Still activates the interrupt when i attach the higher voltage

I have narrowed it down to having the sensor cable plugged into the same breadboard as the interrupt pin cable. They do not even have to be on the same row/column nor does the sensor need to be powered on. They just have to be plugged into the same bread board, I tested with 3 different boards.

Sounds like the interrupt pin needs a capacitor to prevent stray spikes from inducing voltage in it?

With a bit more troubleshooting I found it only happens when the motor is powered on, If I unplug it the it stops counting up.

I was wondering about capacitors myself. I was doing some more research and found this form link that talks about motors creating lots of extra electrical noise that may be causing the problem. I might just need a bigger resistor. Do you know how I would calculate the size of the capacitor I would need?

I'm no EE, but to pull a an anti-EMI capacitor value out of the air I'd say 100nF?

As for the external pullup or pulldown resistor, 1k is a place to start.

I tried a 100UF capacitor with no luck and a serial of 10k resistors with no luck. Not sure how to string capacitors in series

100uF is way too big. The bigger capacitors cannot respond to transients quick enough. Try 100nF and go smaller from there, down to 0.1nF.

Digging around I found a ceramic disk one with 503 on it and that seems to have done the trick. Thank you.