Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] Drive mosfet with arduino (H-bridge) non inverting configuration

Status
Not open for further replies.

dario M

Newbie level 1
Joined
Sep 21, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
drive mosfet with arduino (H-bridge) non inverting config

Hi ! I'm a newbie with only a limited knowledge about electronics, thus I really need your help!

I want to drive a Brushed DC motor and I have built an H-bridge based on 4 IRF540 N-type mosfet.
I have tried succesfully the inverting config. which uses only 1 BC337 (pwm controlled by arduino) to drive Q1 and Q3 and another BC 337 to drive Q2 and Q4.

However I want to use the non inverting configuration in the attachement.

the problem is that this configuration is not working. I hear just a slight noise from the motor but it does not move.

The arduino code is as follow:




Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
int potPin = 0; 
int transistorPinT3T4 = 9; 
int transistorPinT1T2 = 10; 
int ledPin = 11;
int Mspeed = 0; 
 
void setup() {
pinMode(transistorPinT1T2, OUTPUT);
pinMode(transistorPinT3T4, OUTPUT);
pinMode (ledPin, OUTPUT);
analogWrite (transistorPinT1T2, 0); // spegne Q2 e Q3
analogWrite (transistorPinT3T4, 0); // spegne Q1 e Q4
while (!Serial);
  Serial.begin(9600);
}
 
void loop() {
Mspeed = analogRead(potPin) / 4;
Serial.println(Mspeed);
if (Mspeed >= 138 ) { 
    analogWrite (transistorPinT1T2, 0); // turn OFF Q2 e Q3
    digitalWrite (ledPin, LOW);
    delay(10);
    analogWrite (transistorPinT3T4, (Mspeed));
    }
    else if (Mspeed <= 118) {
    analogWrite (transistorPinT3T4, 0); // turno OFF Q1 e Q4
    digitalWrite (ledPin, LOW);
    delay(10);
    analogWrite(transistorPinT1T2, (255-(Mspeed*2)));  
    }
    else {
    analogWrite (transistorPinT3T4, 0); // turn OFF Q1 e Q4
    analogWrite (transistorPinT1T2, 0); // turn OFF Q2 e Q3
    digitalWrite (ledPin, HIGH);
    }
}





Any suggestions? maybe I need a capacitor somewhere? Or there is a problem with time response of BJTs?

thanks a lot!

dario
 

Attachments

  • non inverting.png
    non inverting.png
    45.8 KB · Views: 81
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top