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.

Controlling a H-Bridge with PWM from a PIC16F887

Status
Not open for further replies.

santais

Junior Member level 1
Junior Member level 1
Joined
Jan 14, 2011
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,474
Building a H-Bridge using PWM from a PIC16F887

Hi Guys.

I'm currently working on a school project, where we are trying to build a Line Following Robot. So far I'm able to control duty cycle of the PWM signal, with the use of 3 different sensors. So far so good. The last thing I'm missing, is to get the H-bridge working, and to be honest, I'm completely lost here.

I've tried different types of H-bridges, where I found the circuit on the internet. One of them worked, if I used the voltage from an power supply and regulated it from that. However, no success with the pic itself. Here's the transistors and other hardware, which is being used:

PIC 16F887 with a duty cycle varying from 0 - 200 (8 bit PWM. Not using 255, because of the chance to burn off the motor).

3 V DC motor x2.

2 x TIP121 and 2x TIP127 transistors.

A Power supply VDD at 5v

The motor has to be able to run both forward and backward. Today I tried with this setup:

picpwm_12.jpg


However, the voltage on the pin to the motor was just high all the time, and my PWM input didn't have any effect at all.

Thanks on beforehand :) Hope that some of you have an idea, on how to get this running. It's an exam project, so it's quite important I get it running ;)
 
Last edited:

Since your design shows BJT's, you'll need to drive a fair amount of current into the base to get them to go into saturation (like a switch in the "ON" position... low resistance from colelctor to emitter). The microcontroller probably can't source enough current to turn them on fully.

Option 1) Try swapping the single BJT's for Darlington-pair equivalents. Darlington's are basically two BJTs in one package, which give you a much higher current-gain (base current -> collector current).

Option 2) Put in MOSFETs, instead of BJTs. FETs can be used as VOLTAGE-controlled switches, where the BJT's are being used as CURRENT-controlled switches. Since they only need voltage to make them change operation, you won't see the current-limiting problem that the BJTs may be having. (see kabiru's circuit)
 

Re: Building a H-Bridge using PWM from a PIC16F887

3 V DC motor x2.
2 x TIP121 and 2x TIP127 transistors.

The schematic shows 4 NPN transistor but you say 2 x TIP121 which are NPN and 2x TIP127 which are PNP.
How are your transistors connected?
they should be connected like this A simple H-Bridge design « PocketMagic , also a PNP will turn on with LOW and the NPN with HIGH or you can use the two extra transistors in the schematic and drive it with just 2 inputs.

Alex
 

By using NPN's in the upper section you're making their bias current go through the load and another transistor. This is bound to result in glitchy behavior since the bias controls transistor operation.

Consider using PNP's at the top. Their bias is referenced to the positive terminal. You'll get stable behavior because they'd have a direct connection to the positive supply rail.

Also note that PNP's turn on when bias terminal is grounded. Your control device upstream must sink current to do this.

If you use mosfets, then consider P-channel at the top. The bottom mosfets can be N-channel.
 

hi all,

i am too loking to make the pic16F887 as a H bridge controller till now i got the example from ccs. but as the H brdge needs a dead time i dont know how to make it with the pic. any suggestion ??? thanks all fro helping.

BR's

Shpetim Aliaj
 

It's the normal sine pwm you know but it's not necessary to used pwm you can still your normal square wave using your pushpull oscilators.
 

Re: Building a H-Bridge using PWM from a PIC16F887

You won't be able to drive the top transistors without some cct to boost the driive voltage above the supply. Look for a half bridge driver cct. IR2104 comes to mind.
Replacing the top 2 transistors with PNP's could also work.
Cheers
Rob
 

Re: Building a H-Bridge using PWM from a PIC16F887

can you please show the code for the pic.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top