Pando

being a student in software development, I am currently learning to program with an Arduino Uno with the Arduino Starter Kit (it is great, by the way !).

I arrived to Project 09 (Motorized Pinwheel) and I run into a problem that may be simple but that I cannot seem to resolve :

I made the circuit according to the drawing in the book, but when I plug the 9V battery to the 9V snap, the motor immediately starts spinning, without stopping.

If I understand well, the goal of this project is to make the motor spin only when we press the switch.But therefore in my case, it makes nothing (the motor spins, the switch being pressed or not ...).

I really don't understand what I am doing wrong, so I am today asking for your help !Maybe I didn't understand the real purpose of this project, and/or I'm missing the obvious (I think that's it ! ).

I put a photograph of my circuit in attachment.Because everything doesn't appear on it : the red and black wires on top right lead to the 9V battery snap and the ones at bottom right lead to the motor (like in the book's circuit drawing).I believe that it perfectly fits the schema, so I really don't understand !

I also put the sketch I upload to my Arduino, despite the fact that I don't think it changes something...(it is a complete copy-paste of the book's code, if there is a problem with it, I'm missing the obvious)

I don't have the book or schematic in front of me, but from the pictures it looks like you're wiring the motor directly to the power. You have the hot/red wire directly connected to the right-side power strip (assuming that the 9v supply is attached at the top) and you have the black connecting through the diode to ground. Where's the "switch" to turn that off?

EDIT (6/1/13)Am now at home, looking at the diagram it seems that the diode goes to the positive bus, not the negative bus as your picture shows...

Pando

Well maybe I was wrong on that point, but the thing is that I tried again today (with the diode being at the right place !) and guess what...

Now the motor never spins... =( (I mean in the circuit, if I plug it only in circuit with the 9V battery, it still works)

Actually I think that at my previous attempt, I inverted the battery snap poles, plugging the (-) one to the battery's (+), and vice versa.It may explain why it was spinning before, and why it isn't now.The thing is that when I press the button, it still doesn't spin...

I begin to wonder if, during my many manipulations trying to get it to work, I haven't broken something like the transistor.Especially if, as I think, the current has been reversed at any time.(If that's it, given that I tried with the two transistors bundled with the kit, they may be both broken )

By the way this may seem very silly, but, following the book's circuit schema, when they say the metal tab to be "facing away from you", they of course mean that the face with the little black rectangle thing must be facing the Arduino, right ?

I must admit I'm running out of ideas ... :|

EDIT: After having changed all the pieces of the circuit (push button, transistor, resistor ...) I finally got it to work as expected ! This way, I'm not afraid anymore to have something broken since I know it worked at least once. Thanks for the help !

I'm in the same condition of Pando, I plug the 9v battery and the motor never stop to spin, and I haven't solved the problem changing all the pieces (mosfet, button...) and I have the same code...what I can do to solve?Thank you in advance..

LuKux

I tried using pin 8 instead of pin 9 and it worked!I think it could be a problem in using PWM pin 9...Another solution could be to use analogWrite(9,255) instead of digitalWrite(9,HIGH) and analogWrite(9,0) instead of digitalWrite(9,LOW).

The PWM outputs generated on pins 5 and 6 will have higher-than-expected duty cycles. This is because of interactions with the millis() and delay() functions, which share the same internal timer used to generate those PWM outputs. This will be noticed mostly on low duty-cycle settings (e.g 0 - 10) and may result in a value of 0 not fully turning off the output on pins 5 and 6.

If that is your case, then, it explains the behavior of your project. Regards!

P.S. Remember also that the motor slows down for certain amount of seconds.

I realize this is an old topic, but the problem is apparently perennial because I just experienced it today. In my case the error was in my copying over of the software. Where the code should say...

if (switchState == HIGH) {

I had a single equal sign (=) rather than a double equal sign (==). Instead of a comparison I was making a variable assignment, which always returned TRUE. It's valid code, so the error wouldn't be caught by the compiler, and it made the motor run under any condition.

I just experienced this same problem. One thing I noticed was that when I added power to the circuit, the transistor started to burn and I smelled a strong burning smell from it. I unplugged the power but I don't know where the problem is. The switch also doesn't mean anything, the motor just constantly spins no matter what.

Edit:I got it to work! The problem was actually really simple but I plugged the battery in and the nplugged in the usb, but I forgot to upload the sketch to my board. Once I uploaded the sketch to the board, it worked.

being a student in software development, I am currently learning to program with an Arduino Uno with the Arduino Starter Kit (it is great, by the way !).

I arrived to Project 09 (Motorized Pinwheel) and I run into a problem that may be simple but that I cannot seem to resolve :

I made the circuit according to the drawing in the book, but when I plug the 9V battery to the 9V snap, the motor immediately starts spinning, without stopping.

If I understand well, the goal of this project is to make the motor spin only when we press the switch.But therefore in my case, it makes nothing (the motor spins, the switch being pressed or not ...).

I really don't understand what I am doing wrong, so I am today asking for your help !Maybe I didn't understand the real purpose of this project, and/or I'm missing the obvious (I think that's it ! ).

I put a photograph of my circuit in attachment.Because everything doesn't appear on it : the red and black wires on top right lead to the 9V battery snap and the ones at bottom right lead to the motor (like in the book's circuit drawing).I believe that it perfectly fits the schema, so I really don't understand !

I also put the sketch I upload to my Arduino, despite the fact that I don't think it changes something...(it is a complete copy-paste of the book's code, if there is a problem with it, I'm missing the obvious)

Thank you for your time, and bear with me if I'm doing something obviously wrong, I'm a complete beginner at electronics :~

So this is my first post in this forum, Horray!Fanfare aside....

One thing I noticed when I built this circuit is that the motor did fire up right away when I got everything connected but them I remembered that I still had the code from my previous project (the "mood Cue" servo motor project) uploaded on the Arduino. I'm not saying this is your problem but definitely upload the code for the "motorized pinwheel" project prior to hooking up the 9V battery.