Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 8 months ago.
InterruptIn shielding?
Hi there...
I'm testing a motor shield, https://www.sparkfun.com/products/9457, and I got the basics working: I use three buttons to indicate forward, stop and backwards, and the FRDM-KL25Z's slider to control the speed. However, I'm getting electromagnetic interference on the InterruptIn switches: when I set the motor speed above the lowest setting, the interrupts are firing as if I'm pressing the buttons, but I'm not. It'll stop if it randomly triggers the stop button.
If I program it to start in a given direction, and disconnect the button wires from the mbed board, it will run, so I'm almost 100% sure it's interference on the button wires. I've also made the button wires about as short as possible, but it didn't help much.
Additionally, I ported my test program to an LPC1768 and got the same behavior, so I'm pretty sure it's not my KL25Z. As you can see from the photo, I've added a ferrite donut to the PWM line, and it helped a little, but not in any useful manner.
Any suggestions?
Some relevant code...
void triggerForward( void ) { stopped = 0; in2 = 0; in1 = 1; stdby = 1; fDist = 0.0; activeLed = &gLed; rLed = LEDOFF; bLed = LEDOFF; } int main( ... ) { InterruptIn sForward(PTD2); sForward.fall(&triggerForward); while ( 1 ) ... code to determine motor speed and set LED brightness ... }
/media/uploads/aaronminner/dsc03414.jpg
Added: I found another motor in my junk box that had twisted wiring and its own ferrite donut and plugged that in. That motor worked just fine, no stray interrupts. I'm still interested in thoughts and suggestions since I'd like to use the motor in the picture - but not have to cut off the twisted wire from the other motor. Thanks!
2 Answers
11 years, 8 months ago.
Hello Aaron,
check if the internal pull-ups are enabled or use external pull-ups. External pull-up have the advantage that you can adjust the strength. A smaller series resitor helps disipating ESD discharges.
Klaus
I double-checked the internal pull-ups, but it didn't help. I'll try again with externals and let you know. Thanks!
posted by 17 Mar 201311 years, 8 months ago.
A capacitor close to the pins is probably your best bet, possible even with a resistor in front of it to create an RC filter.