Strange behaviour with DC motor setup

Hi,

I am trying to make the setup shown in this very common tutorial work:
http://itp.nyu.edu/physcomp/Labs/DCMotorControl You can see the setup attached.

I am using an external DC power supply, powering the Arduino Uno with 9V and with 12 V. With lower V it does not work. When I press the switch nothing happens. But when I randomly touch the wire from output 4 th motor runs for a second and slows down, runs and slows down and so on...

So i put the wire, currently in the output pin 4 in the nearby GND pin. Same behaviour as touching the wire.

So what is wrong with the setup? Why the switch doesnt cause any response?

Thanks, best regards
Florian

Simple: small 9V batteries (sometimes called PP3 size) cannot provide anything but a small current - certainly not enough for
your motor.

Hey,

yes, but I am using an external power supply, not a battery. Both motors I tried work wit

  • 4,5 Volt, 65 mA
  • 4,5 Volt, 220 mA

Thanks

filyra:
Hey,

yes, but I am using an external power supply, not a battery. Both motors I tried work wit

  • 4,5 Volt, 65 mA
  • 4,5 Volt, 220 mA

Thanks

As a motor starts up it will pull stall currents, typically many times the free-running current, the
short term overload will pull the supply voltage down and force the Arduino to reset.

Stall currents are simple to work out, measure the resistance across the motor terminals with it
at rest - I = V / R

filyra:
When I press the switch nothing happens. But when I randomly touch the wire from output 4 th motor runs for a second and slows down, runs and slows down and so on...

So i put the wire, currently in the output pin 4 in the nearby GND pin. Same behaviour as touching the wire.

So what is wrong with the setup? Why the switch doesnt cause any response?

If touching the wire connected to pin 4 makes the motor run, that indicates that your code has not set pin 4 to be an output. Post your code.