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

Become a Synthiam ARC Pro subscriber to unleash the power of easy and powerful robot programming

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:)