Asked — Edited

Connect L298n Motor Driver Hbridge To Ez-B Robot Controller V4 Update

Is there an updated version of using this H-Bridge with the EZB v4? I'm assuming (again) that it is the same... But Power? Not using the Battery pack

Thanx:)

https://youtu.be/XM2jjsDPvJY


ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

#1  

https://synthiam.com/Community/Tutorials/130/1

Alan

#2  

L298n Motor Driver Hbridge I HAVE ON ORDER:)

bUT, I found this Hbringe in a static bag, in my box of parts. How would be the best way to hook up to the EZBv4?

http://www.robotshop.com/en/dfrobot-4-8-46v-2a-dual-motor-controller.html?gclid=COqghq2MnM8CFYMmhgod8BUCrg

(SAME AS THIS ONE, but that was for the EZBv3 board) https://synthiam.com/uploads/ez_b_hbridge_v2-634625139534279890.jpg

tHANX:)

#3  

With a quick glance, almost exactly the same. This is because the board can supposedly take 6-12v on logic, so that means as long as your not powering the ez-b with something over 12v, you should be good. Motor power can likely come from the ez-bs power source, as long as the motor can handle that power.

United Kingdom
#4  

It's an L298n based H-Bridge which means connections and operation are the same as the one in the link Alan provided or as the image on the page you linked to

User-inserted image

It doesn't have an on board voltage regulator for the logic that I can see though. I'd add a 5v regulator to the logic supply (VD) despite it claiming to be able to accept higher voltages.

It also looks like it doesn't have speed control (EnA & EnB) so the motors will move at full speed whenever E1/M1/E2/M2 are set to move the motors.

It's also labelled a little differently but should be simple enough to work out.

You also need to pay attention to the Supply Switching Jumper. Don't feed your the motor power to the logic circuit accidentally.

Manual is here which should help wire it up and configure the M1/E1/M2/E2 correctly.

Hope that helps

PRO
USA
#5  

from the manual: Pins E1, E2: PWM control the velocity (0=Stop, 1=FULL Speed) Pins M1, M2: Direction 0 = Forward, 1 = Reverse

from the specs: High level: 2.3V = Vin = Vss Low:-0.3V = Vin = 1.5V The logic part of the input voltage: 6 ~ 12V

switch: keep/ON: if your motors accept 6 to 12V remove/OFF: motors need less than 6V or 12-46V

you don't need a voltage regulator, the circuit has one CX1117-5.0, circuit on the right side (3 legs)

the voltage drop is between 1V to 1.3V (max current), to work you will need 6.5V to 12V.

the circuit in the left is a NAND gate, using 2 x (PWM and Direction) transforms to EN1, EN2, INA1, INA2, INB1, INB2 found in most h-bridges.

***disclaimer: I own a DFRobot Romeo controller board with a h-bdrige, similar logic (PWM + DIR)

#6  

Awesome feedback! Thanx so much!:)

Not sure how to connect to the EZB v4 though..?

PRO
USA
#7  

you will need 4 digitals pins to control two motors:

D0 - E1 D1 - M1 D2 - E2 D3 - M2

and you will need a Custom Movement Panel. Do you need help with the Custom Movement Panel ?

#8  

thanx....I think I have the Movement Panel . That's straight forward...

Hopefully the last stupid question. (I'm used to servos, not H Bridges. on D0 through D3 on the EZB4. I'm not using all 3pins (blk/Red/WHt)for each, so which ones do i USE to M1,,,etc?

PRO
USA
#9  

White Pin

you will need to customize (Scripts) the Custom Movement Panel, I'll post the scripts.

PRO
USA
#10  

Step 1:

you will need a script to create the speed variables.

Script Name: Init


#set initial speed, speed 0..255
SetSpeed(125)

#Note:
#if left  motor is slower => decrease current_speed_right_factor e.g. 0.9
#if right motor is slower => decrease current_speed_left_factor e.g. 0.9


#Note:
# pwm = 0..100

$current_pwm_left_factor=1.0
$current_pwm_left=CInt(GetSpeed() * $current_pwm_left_factor * 100 / 255)

$current_pwm_right_factor=1.0
$current_pwm_right=CInt(GetSpeed() * $current_pwm_right_factor * 100 / 255)

Then assign the Init script to the connection event:

User-inserted image

PRO
USA
#11  

Step 2:

Add the Custom Movement Panel (Add Control > Scripting > Custom Movement Panel)

User-inserted image

you will need 7 scripts for each event: Stop, Forward, Right, Reverse, Left, Speed.

Stop Script:


PWM(D1, 0)
PWM(D3, 0)

Forward Script:


PWM(D1, $current_pwm_left)
Set(D2, OFF)

PWM(D3, $current_pwm_right)
Set(D4, OFF)

Right Script:


PWM(D1, $current_pwm_left)
Set(D2, OFF)

PWM(D3, $current_pwm_right)
Set(D4, ON)

Reverse Script:


PWM(D1, $current_pwm_left)
Set(D2, ON)

PWM(D3, $current_pwm_right)
Set(D4, ON)

Left Script:


PWM(D1, $current_pwm_left)
Set(D2, ON)

PWM(D3, $current_pwm_right)
Set(D4, OFF)

Speed Script:


$current_pwm_left=CInt(GetSpeed() * $current_pwm_left_factor * 100 / 255)
$current_pwm_right=CInt(GetSpeed() * $current_pwm_right_factor * 100 / 255)

if ($direction!="Stop")
  PWM(D1, $current_pwm_left)
  PWM(D3, $current_pwm_right)
endif

Check the Digital Ports wires: D0 - Left Motor - E1 D1 - Left Motor - M1 D2 - Right Motor - E2 D3 - Right Motor - M2

Disconnect/Connect the EZB Button, to run the Init script, and it's ready to use.

Note: speed and pwm have different ranges.

#13  

Thanx so much. But That seems a lot. I'm only using the h bridge to control 2 motors on my bots drive train. Fwd.backward. left.right :)

#14  

Other thing I'm not seeing: how to I provide power to the h bridge from the ezb? From the red/black from one of the servo ports.correct? Just making sure. I don't want to accidently fry something. And Btw, my base is from a RAD robot, that appears to be popular here:)

PRO
USA
#15  

Yes pickup red = vcc black = gnd from the digital ports and connect to vdd (vcc) and gnd (gnd)

#16  

thanx again PTP:)

#17  

Finally got around to it, I believe it's wired up right; Put PTP's code in, hope all goes well! lol User-inserted image

#18  

Seems to be working! Although the old RAD motor gear boxes seem worn:( not engaging well) Took apart gearboxes and reseated them, works now! But NO REVERSE?

I have both treads going FWD, Left Turn,Right Turn....No Reverse:( PTP, I double checked the code you have here, in my Script...

United Kingdom
#19  

If you have turn left and turn right set up so that motor 1 rotates one direction and motor 2 rotates the other then reverse should work. Check both motors are rotating when you turn.

#20  

Yes, they both turn opposite to each other, in reference to left or right. and FWD. I hit reverse arrow in EZB and nothing.