Regarding H-Bridge

hello,
i am trying to design a robot which detects obstacle n avoid collision. for the purpose i have chosen OOPic-R controller board, IRPD sensor from lynxmotion and have bought an XDDCMD (xavien dual DC motor driver) for DC motor controlling.

did not decide upon motor can you expain me the brushless n brushed DC motor and what type of DC motor should i use for my project

also it is given in the xavien manual that motor two pins must be connected to the h-bridge screw(jn) but at both the screw points exhibit same output in this case motor will never run.
thus can anyone explain how it actually works and the motor collections to it.

off hand it seems like a good question for the xavien tech support guys… but generally speaking unless you are commanding the motor to run the terminals would be at the same potential. Also it is possible that without a motor connected the controller detects the open circuit and goes into a fault mode.

you’ve already chosen a motor controller for brushed motors so brushless vs brushed motors is sort of moot… however to answer your question DC brushless motors are generally 3-phase and use electrical commutation either as a hall-effect sensor feedback or using sensorless feedback technique where the back-EMF of the motor phases is measured.

well… i am trying to execute the following program to test the working of H-bridge with the help of OoPic-R controller

Dim M1Speed As New oPWM
Dim M1Brakes As New oDIO1
Dim M1Direction As New oDIO1
Dim x As New oByte

Sub Main()

Call SetUp
M1Brakes = cvOff

Do
For x = 1 To 254
M1Speed = x
Next x
For x = 254 To 1 Step -1
M1Speed = x
Next x
Loop
End Sub

Sub SetUp()
M1Speed.IOLine = 18
M1Speed.Operate = cvTrue

M1Brakes.IOLine = 27
M1Brakes.Direction = cvOutput

M1Direction.IOLine = 26
M1Direction.Direction = cvOutput
End Sub

when i made the connections, the motor did not run and when i checked the voltage at the two motor pins it was same in both the pins 11.8volts.

could you please tell me the problem or the mistake if anything i made. its like i did not get what the problem could be the program is correct no errors when simulated and have also taken care of pin connections of the controller to the H-bridge.

First, that code will not run as you have not set up the PWM. All you have done is say you want to use it… Just because it compiles does not mean it will run.

Try this code (it is out of the oopic sample code) This is just standard L293 code but it works for most H-Bridges.

Dim A As New oDCMotor2(18,26,27,0,cvOff,cvOff,cvOn)

Sub Main()

Do

For A.Speed = -64 To 64
  ooPIC.Delay = 2
Next A.Speed

For A.Speed = 64 To -64 Step -1
  ooPIC.Delay = 2
Next A.Speed

Loop

End Sub

I suggest reading the entire ooPic users manual and all pertinent sample codes BEFORE hooking anything up.

Ted

hi
thank you, the code did work.
now actually am trying to design an autonomous vehicle that when detects obstacle will avoid collision by changing its direction. for the purpose am using an OOPic-R controller, the IRPD sensor, and XDDCMD DC motor driver.

could you please help me in writing the code for it.
i have written one but i need your help just have a look at it

oIRPD A = New oIRPD;
oDCMotor ML = New oDCMotor(18,26,27,0,cvOff,100,cvOn);
oDCMotor MR = New oDCMotor(17,24,25,0,cvOff,100,cvOn);
oWire WL = New oWire;
oWire2 WC = New oWire2;
oWire WR = New oWire;
Void main(Void) {
A.IOLineL = 30;
A.IOLineS = 28;
A.IOLineR = 29;
A.Operate = 1;

WL.Input.Link (A.Left);
WL.Output.Link (MR.Direction);
WL.Operate = 1;

If (MR.Direction==1)
{
For(MR=100;MR>10;MR=MR-10){
	ooPIC.Delay = 2;
	}
For(MR=10;MR<100;MR=MR+10){
	ooPIC.Delay = 2;
	}
}

WR.Input.Link (A.Right);
WR.Output.Link (ML.Direction);
WR.Operate = 1;

If (ML.Direction==1)
{
For(ML=100;ML>10;ML=ML-10){
	ooPIC.Delay = 2;
	}
For(ML=10;ML<100;ML=ML+10){
	ooPIC.Delay = 2;
	}
}

WC.Input.Link (A.Center);
WC.Output1.Link (MR.Brake);
WC.Output2.Link (ML.Brake);
WC.Operate = 1;

}

i have written the code such that when obstacle is detected on the left the vehicle will turn right and if obstacle is on the right the vehicle will take a left turn and if obstacle is at the center the vehicle stops.

well… i have got another trouble, i need a 12volts battery to run the LMD18200 H-Bridge and am given the battery used in car or bikes but if i use that battery my vehicle cannot move because the battery is very heavy.

can i find a 12volts battery of less weight, with good lifetime and economical?

also will u please tell me the specifications of the motor i should use for this project . i am presently using a motor obtained from my uncle’s garage i have no idea of its voltage ratings nothing. am using it just for testing.

i was thinking a brushed DC motor of 12volts 150rpm would do. what would you suggest?

Your code looks OK.

Batteries - Go to DigiKey, they have examples of tons of 12 Volt batteries, all of them small.

Motors - If you don’t know how to use the freebie motor then don’t even try. Look for a model number on it and then google it for the specs.

The electronics goldmine has a great selection of small 12 volt gearhead motors but check right here at lynxmotion first. I do not know (have not looked lately) but Jim might sell something.

If you are a total noob (no, I am not mocking…even I used to be one) I suggest starting a bit smaller with known working goodies. Take a look at my instructable bot for beginners - instructables.com/id/Super_S … ers_Robot/ - A newer, updated version is going to be published in Robot in the next issue or so.

Ted M.
(BIGBUG)

You can use one of these.
lynxmotion.com/Product.aspx? … egoryID=48

NiMH is a good stable proven technology. :smiley:

hello,

firstly thank you for your valuable suggestions n time. i accept that am a noob at these things but i thought doing a project like this would help me improve. anyways here am again with a problem n invite ur suggestions n solutions tq…

i have written the code n its working well but the OOPic-R controller is not generating the PWM signal from the 18th pin hence the left motors are not rotating here’s the code i’ve written:

Dim A As New oIRPD

Dim M1 As New oDCMotor
Dim M2 As New oDCMotor

Dim X As New oByte

Sub Main()

A.IOLineL = 30
A.IOLineR = 29
A.IOLineS = 28
A.Operate = 1

M1.IOLineP = 18
M1.IOLineD = 26
M1.IOLineB = 27
M1.Brake = cvOff
M1.Operate = cvOn

M2.IOLineP = 17
M2.IOLineD = 24
M2.IOLineB = 25
M2.Brake = cvOff
M2.Operate = cvOn

For X = 1 To 100
M1.Speed = X
M2.Speed = X
Next X

Do

Select Case A.Value

  Case 1: For X = 100 To 1 Step-1
              M2.Speed = X
          Next X
          
          For X = 1 To 100
              M2.Speed = X
          Next X
          
   Case 2: For X = 100 To 1 Step-1
              M1.Speed = X
          Next X
          
          For X = 1 To 100
              M1.Speed = X
          Next X
          
   Case 3: M1.Brake = cvOn
           M2.Brake = cvOn 
          
   Case Else: M1.Brake = cvOff
              M2.Brake = cvOff
   
  End Select
 Loop
End Sub

i have observed that when a left obstacle is detected the right motors(M2) are working according to the code but not the left motors(M1) when tested the 18th pin is found to be at 0 i.e., no PWM signal

please could u tell me what i should do to generate the signal or how i could fix this problem.

I know nothing about oopic programming, but it may not be the code. It could be that the I/O pin is damaged. Try a different program that simply turns the I/O pin on and off.