Shop OBEX P1 Docs P2 Docs Learn Events
Driving a DC motor in reverse using PWMPAL? — Parallax Forums

Driving a DC motor in reverse using PWMPAL?

heitchheitch Posts: 3
edited 2007-03-21 16:10 in BASIC Stamp
Hi, is it possible to drive a motor in reverse using PWMPAL with my BS2e? I have the circuit wired as the sample that came with the PWMPAL documentation?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-20 17:55
    You can drive a motor in reverse just by connecting it "backwards". If you want to select the direction under control of the Stamp, you will need something called an "H-bridge" (because of the form of its schematic). The PWMPAL still is the device that controls the speed of the motor, but the H-Bridge controls the direction. Do a Google search for "wiki h-bridge" and you'll find some good explanations. Parallax sells several motor controllers that incorporate an H-bridge and I think some of their tutorials cover it. Search these forums for the term.
  • heitchheitch Posts: 3
    edited 2007-03-21 01:38
    Thank you for the response. Yes i want to control the motor direction. I know about h-bridges. I was hoping for some magic like using 2 different outputs from the PWMPAL with a different wiring setup to run the motor in reverse.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-21 01:56
    Alas, the PWMPAL is very useful, but it's not quite magic.
  • T ChapT Chap Posts: 4,223
    edited 2007-03-21 02:34
    The simple solution is a relay, you can trip the relay and reverse the polarity, still using the PWMPAL. An extra pin/transistor is required obviously for the relay.

    Post Edited (originator) : 3/21/2007 4:00:39 AM GMT
  • heitchheitch Posts: 3
    edited 2007-03-21 15:58
    Originator, the relay idea sounds interesting. I will try it.

    Thanks
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-21 16:10
    Gentlemen,

    Using a PWMPAL to drive an H-Bridge all you need to do to reverse the motor is switch which PWMPAL output is toggling and bring the other output LOW. For example, for one direction you will engage channel 1 of the PWMPAL while channel 2 output is just LOW. Then for reverse you bring channel 1 LOW and PWM channel 2.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.