advertisement
from the Automation List department...
PWM DC motor speed control via anolog joystick
Motion control, servos, steppers, etc. topic
Posted by John on 24 May, 2004 - 9:48 pm
Hi! my name is John I am a recent graduate from ITT Technical Institute who is in dire need for a solution to what I would guess is a not so complex problem for someone with a degree higher than that of my own which is an associates.

First I must note that this is not a work related problem. I am accually a self employed cabinet maker who never worked profesionally in electronics but have been tinkering ever since I can remember. I am currently designing a robotic arm which operates much like a backhoe but with a gripper at the end of the boom instead of a bucket. It is made of wood and metal and its motion is accomplished by 12 volt DC linear actuators. I have two dual axis analog joysticks which I plan to use for speed and direction control of the various linear actuators. I purchased them from a company I found online that sells replacement parts for arcade games. The joysticks each have two 5K pots. I also bought a PWM DC motor speed controller circuit kit at an electronic store. It basically consists of a 556 Dual timer IC that uses a 10K pot to control the modulation of its output which in turn controls the switching speed of a power mosfet transister that is connected to the linear actuator. I planned on building one of these control circuits for each joystick function which would be a total of four thus controlling four linear actuators.

Sounds easy enough, rite? well I thought so until I got my elbows into it and discovered the problem I now have and have had for months now. The control circuit I bought used the 10K pot it came with to vary the voltage at the control input of the IC between VCC and ground. This varied the modulation of the IC's output thus controlling the speed of the linear actuator. The pot was connected between VCC and ground. The wiper of the pot was connected to the control input of the IC. The closer the voltage of the pot's wiper came to VCC the faster the motor turned and the closer it came to ground the slower the motor turned. So my Question to anyone willing to help me is "HOW DO I USE THE JOYSTICK POT IN PLACE OF THE 10k POT THAT CAME WITH THE CIRCUIT"?

There is also something you should know about the pots in the joysticks. First of all they are only 5K pots and when the joystick is pushed all the way in either direction there is still between 600 and 700 ohms measured between the wiper of the pot and the other terminals of the pot. Also when the joystick is at its resting position (in the center of the pots overall travel) there is about 2.5K ohms not zero ohms. If I try to hook up the pot as is to the circuit the motor is turning even before I touch the joystick because of the voltage at that central point of the pot not equalling zero. Also if I push the Joystick all the way forward the motor does not turn at maximum speed because of the fact that the pot's wiper never actually reaches VCC, there is still that 600 to 700 ohm of resistance between the wiper and VCC. I also need the motor to turn in the opposite direction when the joystick is pulled back past that center (or resting) position. I have tried many different ways to make this work including the purchase of an analog to digital converter IC to somehow connect the two but sadly had no success. Maybe I am overthinking the whole thing and overlooking something obvious but all I know is I paid $125.00 per joystick and I would hate to not be able to somehow make them work. If someone has a solution to my problem that may or may not involve the use of these joysticks that would be greatly appreciated.


Posted by Anonymous on 26 May, 2004 - 1:14 pm
John,

Suggestion: convert the pwm signal from joystick to equivalent voltage. A peak detector with an amplifier should work.

ogj



Posted by MAX on 29 June, 2004 - 5:14 pm
Hi John,

You can call me Max. I'm breaking a personal rule by replying on a forum I have not followed for at least a month, because there are usually smarter guys just about to give a better answer. Your plea haunted me so I came back. I think your idea has merit. I like the back hoe, claw idea. Are you trying to duplicate a hydraulic control with your Joysticks? Do I understand that you want it to stop if you let go, reverse if you pull back from the middle position? The farther the faster? That sounds like a user friendly idea, but not a design friendly one. To use those joy sticks in that way you will have to use a microcontroller like a PIC I think PIC16F873 would work. Don't yell if I'm wrong about the number because I'm sure you can find a pic to suite. These are great little devices with most of the stuff you need to interface a joy stick and control 2 motors. Other stuff to.

You never did mention how you hoped to get reverse. Let me suggest a relay per motor, to control motor direction. Controlled by the Pic of course. Then you can use look up tables to set motor speed and direction. You can program in the size of the center dead spot and the acceleration
curve. You will have to learn to program these things. I did a similar thing long ago with a 8080, today I'd use a PIC. GOOGLE PIC and motor control you will open new realms. It would work like this. The pic looks at the joy stick with it's built in A/D converter, the value causes the pic to place the desired signal on one of the built in PWM's. If it's behind the center the reversing relay is energized. Two of these and a programmer will cost less than those joysticks!
/\/\Ax 2 U


Posted by sam on 1 July, 2004 - 2:31 am
Use a basic microcontroller with on-board ADC (analog to digital converter) to sense the voltage from the joystick pot. This voltage will range from V/5k to V/600. In your microcontroller these will have discrete values from say 80 to 220 (assuming 8-bit registers, max value 255). You can then use the mid-point (150 in this example) as your zero (this should be the value with joystick at rest) in a simple program on the micro - you could even use the micro for the PWM. Likewise, the value for fast forward would be 220 while 80 would be the value for fast backwards. In this case you would maintain 140 discrete levels of motor speed, depending on how you implement the output.

Many of the microcontrollers available today have multiple channel ADCs on them, so you could process the signal from both joysticks on the single chip. The one that I have used most recently and was happy with is the PIC16f819 from Microchip Technologies - it has 5 ADCs.


Posted by Richard C. on 8 September, 2004 - 2:10 pm
These posts should definitely get you on the right track. I would definitely suggest sampling your joystick voltage with an ADC (onboard or standalone IC). You can even use a biased amp to expand the range to 0-5v, thus maximizing your bit-resolution on your ADC.

The downside to using the pic is that you need to learn to program in their RISC ISA or ANSI-C if you buy/demo their compiler. I have personally used their C18 compiler suite for the 18F6620 chip. You can multiplex your 2 joysticks into the onboard ADC and use the multiple PWM outputs (with power amplifaction ie Hbridge) to power the motors. You can even mix the joystick inputs to yield a more controllable design. Definitely look into PD/PID control for your motors to better cope with any load you are dealing with.

In short, not a trivial problem, but if you have programming and board layout experience it shouldn't be too bad. If you need help, send email. rcapon1@lsu.edu

Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2014 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.


Fortune
"Life is like a bowl of soup with hairs floating on it. You have to
eat it nevertheless."
-- Flaubert
Advertise here
advertisements
164-page eBook free download - EtherCAT Applications Guide
Servo, stepping motor control, analog & web HMI in one system!
Servo, steppers, analog, digital & web HMI - Fully Integrated!
View free setup and multi-vendor EtherCAT demo videos online
Time to incorporate data handling, web HMI and motion in one system!
our advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive