Home     Forum     Projects     Experiments     Circuits     Theory     BLOG     PIC Tutorials     Time for Science

### Author Topic: PWM and H bridge controll with joystick  (Read 4329 times)

0 Members and 1 Guest are viewing this topic.

#### Jacala

• Guest
##### PWM and H bridge controll with joystick
« on: November 19, 2010, 13:16:38 PM »
Hello!

I've made the pwm unit from this website and I want to controll it with a joystick.

The problem is that I want to control the engine with a H bridge and having problems with the rotation direction.

In the link there is a image and in my opinion it should work (low voltage high pwm high voltage low pwm signal)

Do you guys agree?

Now the next problem! How to control the direction? that should be possible with the joystick. But how?

« Last Edit: November 19, 2010, 13:19:08 PM by Jacala »

#### Jacala

• Guest
##### Re: PWM and H bridge controll with joystick
« Reply #1 on: November 19, 2010, 19:09:15 PM »
Of course I can make 2 pwm circuits, for both directions one. That would double the parts. But is there a cleaner way to work around the problem? I should think that 2 transistors to select forward and reverse should work  But I'm nothing more than a hobbyist that is trying a new project so I'm not that sure.

It would work with a relay but that is so crude. There has to be a neat sollution! Who can guide me in the direction?

Jacala

#### kam

• Hero Member
• Posts: 1849
##### Re: PWM and H bridge controll with joystick
« Reply #2 on: November 19, 2010, 19:11:05 PM »
i've got some bad news... Is not gonna be that simple... So... here is what i would do in a first glance.
you need a circuit to select if you send the PWM to A or B correct? ok.. What i would do, is to make 2 comparators connected to 2 relays. The first comparator would actuate the first relay IF the voltage delivered by the joy is above a level, and the 2nd comparator (negative) would actuate the second relay if the voltage is BELLOW a level. The PWM pulses are then delivered to the A input through a NO contact of the relay 1 and to input B through relay 2. Most probably this will work.

Frankly speaking, i would not use relayes, instead i would use transistors. But that has to do only with you. It can be done both ways.

#### Jacala

• Guest
##### Re: PWM and H bridge controll with joystick
« Reply #3 on: November 19, 2010, 20:49:53 PM »
MMM

Maybe this is a better solution?

http://www.dimensionengineering.com/Sabertooth2X5.htm

A ready to use system only hook up a good joystick and it works.

But overhere in the nethelands it's quite difficult to order such a joystick.

0 volt is forward    2.5 volt is no movement  5 volt is backward.

With a different joystick (with 1 resistor not 2 like in the drawing above) this is verry easy....... right?

#### kam

• Hero Member
• Posts: 1849
##### Re: PWM and H bridge controll with joystick
« Reply #4 on: November 19, 2010, 23:57:34 PM »
If you get a joy which has for example 1K potentiometer and when it is in center the pot is in middle (500 ohms in each side), then you dont need any resistor. Only hook up one side to positive and other to zero, and from center you get 2.5 to 0 for one motion and 2.5 to 5 for other...

#### Jacala

• Guest
##### Re: PWM and H bridge controll with joystick
« Reply #5 on: November 20, 2010, 12:49:31 PM »
Jep that is what I tought.

But where can I get that kind of joysticks? I've been searching the internet but caint find one!

The joystick of a simple playstation works with 2 independant resistors for each direction (up & down) And not as a voltage devider.

I would love to use a nunchuck but I'm 99% sure that that joystick has also 2 independant potentio's for up & down. Does anyone know for sure?
« Last Edit: November 20, 2010, 13:45:32 PM by Jacala »

#### kam

• Hero Member
• Posts: 1849
##### Re: PWM and H bridge controll with joystick
« Reply #6 on: November 20, 2010, 21:00:29 PM »
I dont know about nunchuck, but i know that you can change the pot of a joystick. For example this joy:
http://pcbheaven.com/projectpages/Men_Of_War_Game_Console/?topic=worklog

I used it for my console. I feel that i can change it. I did not change it though (i use a micro controller).