Dual DC Motor Control
Controlling DC Motors with the OOPic.

This project is currently

Check back periodically for updates.

DC motors can be controlled from the OOPic in a variety of ways utilizing everything from relays to power mosfets. This project shows how to configure two oPWMs and some oDIO1 Objects into a Virtual Circuit that will control the speed of two DC motors. with simple commands like M1Speed = 10 for a slow speed, M1Speed = 255 for full speed, and even M1Brakes = cvOn to slam on the brakes!

This Virtual Circuit will be created for use with 2 LMD18200 H-Bridge ICs. These H-Bridges are capable of driving a motor with a voltage range of 10V-DC to 55V-DC with up to 3A continuous. It can drive the motor at a variable speed and reversible direction. It also has current sensing and thermal overload protection.

Several different Objects can be configured into the Virtual Circuit to change its behavior, including Thermal overload detection and current sensing, but for this project, we will use just speed control, direction and brakes.

engineering oopic on bottom of robot.This little robot base is the project platform. It has two DC motors turning two wheels, some batteries, an OOPic and the project board with the 2 H-bridges.

A circuit board that holds the two LMD18200 IC can be found at Magnevation

Magnevation also publishes the schematic for this item.

The pin out of the LMD18200 IC is show below:

LMD18200 IC
 
The Program
Dim M1Speed as new oPWM
Dim M2Speed as new oPWM
Dim M1Brakes as new oDio1
Dim M2Brakes as new oDio1
Dim M1Direction as new oDio1
Dim M2Direction as new oDio1
Dim x as new oByte

Sub Main()
  Call SetUp
  M1Brakes = cvOff
  M2Brakes = cvOff
  Do
    ' This will speed up the two motors
    for x = 1 to 254
      M1Speed = x
      M2Speed = x
    next x
    ' This will slow down the two motors

    for x = 254 to 1 step -1
      M1Speed = x
      M2Speed = x
    next x
  Loop
End Sub

Sub SetUp()
  M1Speed.IOLine = 17
  M1Speed.Operate = cvTrue
  M2Speed.IOLine = 18
  M2Speed.Operate = cvTrue
  M1Brakes.IOLine = 24
  M1Brakes.Direction = cvOutput
  M2Brakes.IOLine = 25
  M2Brakes.Direction = cvOutput
  M1Direction.IOLine = 26
  M1Direction.Direction = cvOutput
  M2Direction.IOLine = 27
  M2Direction.Direction = cvOutput
End Sub

    Send mail and comments to: Savage Innovations.