0
Offline
Sr. Member
Karma: 0
Posts: 340
Arduino rocks
|
 |
« on: December 03, 2012, 04:30:03 pm » |
I'm trying to wire up my own joystick controlled, analog, pan/tilt. Keeping the circuit analog only, how would you wire up a 12v battery, a 5k or 10k pot, and a 12v dc motor so that when the pot was in the center of it's travel the motor is still, and as you move the pot either direction from that center position, the motor moves a different direction. In the big picture there will be a 2-axis joystick controlling two DC motors. This is an Open-loop system. Because of that fact, servos aren't necessary even though they could be used. There should be a way to construct a simple, analog circuit that consists of not much more than a battery, pot, and dc motor but still allows for proportional forward and reverse movement of that motor.
|
|
|
|
« Last Edit: December 03, 2012, 10:38:57 pm by David82 »
|
Logged
|
|
|
|
|
Poole, Dorset, UK
Offline
God Member
Karma: 8
Posts: 672
|
 |
« Reply #1 on: December 03, 2012, 08:07:02 pm » |
Basically you can't with a simple motor you need a servo. With a motor you have no real control of position.
For pan and tilt you need two servos.
Mark
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 0
Posts: 340
Arduino rocks
|
 |
« Reply #2 on: December 03, 2012, 09:25:05 pm » |
All of the current products I sell use servos. Trust me. I know aaaaalll about servos and their benefits but for this specific application I purposely want to use power window motors. I don't need it to hold a specific position. I just want an open-loop, analog pan/tilt wiring diagram.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Offline
Jr. Member
Karma: 0
Posts: 59
|
 |
« Reply #4 on: December 03, 2012, 10:03:59 pm » |
Seems like a rotary encoder 'pot' would make more sense. Read the direction and rate of turning and adjust the motor voltage in a manner that correlates to the encoder signal.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Sr. Member
Karma: 0
Posts: 340
Arduino rocks
|
 |
« Reply #5 on: December 03, 2012, 10:15:08 pm » |
Why can't you just use a a 12v battery, a pot, and a 12v motor? This is an Open-loop system. Because of that fact, servos aren't necessary even though they could be used. There should be a way to construct a simple, analog circuit that consists of not much more than a battery, pot, and dc motor but still allows for proportional forward and reverse movement of that motor.
|
|
|
|
« Last Edit: December 03, 2012, 10:37:55 pm by David82 »
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1576
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #6 on: December 03, 2012, 10:49:02 pm » |
Simple, use IF/ Else statements. I assume you don't want the motors to act like servos in which case they will rotate continuously. All you have to do is find the POTs limits as well as its center. Errr, if you find it's limits then subtract the highest from the lowest and divide by 2, to get the center. Then you may want to have an offset. Once you find the center, give it some slack. // say the lowest is 350 and the highest is 650, the difference is 300 // so divide 300 by 2, you get 150. // then 350 + 150= 500 (center) //offset, you decide how much dead zone you want, for the center. // +-10 should be enough. If( POT1< 490) { // offset(10) - center(500) ...go forward... } Else if (POT1 > 510) { ... Go backwards... } Else { ... Full stop... }
Simple.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Phoenix, Arizona USA
Online
Faraday Member
Karma: 27
Posts: 5082
Where's the beer?
|
 |
« Reply #7 on: December 04, 2012, 12:08:23 am » |
Why can't you just use a a 12v battery, a pot, and a 12v motor? This is an Open-loop system. Because of that fact, servos aren't necessary even though they could be used. There should be a way to construct a simple, analog circuit that consists of not much more than a battery, pot, and dc motor but still allows for proportional forward and reverse movement of that motor.
You could do this - but it's going to take a few more parts. I'm envisioning something using the parts you mentioned, plus a window comparator or two (to sense voltage above or below a mid-point value, taken from the pot as a voltage divider), with those outputs feeding into a square-wave VCO or something (for PWM), and from there into one side or the other of an h-bridge. In short, you would simply be redesigning what is inside a servo - with the feedback potentiometer being the "controller", the motor of the servo running open loop. In fact, I would look into the analog circuits used by early servos (talking stuff from the 1960s-1980s or so) as an idea (or you could just use one of the various chips used in servos today; they still require more than a few extra parts - a couple of transistors for a half-bridge, and a handful of diodes, caps, and resistors - maybe an inductor or two). It'd be easier to just emulate it all with an ATTiny (but you'd still need an h-bridge)...
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1576
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #8 on: December 04, 2012, 12:18:46 am » |
Why is everyone assuming he wants to control a servo, he said he wants to control a DC motor. Where did servo come from?
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
0
Online
Tesla Member
Karma: 50
Posts: 6553
Arduino rocks
|
 |
« Reply #9 on: December 04, 2012, 12:25:18 am » |
There should be a way to construct a simple, analog circuit that consists of not much more than a battery, pot, and dc motor but still allows for proportional forward and reverse movement of that motor. Well, just skip all that other stuff and get two switches like below (one for each motor). http://www.radioshack.com/product/index.jsp?productId=2062530
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #10 on: December 04, 2012, 04:45:05 am » |
Why is everyone assuming he wants to control a servo, he said he wants to control a DC motor. Where did servo come from? Because it is the closest analogy to the requirement stated? Clearly a pot, motor and battery alone aren't going to be sufficient because they don't allow for current reversal to allow the motor to change direction, unless, perhaps you have a battery with centre tap. You're going to need some active components in there.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1576
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #11 on: December 04, 2012, 06:00:28 am » |
I know he needs an H-bridge, but all he asked was can he control a DC motor with a POT. YES, he can. He will need a H- bridge, to supply the proper current to the motor, and if he wires it up correctly, the code I wrote will work.
|
|
|
|
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
Global Moderator
UK
Offline
Brattain Member
Karma: 138
Posts: 19067
I don't think you connected the grounds, Dave.
|
 |
« Reply #12 on: December 04, 2012, 06:04:10 am » |
the code I wrote will work. Maybe, but it isn't an analogue solution, as requested in the original post (though what it is doing in this forum beats me  )
|
|
|
|
« Last Edit: December 04, 2012, 07:20:45 am by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Poole, Dorset, UK
Offline
God Member
Karma: 8
Posts: 672
|
 |
« Reply #13 on: December 04, 2012, 06:45:04 am » |
For a motor (with h-bridge/motor shield of course!). You read the pot with ADC and then values above (say ) 700 are forward, values below 300 are backward and values in between are stop. But you still need one pot per motor.
Mark
|
|
|
|
|
Logged
|
|
|
|
|
Queens, New York
Offline
Edison Member
Karma: 29
Posts: 1576
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
|
 |
« Reply #14 on: December 04, 2012, 08:10:19 am » |
In the big picture there will be a 2-axis joystick controlling two DC motors. this is simple too. It is only a differential setup. Pseudocode. if ( Y > 0 && XL > 0 || XR < 0) //forward with left or right turning { M1F = Y - XL; M2F = Y - XR; //XL and XR can be set by an IF statement, if analogRead(A0) > 0, then put it in XL M1R = 0 or LOW M2R = 0 or LOW // else put it in XR } else if ( Y < 0 && XL > 0 || XR < 0) // reverse with left or right turning { M1R = Y - XL; M2R = Y - XR; M1F = 0 or LOW M2F = 0 or LOW }
More code for 360 turning...
else {...full stop... }
|
|
|
|
« Last Edit: December 04, 2012, 08:37:23 am by HazardsMind »
|
Logged
|
UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino
Arduino Tutorials, coming soon.
"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown
|
|
|
|
|