Author Topic: Servo Motors  (Read 4248 times)

0 Members and 1 Guest are viewing this topic.

Offline alessio136Topic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Servo Motors
« on: March 21, 2008, 10:53:48 AM »
Hello guys! Greetingr from Italy!

first of all, congratulations for the website, I discovered it a couple of days ago anda I read a lot of very interesting stuff!

in particular, I'm focusing on the $50 robot tutorial but I have sum dubts on the servo motors.

this is the code that gets me in troubles:

Code: [Select]
void delay_cycles(unsigned long int cycles)
   {
   while(cycles > 0)
      cycles--;
   }

void servo_left(signed long int speed)
   {
   PORT_ON(PORTD, 0);
   delay_cycles(speed);
   PORT_OFF(PORTD, 0);//keep off
   delay_cycles(200);
   }

void servo_right(signed long int speed)
   {
   PORT_ON(PORTD, 1);
   delay_cycles(speed);     
   PORT_OFF(PORTD, 1);//keep off
   delay_cycles(200);
   }

the code isn't hard itself... just looks like that a servo "moves forward" when the yellow wire is "1" (logic value") and stops when it's "0". moreover, i got the point that the two motors move the same way around the clock, so in order to make the robot turn on itself you have to let both the servos move "forward".

ok, that's fine for me... but does not explain to me how can you move forward...
Code: [Select]
      //detects more light on left side of robot
      if(sensor_left > sensor_right && (sensor_left - sensor_right) > threshold)
         {//go left
         servo_left(44);
         servo_right(44);
         }

      //detects more light on right side of robot
      else if(sensor_right > sensor_left && (sensor_right - sensor_left) > threshold)
         {//go right
         servo_left(25);
         servo_right(25);
         }

      //light is about equal on both sides
      else
         {//go straight
         servo_left(25);
         servo_right(44);
         }

"unsigned long" in the waiting funcion should mean that you keep "1" the "yellow wire" for the absolute value time of the speed variable, but I can't understand how one of the motor can move "backward" with the speed set on "25"...

surely, i miss som theory about the servos, but I couldn't find anything good to explain this... what I found about servos says things different from what I got from the code!


ehm... did you notice I'm quite confused? please help me understanding!

every guide/documentation link is welcome.

thanks in advance!


ps: do THESE SERVOS do the same job of the ones suggested? if yes, i'm ordering a couple of them... so I can do some practice as soon as I get rid of the dubts.

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Servo Motors
« Reply #1 on: March 21, 2008, 10:55:39 AM »
welcome to the forum!

Read this
http://www.societyofrobots.com/robotforum/index.php?topic=2724.0

If you still do not understand I will be happy to go into details

Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Servo Motors
« Reply #2 on: March 21, 2008, 10:59:16 AM »
hey welcome try going through the documentation given with the header files they'll help a lot
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Servo Motors
« Reply #3 on: March 21, 2008, 11:01:22 AM »
oh and dont get those servos

those cheap generic servos are usually pieces of junk and are hard to modify. Go with a name brand like Hitec, Futaba, or GWS.
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Servo Motors
« Reply #4 on: March 21, 2008, 11:05:03 AM »
good for u airman but those branded servos arent available everywhere  :-[
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Servo Motors
« Reply #5 on: March 21, 2008, 11:16:08 AM »
good for u airman but those branded servos arent available everywhere  :-[

true but on eBay branded servos are available
eBay has everything!

Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Servo Motors
« Reply #6 on: March 21, 2008, 11:39:32 AM »
except Ir sensors and other robotics parts
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Servo Motors
« Reply #7 on: March 21, 2008, 11:57:17 AM »
except Ir sensors and other robotics parts

lol


the thing with eBay is that their stock varies per day ( even per minute)
so you just have to wait

I have seen IR sensors and sonar sensors on eBay at times but you just have to be up to date with eBay
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline alessio136Topic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Re: Servo Motors
« Reply #8 on: March 22, 2008, 02:22:45 AM »
welcome to the forum!

Read this
http://www.societyofrobots.com/robotforum/index.php?topic=2724.0

If you still do not understand I will be happy to go into details




wow! that explaination was good enough to understand how does the $50 robot works, but I still miss some concepts about the un-modified servo motor.
I'm looking through the internet now... I'll write here again if I can't find suficient explaination.

thanks to you all guys.


just to use the same topic... If I decide not to use servos for propulsion, what kind of motors should I use? I've read about Stepper and DC... I'm quite interested in both the technologies, but I couldn't find any cheap motor to puts my hands on... any suggestion? ebay and e-shops links are welcome.
« Last Edit: March 22, 2008, 02:25:13 AM by alessio136 »

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Servo Motors
« Reply #9 on: March 22, 2008, 06:37:39 PM »
I strongly suggest to use servos on your first bot

but if you still want motors then you'll need something called an H-Bridge ( search around the forum for info) and also you would need geared motors.

http://www.societyofrobots.com/robot_parts_list_motors_servos.shtml


Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Servo Motors
« Reply #10 on: March 23, 2008, 12:17:28 AM »
if u dont use servos then u should use dc motoors

but since ur a beginner u should go with servos as dc motors are hard to control
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline alessio136Topic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Re: Servo Motors
« Reply #11 on: March 23, 2008, 03:19:38 AM »
thanks guys.

surfing the net and reading several guides I defined the guidelines of the project:
using a PIC to control two DC motors, buffering the PIC pins with a L293D integrated circuit from ST Microelectronics.

3 PIC pins (A, B & C) control each motor: AB set the turning direction and C enables the L293D.

in particular:
A=1,B=0,C=1 --> the motor move forward
A=0,B=1,C=1 --> the motor move backward
A=B --> nothing happens
C=0 --> nothing happens

since L293D has two couples of I/O and an EN pin for each couple, I will be able to control two dc motors quite easily. using the EN pin should help me in programming, since I will have to implemente the PWM signal only on that pin.

what I have to do now, is to find a good/cheap geared motor.
these are possible solutions:
LINK 1
LINK 2
ok, the desctiptions are in Italian, but the images explain the concepts quite weel...

I think that a problem of this solution will be the nonexistence of a mechanic breaking system, since when I stop the motors, they shouldn't stop istantly but prooceed for inertia, but this is a relative problem for now: making this stuff work would be a good-enough start for me  ;D

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Servo Motors
« Reply #12 on: March 23, 2008, 06:24:39 AM »
By the way it has to be a geared motor
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Servo Motors
« Reply #13 on: March 23, 2008, 08:18:52 AM »
coz geared motors are easier to control  than normal motors
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline airman00

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 3,653
  • Helpful? 21
  • narobo.com
Re: Servo Motors
« Reply #14 on: March 23, 2008, 08:23:22 AM »
coz geared motors are easier to control  than normal motors

thats not true at all

because regular DC motors do not have enough torque to drive anything , that is why gears must be added to the regular DC motors.

A regular DC motor looks like this
Check out the Roboduino, Arduino-compatible board!


Link: http://curiousinventor.com/kits/roboduino

www.Narobo.com

Offline alessio136Topic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Re: Servo Motors
« Reply #15 on: March 23, 2008, 08:23:49 AM »
By the way it has to be a geared motor

what do you mean?

coz geared motors are easier to control  than normal motors

why? just because a simple DC motor won't move a robot becouse of it's torque?

Offline alessio136Topic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Re: Servo Motors
« Reply #16 on: March 23, 2008, 08:25:16 AM »
coz geared motors are easier to control  than normal motors

thats not true at all

because regular DC motors do not have enough torque to drive anything , that is why gears must be added to the regular DC motors.

A regular DC motor looks like this



hehe clear enough... same-time posting  :D

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Servo Motors
« Reply #17 on: March 23, 2008, 08:30:36 AM »
well thats what i menat by saying u can control geared motors easily

u see without torque the wheel wont move forward thats why we need geared motors
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline ed1380

  • Supreme Robot
  • *****
  • Posts: 1,478
  • Helpful? 3
Re: Servo Motors
« Reply #18 on: March 23, 2008, 08:49:16 AM »
am i the only one confused here as to what you said?
Problems making the $50 robot circuit board?
click here. http://www.societyofrobots.com/robotforum/index.php?topic=3292.msg25198#msg25198

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
Re: Servo Motors
« Reply #19 on: March 23, 2008, 08:53:59 AM »
sometimes short explanations dont work do they..
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline alessio136Topic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Re: Servo Motors
« Reply #20 on: March 23, 2008, 09:16:08 AM »
sometimes short explanations dont work do they..

short explaination + bad english work even worse. :(


I'll do my best now.

TARGET: control a DC motor with a pic.
let's assume we all know I need to use a geared motor and proceed with the electronics.
of course I need two "wires" to control the motor and since I want to be able to let it move back and forward, both the wires have to move from ground to "high level". when a wire is "high voltage" the other is ground, so the motor moves. if I invert the polarity, so the first wire is ground and the second is "high voltage" the motor moves in the other way.
of coures I can't connect the motor to the pic, since it doesn't have enough current to let the motor move.
what I need is the so-called "buffer" (IC L293): I give as input the TTL signal from the pic (maybe a PWM) and I get as output a strong-enough signal to control the motor.
since the L293 has the enable pin, I'm using a third TTL input from the pic to decide when the motor has to move or not.

I really hope you can understand now! please let me know.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,660
  • Helpful? 169
    • Society of Robots
Re: Servo Motors
« Reply #21 on: March 27, 2008, 06:33:08 AM »
Not to complicate it for you, but airman00 is right, your robot won't work if the motors aren't geared down:
http://www.societyofrobots.com/mechanics_dynamics.shtml

edit: Also meant to send you this link too:
http://www.societyofrobots.com/mechanics_gears.shtml
« Last Edit: March 27, 2008, 06:33:43 AM by Admin »

Offline alessio136Topic starter

  • Jr. Member
  • **
  • Posts: 39
  • Helpful? 0
Re: Servo Motors
« Reply #22 on: March 29, 2008, 03:32:16 AM »
Not to complicate it for you, but airman00 is right, your robot won't work if the motors aren't geared down:
http://www.societyofrobots.com/mechanics_dynamics.shtml

edit: Also meant to send you this link too:
http://www.societyofrobots.com/mechanics_gears.shtml


thanks admin, but I don't think I ever said I'm gonna use not-geared motors... did I?! ???
of course I'm using geared DC motors... indeed I linked two of them when I explained my project for the first time.

by the way, those tutorial are very good and they will help me refreshing my mechanical notions. :D


ps: the project is paused right now, becouse I'm waiting for an Electronic Festival next week, where I can buy cheap electronic components of all sort ^^
pps: I'll post some pictures/videos/schematics as soon as I build something interesting.  ;)

 


Get Your Ad Here

data_list