Pages: [1]   Go Down
Author Topic: Motor control issues with ATTINY85  (Read 875 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I have a standard DC motor that I pulled from something some years ago. I don't know the specs on the thing but if i plug it into my arduino uno's 5V+ and GND- it runs just fine. So I wrote a simple code to upload to my ATTINY and see if I could control it. So far I haven't even tried PWM with it.

This is the code I wrote:

//ATtiny85 motor controller

const int motorForward = 1;

void setup()
  pinMode(motorForward, OUTPUT);   

void loop() {
    digitalWrite(motorForward, HIGH);
    digitalWrite(motorForward, LOW);

So to my understanding it should run the motor for one second and then rest for one second if I have 1 of the motor's leads grounded and the other lead plugged into pin 1 on the ATTINY85 with the ATINY powered. Unfortunatley this is not the case and instead it will not turn my motor at all. Any reasons why?

Global Moderator
Offline Offline
Brattain Member
Karma: 309
Posts: 26509
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Any reasons why?
Yes, your processor cannot drive a DC motor directly.
Don't even try.
Use a transistor.

If you go over to the Playground, you should find lots of examples of how to do this and what to use.
« Last Edit: October 13, 2012, 04:43:55 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: