Problem with L298N and motors

I have this DX H-bridge board, which seems to be an exact clone of this one.

I was using it to switch an electromagnet and it works fine as long as I keep the EM away from other USB peripherals. If it’s too near the peripherals pick up a lot of interference and stop working until I reconnect.

Now I’m trying to power a small “toy car” DC motor with it - the motor’s been harvested a long time ago and has no datasheet or markings but it looks like a 3V motor.
I connected the three control pins to the arduino and used a pot to control speed (PWM < 127 on enable pin to avoid frying the motor) and direction. I’m using 2x16340 batteries for the motor power and USB for the arduino, with the grounds connected.

The interference is so high it’s making the computer’s USB malfunction even with the motor 1m away. After a couple seconds playing with the pot the serial monitor on the computer stops receiving data (the analog reading of the pot) and I have to reconnect to make it work again, can’t even upload a sketch after it “crashes”.

I stopped experimenting with this because I’m afraid it’ll damage the computer.

Am I doing something wrong? Is there a problem with the H-bridge board or is this normal?

Both of your links are broken, so I do not really know what motor controller you’re thinking of.
What is the power source for your motor? The symptoms you mention could be caused by overloading the USB power supply.
Or they could be caused by excessive noise or voltage transients, if the motor controller does not have proper blocking diodes and bypass capacitors.

Or they could be caused by excessive noise or voltage transients, if the motor controller does not have proper blocking diodes and bypass capacitors.

The correct links are:

As you can see, the diodes all appear to be in place; there are even a couple of caps. Though there appears to be a large (likely electrolytic) cap missing on the board; what it is for - dunno, but you might want to look at that...

Also - does your motor have non-polarized filtering caps installed on it? Most small motors should have these installed if there is excessive electrical noise coming from the motor; basically three of these caps are soldered on: one across the terminals, and one from each terminal to the case (these may be difficult to do put in place, though - start with the single one across the terminals). The caps need to be rated for the voltage of the motor (which shouldn't be an issue; most caps are rated for much more voltage than such a small motor will see). You want something around 0.1µF; see this article for more information:

Also - do you have the jumpers set properly to use your external motor supply? I'm only asking because maybe the motor is still trying to be powered from the USB supply, and is causing a voltage sag or something that is messing up the USB...

Hmm - I'm looking at that capacitor C1 that is empty (on the second link, too) - it looks like it is for the on-board voltage regulator of the L298 board; maybe one should be put in place after all (not sure what the value should be; I'd start with the LM7805 datasheet reference design for an idea).

Sorry about the links, fixed.

I'm powering the motor from 2 16340 batteries (3.7V each). I've tried powering both arduino and H-bridge from the batteries and just the H-bridge with the grounds connected. Makes no difference.

The motor has no caps, it looks like this. I'll try soldering some caps but I'll have to go shopping first.

AFAIK there are no jumpers to set the power source.. Shouldn't be a problem since the only wires connecting the arduino to the bridge are the 3 signals and the common ground. That 5V_EN jumper is to disable the regulator (haven't tried that since I'll need to supply 5V externally).

I might try to add that missing cap, might help since it's between the 5V and gnd rails.

I also noted that this board has pull-up resistors for every signal rail, most can be disabled but the ones for the enable pins cannot. Can this get interference back to the Arduino? Should I cut the rails?