1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Turning pot with servo...

Discussion in 'Arduino' started by Diy1995, May 29, 2017.

  1. Diy1995

    Diy1995 Member

    Joined:
    Dec 18, 2016
    Messages:
    58
    Likes:
    0
    Hello,
    I would like to make "redneck" digital potentiometer.
    My plan is attaching servo on top of potentiometer. Connecting servo to arduino and than connecting two push buttons for up/down.
    Than I would need the code that at a press of a button servo would rotate for about 20 degree clockwise everytime that I press up button and counterclockwise for down button.

    What would be the code for this? I'm a complete noob in programing.

    Thankyou
     
  2. Wp100

    Wp100 Active Member

    Joined:
    Feb 3, 2009
    Messages:
    965
    Likes:
    43
    Location:
    England
    Just search on " Arduino Servo with push buttons" for many such examples
     
  3. Diy1995

    Diy1995 Member

    Joined:
    Dec 18, 2016
    Messages:
    58
    Likes:
    0
    Oo, i havent thought of that. Thank you
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. ci139

    ci139 Active Member

    Joined:
    Apr 12, 2012
    Messages:
    469
    Likes:
    37
  6. Wp100

    Wp100 Active Member

    Joined:
    Feb 3, 2009
    Messages:
    965
    Likes:
    43
    Location:
    England
    What servo motor are you using ?

    Just be careful if its a 5v type and you power it from the Arduinos +5v supply as many of those examples show; if its a large motor it might need its own direct supply rather than overload the Arduinos regulator which can only give out about 450ma max, a lot less in continuous use.
     
  7. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,099
    Likes:
    562
    Location:
    AZ 86334
    Most servos have a pot to provide position feedback for the servo...
     
    • Like Like x 1
  8. Colin

    Colin Member

    Joined:
    Sep 25, 2003
    Messages:
    397
    Likes:
    22
    Location:
    Australia
    You simply send out the code for each 20 degrees. I did it with a PIC chip to raise and lower boom gates very slowly.
     
  9. Diy1995

    Diy1995 Member

    Joined:
    Dec 18, 2016
    Messages:
    58
    Likes:
    0
    Hello, I thinked this over and servo it's not good for me because it wont remember last position when turned off.
    However I already have servo without pcb inside (just motor and gearings) that I would like to use with a transistor. That way I would only need one pin to be gnd and other one to be + when as long as I press one button and than I would need arduino to change gnd and + between those two pins when I press the other button.
     
  10. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,985
    Likes:
    511
    Location:
    Cleveland, OH, USA
    That may look like a servo on the outside, but it is not a servo. You need feedback of position to make it a servo. Now, if you attach the output shaft to a pot and make a feedback circuit, you can make it into a servo. But, the cost of building that additional circuit will probably exceed the cost of getting a basic, cheap servo.

    If you want to build that feedback amplifier, there are many designs available. First. you will need to define the signal you will be using.

    John
     
  11. Diy1995

    Diy1995 Member

    Joined:
    Dec 18, 2016
    Messages:
    58
    Likes:
    0
    Hello, thank you for your anwser.

    It was a servo, than I removed it's pcb and blocking pin so it works like an ordinary motor.
    And I want to use ordinary motor, because if I will use servo it will always return to it's original position when arduino will be turned off and on. If I use ordinary motor with transistors and program arduino to make for example pin7 LOW and pin8 HI when I press UP button and pin7 HI and pin8 LOW (reversed polarity) when I press DOWN button and both pins LOW when no button is pressed. The motor will stay on it's position when arduino will be rebooted.

    I will use pot to control audio signal (subwoofer level, because have amp connected to my factory head unit).
     
  12. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,985
    Likes:
    511
    Location:
    Cleveland, OH, USA
    If you still want to do what you describe in your original post (i.e., a fixed amount of movement for each press of a directional button), you need feedback from your motor to tell your arduino the servo's position. How do you propose to use a single transistor to do that? Have you drawn a circuit for it?

    Servos without power do not return to their original position. True, power-off holding ability can vary greatly between different servo types, as resistance to movement is due mainly to the gear train and the motor. "Coreless" servos have very little holding ability without power. When you apply power, your servo will assume the position the programs tells it to assume. Maybe your arduino reboots in that "zero position" state. That is a programming issue, not a mechanical one.

    John
     
  13. Diy1995

    Diy1995 Member

    Joined:
    Dec 18, 2016
    Messages:
    58
    Likes:
    0
    I would use 4 transistors (h-bridge). I have read that alot of people have problems with their servo returning to zero state after turning arduino back on. It would be much more simple with the servo and if it would not turn back to zero position I will go for it.
    I had not write any program or schematic for it yet.
     
  14. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,829
    Likes:
    138
    Location:
    morristown,tn
    ONLINE
    A gearmotor would be better
    [​IMG]
     
  15. Diy1995

    Diy1995 Member

    Joined:
    Dec 18, 2016
    Messages:
    58
    Likes:
    0
    Basicly I already have gearmotor (servo with it's PCB removed), i'm realy in dilema what motor to use now. Thanks
     
  16. MikeMl

    MikeMl Well-Known Member Most Helpful Member

    Joined:
    Mar 17, 2009
    Messages:
    11,099
    Likes:
    562
    Location:
    AZ 86334
    What you need are two pots mechanically-coupled onto the same shaft turned by the gearmotor. You could do this if you find a pot with a thru-shaft, or you could use three spur gears (middle gear on gearmotor shaft, outer gears on two pot shafts).

    Use one pot wiper connected to the AD input on the Arduino to position the gearmotor shaft (Arduino based servomotor), the other pot is used to control the audio...

    ps, here are some "dual" pots (two pots on one shaft) that might work for you...

    pps, you might need a linear pot for the position feedback, and an audio-taper for the audio control. Might be tough to find a "dual" like that.
     
    Last edited: Jun 6, 2017
  17. be80be

    be80be Well-Known Member

    Joined:
    Aug 23, 2008
    Messages:
    4,829
    Likes:
    138
    Location:
    morristown,tn
    ONLINE
    Have you tried it I have not had much luck with servo I had some cheap ones that I removed the stop and pcb and powered just the motor they died really fast running on 5 volts. The pcb board must have something on it that limits run time or something.
    They work fine before I took the stop out to make them into gearmotors but they are dirt cheap $1.99 I had some good ones that worked fine after mod.
    Mike's 2 pot idea is what you need. But real gearmotors Is what Id use.
     

Share This Page