Monday, August 12, 2019

PWM, DC motors and EMI.

So I have some 9v Lego DC motors laying around and also some tracks from a Technic excavator (42006).  Also i have an arduino and lo and behold what just arrived in the post but a L298N motor driver board.. ;)  Basically, I plugged it all together ala a tutorial and it works as advertised.  Only difference is my power source is a 9.6v NiMH battery pack and I'm not using a button.  fwiw code here.

Then i connected the PWM outputs of my arduino to Ben's Oscilliscope (Rigol DS1102E), i can see we're generating a good PWM signal (between ground and IN1):


But when i connect a DC motor to the output terminals on the L298N board, i my nice PWM waveform gets a HEAP of interference, i can only assume it's coming back from the DC motor somehow:


A quick google revealed that this is a common problem caused by Electro Magnetic Interference (EMI) and may be resolved by installing capacitors between the motor terminals.

 

No comments: