I am using a Arduino (Eleven 100% UNO compatible) to drive a small 5 volt DC motor that I got out off a little USB keyboard vacuum cleaner. I am using a HBridge to give me reverse and braking options. I am using PWM to control speed and pins 2-5 to switch the 4 BC548 NPN transistors. I all have several switches (pins 9-13) but when the motor runs I start to get noise in my switches that will from time to time report HIGH (never when the motor is off). I am not that good on the electronics side, but I am sure that the noise is coming from the motor. Is there any way to block the electrical noise from the motor.
Thanks.. I think I have worked it out, but yet to get the parts and try it. I will put a small capacitor across the motor, that should stop some of the noise. But if I put a diode across the motor I will stop the breaking effect that the H bridge gives me. Also I am going to add resistors from the Arduino pins to the transistors.
Sorry don't have a image of the circuit but its a very basic HBridge. Will reply when I have the results from adding the capacitor. I am going to add a LDR to read a mark on the motor shaft. That way I can dial in motor speed rather then voltage via PWN. That may help me brake via software and the let me use a diode across the motor to stop the spikes. The spikes are most likely from the off duty time of the PWN pulse as the motor coasts.