PDA

View Full Version : Motor Spikes triggering false External Interrupts



maddy_nish
03-04-2011, 10:43 PM
Hi,

I tried realizing odometry with AVR , now it seems like the spikes generated by motor is triggering external interrupts. I even soldered 104 capacitor across the Vcc and GND of micro. But still the problem persists. Now im using PWM to control motor. If i avoid using PWM then everything seems to be fine.

Pls help how can i avoid these false interrupts from being triggered.

vikas
03-05-2011, 01:36 AM
Circuit Please , also what is the power source of the robot ?

allbits
03-05-2011, 06:20 AM
and also give the voltage and current consumption of the motor How close you have kept the motor from the board. And also, how you come to the conclusion that false interrupts are being generated. In normal cases, fast switching of motor can reset the micro, due to disturbance in power lines, but the motor should be too noisy to activate an external interrupt. Check the code, there might be a bug in it.

maddy_nish
03-05-2011, 08:58 AM
Hi.. Please find the circuit attached. Im using four NiMh batteries to power the circuit as well as the motor driver. Im using a L293D motor driver. Im using 150 rpm motors 6v @ 60ma current. I have tried to accommodate everything in a CD as Im using CD as the base. I tried using optocouplers between the mega8 circuit and motordrivercircuit and powered them separately. Then i find everything to be right. If i connect them without optocouplers and use a common power source i can find the external interrupts to take wrong counts.

Also i tried a test program to count 10 wheel rotation and stop the motor. But the motors stopped in 4 rotations itself hence i concluded that spikes should have triggered false interrupts. False interrupts get triggered only when i use PWM.

Coolpratheesh
03-05-2011, 09:19 AM
Dude i know what the problem is ........... I have come across it many a times.....

Coolpratheesh
03-05-2011, 09:22 AM
what you are doing is u r level trigerring your interrupt and the interrupt is counting more than once in the same pulse. So take variable that sets each time u enter the interrupt and resets wen you exit the level. so that you count only once every interrupt. I think you might have got me.

vikas
03-05-2011, 12:14 PM
Dude , The circuit you provided is as good as providing nothing. Give the full circuit .

Vivek
03-11-2011, 12:49 AM
If the false interrupt is on INT0 (pin4) (sure with will be it if it is not now), you need a pull-up resistor say 5.1khohm to VCC.

Even if motor is not there, the open INT pin will cause false triggers.

maddy_nish
03-11-2011, 10:15 AM
Hi,

Thanks for the reply. Its now working. I used optocouplers to separate the microcontroller board and motordriver. Im using separate power supply for the two.