go_away

Author Topic: some more h-bridge questions  (Read 2957 times)

0 Members and 1 Guest are viewing this topic.

Offline alpha_geekTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
  • Digital Jedi
some more h-bridge questions
« on: August 03, 2007, 01:59:54 AM »
Hi everyone,

I am building my first robot, and I don't have allot of electronics experience. I have been reading about H-bridges, and I understand the different methods using relays and transistors, etc. My problem is that I don't quite get how to send the PWM signal. I have built a circuit that runs at 5v and I am driving it from the parallel port. At the moment it is only switching LEDs on and off. Am I right in thinking that I need to send the PWM signal from software timing, by simply switching from low to high very fast?? I did read somewhere about 555 timer chips, would I need to use one(some)? If so can anyone point me to a diagram? Would these prevent me needing to do it in software?

I have already bought and started using relays as I was following a tutorial, am I right in thinking that I should ditch them in favor of transistors? That would be a shame because my parts are mostly recovered from junk. Also my motors are old 6v meccano motors (2 on each wheel, and I used meccano to gear them down). I am sure I read that the control voltage from the digital circuit should be higher than the voltage powering the motors. If this is the case my motors run 1v higher, so do I use capacitors for this, and how would I calculate what I capacitors I need?

Sorry If that is alot of questions but I have been reading so much, that I am just getting more confused. Seems like I would have been better to remain ignorant and just use the relays!!!

thanks for the help.

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: some more h-bridge questions
« Reply #1 on: August 03, 2007, 02:27:27 AM »
To control a motor's speed by PWM you will need to be able to generate a signal with a frequency of about 20kHz. It can't be much lower because otherwise the sound produced will be audible and annoying. This frequency is possible using an astable 555 timer circuit. I don't think that it is possible to create these high freqencies using a parallel port through windows.

Here is a LINK

You can adjust the duty cycles by using a variable resistor in the circuit for R2.

A relay won't be able to switch fast enough at these frequencies so yes, you do need transistors.

Erm im not quite sure what you mean about capacitors. You don't need an RC-circuit to convert the PWM signal to analogue. If you need 1 V higher, just supply 1V higher through your transistor. A small capacitor can be placed across the leads of a motor to increase its battery life.

Harry
Imperial College Robotics Society
www.icrobotics.co.uk

Offline alpha_geekTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
  • Digital Jedi
Re: some more h-bridge questions
« Reply #2 on: August 03, 2007, 02:45:28 AM »
Thank you Harry for the fast reply.

I started thinking I needed to raise the voltage after reading this about transistors:
http://www.acroname.com/robotics/info/articles/drivers/drivers.html#e10

although after re-reading it, it seems to contradict it's self. First it says:
"In this way, a higher current load can be driven by a smaller current at the base of the transistor."
Then it says
"...the voltage of the input (at the base) must be higher than that of the high-current load placed across the emitter and collector."

Also, as far as variable resistors go, are these manual (i.e. do I have to adjust the resistance using a little knob) or can they be adjusted someway via logic. I take when you say "You can adjust the duty cycles by using a variable resistor" is layman's terms you mean the variable resistance changes the speed at which the 555 creates the Pulses?

Sorry if my terminology is way off, I am still trying to get to grips with all this.

Thanks again

Mark

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: some more h-bridge questions
« Reply #3 on: August 03, 2007, 04:54:29 AM »
Yeah im not sure what that site means by that... It compares a voltage to a current load? Hmm...

Duty Cycle is the percentage of the time which the pulsing signal is high.

You can get both mechanical and digital variable resistors/potentiometers.
Imperial College Robotics Society
www.icrobotics.co.uk

Offline alpha_geekTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
  • Digital Jedi
Re: some more h-bridge questions
« Reply #4 on: August 03, 2007, 04:55:43 AM »
Thanks for your help, I am slightly less confused than was before!!

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: some more h-bridge questions
« Reply #5 on: August 03, 2007, 10:09:54 PM »
Hi,

"...the voltage of the input (at the base) must be higher than that of the high-current load placed across the emitter and collector."
The voltage at the base of an NPN (bipolar) transistor should be around 0.7V higher than the emitter (around double that if it's a darlington), but the emitter should be at ground potential (i.e. 0V), since it is connected to ground.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline alpha_geekTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
  • Digital Jedi
Re: some more h-bridge questions
« Reply #6 on: August 05, 2007, 11:15:44 AM »
Ok thank you Soeren.

I have been working this out, and I think I have just about got it. I am thinking of using a 4-10 line decoder from logic to select different resistors for R2. Then I will put  2 transistors between the output from the 555 and the H-bridge. These will be selected by the logic, and will select the motor direction. when one of the transistors is on, the pulse signal will get to the H-bridge and will pulse on both sides of the motor (is this okay). i.e, it will pulse to both A + D or B + C (M is motor)

A---       ---B
         M
C---       ---D

If I take 2 TTL lines to the line decoder I should be able to select 4 speeds an the direction at a cost of 4 control lines per motor.

Does this sound Okay? I'm sorry if I am asking allot of questions, but this is my first electronics project since I was a kid 20 years ago, so I am just learning. If I draw a diagram would you guys mind taking a quick glance over it?

Thanks for all your help.

Mark

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: some more h-bridge questions
« Reply #7 on: August 05, 2007, 10:57:11 PM »
Hi,

I have been working this out, and I think I have just about got it. I am thinking of using a 4-10 line decoder from logic to select different resistors for R2.
If you're talking about the R2 in the 555 tut, which is placed between pins 2/6 and 7, I don't see how you're gonna switch them in any practical way (without a good bit of extra "glue").


Quote
Then I will put  2 transistors between the output from the 555 and the H-bridge. These will be selected by the logic, and will select the motor direction. when one of the transistors is on, the pulse signal will get to the H-bridge and will pulse on both sides of the motor (is this okay). i.e, it will pulse to both A + D or B + C (M is motor)
As I understood your first post, you'd like to use relays and that would be the easy way, since you then simplifies matters control-wise - just connect them so that when the relays are energized they go backwards, so that you spend least energy on them.
Then you just PWM eg. the ground line - like this:

Link for full scale http://That.Homepage.dk/Img/H2.png

Quote
If I take 2 TTL lines to the line decoder I should be able to select 4 speeds an the direction at a cost of 4 control lines per motor.
Why not just output the PWM signal from the parallel port that you use to control it ?

 
Quote
If I draw a diagram would you guys mind taking a quick glance over it?
Sure thing.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline alpha_geekTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
  • Digital Jedi
Re: some more h-bridge questions
« Reply #8 on: August 06, 2007, 01:52:54 AM »
SO using that diagram I would use 3 output lines, one to switch the relay and 2 to send PWM. And I would have to write the software to send the PWM signal?

If that is the case it looks allot simpler than the diagram I was drawing, and it would use one less output line too.

Is sending a PWM signal from the parallel port via software just a matter of turning one of the outputs on and off with the correct timing, and would it be the same for the ground line? Perhaps inverted values? If not example source code would be welcome, I am using GNU C on Knoppix.

Thanks for all your help

Offline alpha_geekTopic starter

  • Jr. Member
  • **
  • Posts: 10
  • Helpful? 0
  • Digital Jedi
Re: some more h-bridge questions
« Reply #9 on: August 06, 2007, 08:27:09 AM »
I was thinking of something like this.


http://i137.photobucket.com/albums/q213/Sirrell_Gateway/circuit1.jpg

forgive the poor drawing skills
« Last Edit: August 06, 2007, 08:32:23 AM by alpha_geek »

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: some more h-bridge questions
« Reply #10 on: August 06, 2007, 09:16:51 AM »
That drawing is not too bad :)

I think that the top two transistors in the diagram should be NPN, since they are on when the base signal is low. This would mean that when the PWM signal was high, the NPN would be on, and the PNP would be off. Not what you want.

Don't mean to highjack your thread, but i have a related question - Why should the emitters be tied to the fixed voltages ?  (This is from the sentence at the bottom of this PAGE.)

« Last Edit: August 06, 2007, 09:17:30 AM by hazzer123 »
Imperial College Robotics Society
www.icrobotics.co.uk

 


Get Your Ad Here