go_away

Author Topic: Help with PWM on ATMega168!  (Read 2582 times)

0 Members and 1 Guest are viewing this topic.

Offline cloneTopic starter

  • Jr. Member
  • **
  • Posts: 38
  • Helpful? 0
Help with PWM on ATMega168!
« on: January 27, 2009, 10:07:10 AM »
OK so I'm using the arduino board with atmega168, and i basically just want to adjust the speed of a DC motor using a potentiometer and PWM.

How do i do this???!!
thanks

Offline yerbie

  • Full Member
  • ***
  • Posts: 62
  • Helpful? 3
Re: Help with PWM on ATMega168!
« Reply #1 on: January 27, 2009, 11:39:37 AM »
Member Tutorials:
PWM on ATmega168: http://www.societyofrobots.com/member_tutorials/node/226
PWM Overview: http://www.societyofrobots.com/member_tutorials/node/228

Not sure how you would do it using a pot, but you can adjust the speed with just pwm
« Last Edit: January 27, 2009, 11:41:35 AM by yerbie »

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 108
Re: Help with PWM on ATMega168!
« Reply #2 on: January 28, 2009, 03:09:06 PM »
Connect the pot to an ADC to give you a value from 0 to 255 and then use this to adjust the duty cycle of the PWM.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline cloneTopic starter

  • Jr. Member
  • **
  • Posts: 38
  • Helpful? 0
Re: Help with PWM on ATMega168!
« Reply #3 on: January 29, 2009, 10:32:04 PM »
im under the understanding that you cant have a DC motor hooked up directly to the arduino or it will have disasterous affects.. and also i watn to run the DC motor at 12 volts.. so what should i use as a 'motor driver'??

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,132
  • Helpful? 108
Re: Help with PWM on ATMega168!
« Reply #4 on: January 29, 2009, 10:50:20 PM »
You need to find the maximum (stall) current for your motor and then find a motor controller that can supply it. Hard to recommend any driver without knowing the current requirement.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here