Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: mobz on December 13, 2007, 07:48:01 AM

Title: Pulse width modulation
Post by: mobz on December 13, 2007, 07:48:01 AM
Hey there.i have managed to complete my first robot thanks to you guys.but one thing is im not controlling my speed so when turning it crushes into walls.i researched that with pwm,i can give 1 wheel say 20% the other 80% and make a smooth turn.i googlled it but nothing .can somebody help??

And last thing how can i increase my ir sensor range ??im getting small ranges i dont know why??
Title: Re: Pulse width modulation
Post by: Admin on December 13, 2007, 08:05:26 AM
Can you tell us more about your hardware?

Are you using DC motors? And what kind of motor driver do you have?

PWM is when you turn your motor on and off really really fast. So if its off 50% of the time, your motor will go at about 50% speed. Just send a square wave (off on off on) to your motor controller.

For example:
Code: [Select]
pin_high
delay_5ms
pin_low
delay_5ms
loop
Title: Re: Pulse width modulation
Post by: mobz on December 13, 2007, 08:24:04 AM
im using GM8 DC motors,quad h bridge and an atmega8.
Title: Re: Pulse width modulation
Post by: Mega on December 13, 2007, 10:36:04 AM
What kind of IR sensors do you use?
Title: Re: Pulse width modulation
Post by: Admin on December 13, 2007, 11:01:46 AM
Quote
quad h bridge and an atmega8.
quad? are you controlling four motors? which pins are you using to control the h-bridges and what are you doing in software?