Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: alessio136 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:
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...
//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 (http://cgi.ebay.it/2-x-SG90-9g-Mini-RC-Hobby-Micro-Servo-for-Helicopter-IH_W0QQitemZ270221400182QQihZ017QQcategoryZ2563QQssPageNameZWDVWQQrdZ1QQcmdZViewItem) 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.
-
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
-
hey welcome try going through the documentation given with the header files they'll help a lot
-
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.
-
good for u airman but those branded servos arent available everywhere :-[
-
good for u airman but those branded servos arent available everywhere :-[
true but on eBay branded servos are available
eBay has everything!
-
except Ir sensors and other robotics parts
-
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
-
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.
-
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
-
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
-
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 (http://www.st.com/stonline/products/literature/ds/1330/l293d.pdf).
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 (http://www.futurashop.it/allegato/7300-DGEARBOX.asp?L2=AZIONAMENTI&L1=ROBOTICA&L3=MOTORIDUTTORI&cd=7300-DGEARBOX&nVt=)
LINK 2 (http://www.futurashop.it/allegato/7300-GM2.asp?L2=AZIONAMENTI&L1=ROBOTICA&L3=MOTORIDUTTORI&cd=7300-GM2&nVt=)
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
-
By the way it has to be a geared motor
-
coz geared motors are easier to control than normal motors
-
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
(http://www.germes-online.com/direct/dbimage/50164827/DC_Motor.jpg)
-
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?
-
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
(http://www.germes-online.com/direct/dbimage/50164827/DC_Motor.jpg)
hehe clear enough... same-time posting :D
-
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
-
am i the only one confused here as to what you said?
-
sometimes short explanations dont work do they..
-
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.
-
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
-
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. ;)