Pages: [1]   Go Down
Author Topic: Transistor h-Bridge all NPN - Arduino code?  (Read 869 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

i constructed the circuit attached. Does anyone know how to replace the switches with the arduino; and what the code would look like?


* hbridge.jpg (110.99 KB, 1021x466 - viewed 92 times.)
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8855
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If your motor runs on 5V then you can just replace the switches with Arduino pins (HIGH=switch pressed, LOW=switch not pressed).

If you motor needs more than 5V you will have to add some transistors because 5V on the Base will not be enough to turn off the high-side transistors.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

BCC AZ USA
Offline Offline
Edison Member
*
Karma: 35
Posts: 1236
It gets hot so it must be working
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

With the all NPN H-bridge, if you send ones to both H-bridge inputs by mistake there will be smoke.  Better to use a NPN-PNP bridge.
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If your motor runs on 5V then you can just replace the switches with Arduino pins (HIGH=switch pressed, LOW=switch not pressed).

If you motor needs more than 5V you will have to add some transistors because 5V on the Base will not be enough to turn off the high-side transistors.

Do i need pulldown resistors on the arduino pins? im using 4 and 6 where the jumpers intersect at the switch. I'm still a little confused on how to get this to work. can someone explain further?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8855
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do i need pulldown resistors on the arduino pins?

No.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

0
Offline Offline
Full Member
***
Karma: 0
Posts: 165
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Do i need pulldown resistors on the arduino pins?

No.

So how do I get this to work?
Logged

BCC AZ USA
Offline Offline
Edison Member
*
Karma: 35
Posts: 1236
It gets hot so it must be working
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

replace all the 22K resistors with 1K resistors.  connect Arduino pins to row 13 and 21 ( connected to resistors and side of switch NOT 5v).  NEVER send a high on both Arduino outpus at he same time.
« Last Edit: June 19, 2013, 09:49:50 am by groundfungus » Logged

Southeast US
Offline Offline
God Member
*****
Karma: 15
Posts: 683
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Depending on your transistors, since you say NPN, you are using BJTs.  Assuming your transistors don't require more than 5mA of current each, you can just attach a properly sized resistor between an arduino pin and the base of the transistor.  You can then control each transistor independently.  However, you will just have to be very very careful that you never turn on the wrong transistors at once.  You need to make sure you turn off any transistors before turning any other ones on.
Logged

Pages: [1]   Go Up
Jump to: