arduino Lesson 13 Help

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MasonLev
 
Posts: 15
Joined: Thu Sep 04, 2014 1:42 am

arduino Lesson 13 Help

Post by MasonLev »

Hello all,

I followed the instructions for Lesson 13 and got the project working great! I am using a motor I scavenged from an old computer and got it to run at 30 perfectly multiple times which is a perfect speed for a model turntable for the project I'm working on. So I soldered everything together hooked it back up, and it suddenly stopped working. After unsuccesfuly trouble shooting, I then rebuilt the circuit from scratch and it now will only work at 130. If I go lower the motor will turn off. If I go higher the speed stays the same. I thought it was the motor so I tried it with another one that had worked at low speed before, but it also would not work at low speed. I am slightly worried the problem is the arduino. Is there something simple that I'm missing ?

I am using an arduino Mega 2560 with an adafruit sound shield. The markings on the motor I am using are HKN-3A2D3 12Jul99CE1 O. The project I'm working on is for the cake topper for my BANNED in 3 weeks so any help anyone could give me would be greatly appreciated even if its a new approach to get a motor to spin slowly. I am open to anything.

Mason

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: arduino Lesson 13 Help

Post by zener »

I will throw out some random ideas. Maybe someone else has a better idea.

Did you modify the example code at all?

Did you use the diode across the motor connections? (D1 in the example circuit in the tutorial)

You could try changing the pin ID in the code from 3 to another pin and see if that works any better.

You could measure the voltage at the pin with a multimeter, at different settings and see if it acts correctly.

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: arduino Lesson 13 Help

Post by adafruit_support_bill »

What part of the computer did the motor come from (fan, disk drive etc)? I can't find any data on that particular model, but most of the motors found in computers these days are steppers or brushless DC type motors. These are not as easy to control as a brushed DC motor.
https://learn.adafruit.com/adafruit-mot ... tion-guide

If you can post photos, it might help us spot the problem.

User avatar
MasonLev
 
Posts: 15
Joined: Thu Sep 04, 2014 1:42 am

Re: arduino Lesson 13 Help

Post by MasonLev »

Thanks for getting back to me so fast! I will start out with you questions first Zener:
Zener wrote:I will throw out some random ideas. Maybe someone else has a better idea.

Did you modify the example code at all?
I did modify the code and tested it before I soldered together the components and it worked just as well as the unmodified version. I will upload it tonight when I get home. When things got funny I went back to the unmodified code and it still didn't work.

Did you use the diode across the motor connections? (D1 in the example circuit in the tutorial)
I did. It was a 1amp diode.

You could try changing the pin ID in the code from 3 to another pin and see if that works any better.
I changed it to pin 47 then tried a few other random ones around the board with no success.

You could measure the voltage at the pin with a multimeter, at different settings and see if it acts correctly.
I will do that tonight and post back what I find.

Here are a few photos of the project. The first one is of the motor. If I remember correctly the motor came from an old CD-Rom drive. The second one is the breadboard configuration that I have and the third is the arduino I am using.

Thanks guys. Hope this helps.

Mason
Attachments
Arduino
Arduino
photo 3.JPG (611.38 KiB) Viewed 733 times
Breadboard configuration
Breadboard configuration
photo 2 (1).JPG (588.66 KiB) Viewed 733 times
Motor
Motor
photo 1.JPG (557.24 KiB) Viewed 733 times

User avatar
MasonLev
 
Posts: 15
Joined: Thu Sep 04, 2014 1:42 am

Re: arduino Lesson 13 Help

Post by MasonLev »

I should mention also that in the picture of the arduino the two lines that are taped together are a button connected to +5v and pin 36 that activates a different program. It was connected to the board the when the motor was working.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: arduino Lesson 13 Help

Post by zener »

In the second picture it does not appear that the base resistor is connected to the correct breadboard row. Hard to say for sure though. Anyway that wouldn't give the exact symptoms you have.

User avatar
MasonLev
 
Posts: 15
Joined: Thu Sep 04, 2014 1:42 am

Re: arduino Lesson 13 Help

Post by MasonLev »

Yes it wasnt in the picture but was during the testing sorry about that. This was the code I used when I got the motor running the way I wanted it.

/*
Adafruit Arduino - Lesson 13. DC Motor
*/


int motorPin = 31;
void setup()
{
pinMode(motorPin, OUTPUT);
}


void loop()
{
int speed = 30;
if (speed >= 29 && speed <= 31)
{
analogWrite(motorPin, speed);
}

}

I couldn't get my hands on a multimeter today so I don't have any results from that. I tried the sketch again tonight at 150 and it wouldn't work unless I turned the motor to the side. Could this in fact be the culprit?

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: arduino Lesson 13 Help

Post by adafruit_support_bill »

it wouldn't work unless I turned the motor to the side.
That sounds like a possible loose connection. Check all the connections to make sure they are solid. If the motor wire is stranded, you can solder the ends to header pins, or short pieces of solid-core wire for a more reliable connection to the breadboard.

User avatar
zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Re: arduino Lesson 13 Help

Post by zener »

I am wondering if that motor is some kind of stepper but I never heard of a 2 wire stepper motor...

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”