Using H-bridge

Hi !
I saw a project that used Arduino Uno + motor shield + HCSR04 Ultrasonic Module (and some motors , cable , etc) to make an obstacle avoiding robot (a basic one) . But the problem is that I don't have access to motor shield (the original one in the hardware part ) and I was wondering if the programming would be different if I use dual H-bridge (aka 'full' h bridge) ?
And If the programming wouldn't be different , how can I connect it to the arduino ?
(It's always been my question how the motor shield works without using any of the pins , so basically I don't know how to connect the H bridge module so it works the same as motor shield)
connecting this motor is done with 2x analog and 1x digital . The pins on the driver are IN1 , IN2 , IN3 , IN4 , ENA , ENB ; OUT 1 / OUT2 (motor A) ; OUT3/ OUT4 (motor B) ; Input Voltage and GND ; +5v (regulated output (perhaps all the current that is NOT needed ?))
Thanks in advance .

Arman5592:
I use dual H-bridge (aka 'full' h bridge) ?

Which dual H-bridge that you used? do you have link to this dual H-bridge ?

I have just built a robot as you describe using the L293D chip to control 2 motors and a HCSR04 as a sensor, using these two sets of instructions. Get them working separately then it is a simple case of mixing the two codes to get a robot that uses the sensor to avoid things...

This is what I made, basic but works...

https://fbcdn-video-f-a.akamaihd.net/hvideo-ak-xfp1/v/t42.1790-2/10487774_10152286042257301_635611795_n.mp4?oh=63df5b19176c97e1bb8e7ec0111830e0&oe=54242771&__gda__=1411655690_a43ef458eeff43b01dd57ac63ae6e002

Instructions:

If you decide to do this and you want my code let me know :slight_smile:

Alex

from the pin numbers, it sounds like you have a common e-bay special.

first, the motor shield DOES use pins. all shields do, they plug in and the pins they use are designated for the shield.

your driver requires 4 pins, that is two per motor coil. for a stepper, it is 2 coils, for 4 pins,

the project is pretty much like every other project.

you sense something
you compare the feedback from the sensor to some value
determine is a change is made
make change if needed
repeat.

you want to sense the presence of something.
to do that, connect the sensor and by putting things around it, you can get readings.
assign some threshold for the readings.

when a threshold is crossed, you can output to the motor to do something.
if your vehicle is moving, this output would be to steer in some direction.

break the program down into groups and it should make sense and each task becomes achievable.

Arman5592:
. The pins on the driver are IN1 , IN2 , IN3 , IN4 , ENA , ENB ; OUT 1 / OUT2 (motor A) ; OUT3/ OUT4 (motor B) ; Input Voltage and GND ; +5v (regulated output (perhaps all the current that is NOT needed ?))
Thanks in advance .

IN1,2,3,4 are the pins connected to your arduino
ENA and B can be jumpers, or more pins if you feel the need.

out1 /2 goes to one coil
out3 / 4 goes to the other coil

you have one 5+ input for logic, this is optional if you have a switch. the switch would use the on=board regulator to supply the 5v if you do not connect.

there is another power input you did not list that is the mains power. it has to be connected to the power supply and NOT your arduino. you will fry your arduino if you connect it to that power.

get the cut sheet on the unit.

Hi , thanks everyone . The boards input voltage is the pin I named 'voltage' . The GND I named was also for the board . And yes , I kind of forgot to say ENA and ENB are actually 4 pins (2x A and 2x B) which are as jumpers .

alpeace89:
I have just built a robot as you describe using the L293D chip to control 2 motors and a HCSR04 as a sensor, using these two sets of instructions. Get them working separately then it is a simple case of mixing the two codes to get a robot that uses the sensor to avoid things...

This is what I made, basic but works...

https://fbcdn-video-f-a.akamaihd.net/hvideo-ak-xfp1/v/t42.1790-2/10487774_10152286042257301_635611795_n.mp4?oh=63df5b19176c97e1bb8e7ec0111830e0&oe=54242771&__gda__=1411655690_a43ef458eeff43b01dd57ac63ae6e002

Instructions:

http://www.instructables.com/id/Control-your-motors-with-L293D-and-Arduino/

http://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/

If you decide to do this and you want my code let me know :slight_smile:

Alex

The one I'm making is similar too , and the 'only' reason I'm using http://www.instructables.com/id/Arduino-wall-avoiding-robot-FabLab-NerveCentre/ is their ready code (Really , I don't like programming :roll_eyes: ) because mine is going to be pretty different : I'm using L298N module instead of shield , caster wheel instead of 3d printed special 3rd wheel , 12v motors without gearbox (powerful enough ) and etc etc . The only similar thing is the Arduino Uno and HC-SR04 .

dave-in-nj:
from the pin numbers, it sounds like you have a common e-bay special.

first, the motor shield DOES use pins. all shields do, they plug in and the pins they use are designated for the shield.

your driver requires 4 pins, that is two per motor coil. for a stepper, it is 2 coils, for 4 pins,

the project is pretty much like every other project.

you sense something
you compare the feedback from the sensor to some value
determine is a change is made
make change if needed
repeat.

you want to sense the presence of something.
to do that, connect the sensor and by putting things around it, you can get readings.
assign some threshold for the readings.

when a threshold is crossed, you can output to the motor to do something.
if your vehicle is moving, this output would be to steer in some direction.

break the program down into groups and it should make sense and each task becomes achievable.

Well . What Pins does the shield use as IN1-4 ?
Thanks everyone !
(PS a picture of the board - blurry so I decided to write the pin names )