Stuck with H-bridge, PWM and Direction control for DC motor.


hi there!

here have:
internal combustion engine

what need:
keep rpm's constant

what have done:
wrote code reads rpms duration between high pulses, works great
duration setpoint pid
pid controller puts out pwm signal trying keep input same setpoint

where stuck:
throttle control...
i have hobby servo, thats little weak, came idea use windshield wiper motor one:

as throttle control motor motor output arm connected throttle body varying throttle opening.

i know have use h-bridge control motor, dont understand software part...
i understand need 2 outputs arduino, each 1 motor direction...

how make pid output controls motor ir both directions varying motor speed.
this part stuck:
when pid 1 rising, pin 2 should stay 0
instead of pin 1 dropping value, should stay 0 , pin 2 should rise instead, in way both pins wont ''hot'' in same time...

do need monitor pid's value , make ''if'' statement, prewious value monitored, , if lower turn 0?
or there easier way? like, when pid rising pin1 rising , when pid dropping pin2 rising?

thanks ;)


do need monitor pid's value , make ''if'' statement, prewious value monitored, , if lower turn 0?
or there easier way? like, when pid rising pin1 rising , when pid dropping pin2 rising?


assuming pid software produces value can positive or negative, use if-statement tests sign of output. if positive, pass first pwm pin , set second pwm pin zero. if negative, pass negation second pwm pin , hold first @ zero. in either case, limit the value write 255.

you need set term 0 stability, because motor behaves integrator.


Arduino Forum > Using Arduino > Motors, Mechanics, and Power (Moderator: fabioc84) > Stuck with H-bridge, PWM and Direction control for DC motor.


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial