Go Down

Topic: Driving one motor using bridge H with PWM (Read 733 times) previous topic - next topic

Natantxla

Mar 28, 2018, 07:59 am Last Edit: Mar 28, 2018, 08:04 am by Natantxla
Hi guys


I need help in a program for driving a motor by PWM and potentiometer and one button for forward and another button backwards.

Help me Please.

Thanks in advance.

slipstick

What motor? What H-bridge?

Post your best effort so far at writing or even finding a program and we can help you get it right. Googling "Arduino motor PWM" will find many similar programs for you to start from and the IDE contains examples of that and of using switches/buttons.

Or if "need help" means you want someone to just write a program for you then try in the Gigs and Collaborations forum and be prepared to pay.

Steve

MarkT

You have to provide information about the hardware and your code if you expect any help - this is all carefully
explained for you in the sticky threads...
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Natantxla

What motor? What H-bridge?

Motor

voltage 24 Vdc and current 10A

H - bridge

I´ll use IPP075N15N3G

before H - bridge we install an Optocoupler HCPL-3120

and I have the idea to use this program for control (PWM) and forward, backward by two buttons

int MA1 = 13;
int MA2 = 11;
int forward = 2;
int backward = 3;
int speedSet = 5;

void setup(){
  pinMode(MA1, OUTPUT);
  pinMode(MA2, OUTPUT);
   pinMode(forward, INPUT);
  pinMode(backward, INPUT);
}

void loop(){
  int val = analogRead(speedSet);
  int speed1 = map(val, 0, 1023, 0, 255);
  if(forward == 1){
    digitalWrite(MA1, LOW);
    analogWrite(MA2, speed1);
     }
  else if(backward == 1){
    digitalWrite(MA2, LOW);
    analogWrite(MA1, speed1);
     }
  else{
    digitalWrite(MA1, LOW);
    digitalWrite(MA2, LOW);
      }
}

but I do not know if it is the appropriate program

I'm a layman in programming arduino.

sorry for my english is bad

thanks


SandFarmer

I have had pretty good success using a multimoto H-Bridge shield to drive an actuator with built in potentiometer back and forth.  This would be similar to what you are doing.  In my case when you press the button the motor moves the actuator to a desired preset position.

This is not a sales pitch in any way, just what I tried.

On robotpower site there is also an example sketch / guide to assist with programming it.

http://www.instructables.com/id/MultiMoto-Guide/



Do you require the ability to change the motor speed or is just full on and then off.  

slipstick

The only IPP075N15N3G I know of is a single MOSFET not an H-bridge. Please post a circuit diagram of how you are using it/them?

In the program what do pins MA1 and MA2 represent?

These lines are not going to work:
Code: [Select]

  if(forward == 1){

  else if(backward == 1){

forward and backward are pin numbers 2 and 3 and neither 2 nor 3 are ever going to be equal to 1. Perhaps you meant to read the value of those pins with digitalRead() instead?

Steve

Natantxla

On robotpower site there is also an example sketch / guide to assist with programming it.

http://www.instructables.com/id/MultiMoto-Guide/



Do you require the ability to change the motor speed or is just full on and then off.  

Thanks man.

I'm grateful for your help.

Natantxla

#7
Mar 29, 2018, 06:30 am Last Edit: Mar 29, 2018, 06:58 am by Natantxla
The only IPP075N15N3G I know of is a single MOSFET not an H-bridge. Please post a circuit diagram of how you are using it/them?

Steve
this is the driagram

but this diagram is in the assembly phase to see if it will work with this mosfet or i´ll use two mosfet channel N and two mosfet channel P

Thanks man.

I'm grateful for your help.

Go Up