471,349 Members | 1,173 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

Is there a way to program a robot with python (ex, an electric motor, control it's speed, etc)

i hope someone here can help me.

basically, me and my friend have a summer project.

in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?

i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.

would you program it the same way you would on a personal computer
(via c, python, etc)?

Jul 9 '07 #1
11 3806
so***********@gmail.com wrote:
i hope someone here can help me.

basically, me and my friend have a summer project.

in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?

i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.

would you program it the same way you would on a personal computer
(via c, python, etc)?
Try "comp.robotics.misc" for the basics of robot motor control.

John Nagle
Jul 9 '07 #2
On Jul 8, 5:14 pm, John Nagle <n...@animats.comwrote:
socialanxi...@gmail.com wrote:
i hope someone here can help me.
basically, me and my friend have a summer project.
in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?
i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\
ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.
would you program it the same way you would on a personal computer
(via c, python, etc)?

Try "comp.robotics.misc" for the basics of robot motor control.

John Nagle
thank you.

Jul 9 '07 #3
On Sun, 2007-07-08 at 17:06 -0700, so***********@gmail.com wrote:
i hope someone here can help me.

basically, me and my friend have a summer project.

in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?

i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.

would you program it the same way you would on a personal computer
(via c, python, etc)?
The answers to your questions depend very much on what you're working
with and how the motor is controlled. Is this supposed to be a
self-contained machine, or is it supposed to be connected to a personal
computer as a peripheral device?

The easier way is the peripheral device. In that case, you need some way
of sending signals e.g. from your computer's parallel or serial port to
a relay switch or voltage controller that controls your motor. In that
case, apart from the nitty gritty hardware to make the physical
connections, it's a matter of controlling the parallel or serial port
that the "robot" is attached to, which can definitely be done in Python.

I won't go into details because you're not saying enough about your
project constraints, and as fascinating as your question is, it is
somewhat off-topic on this list (as if that's a deterrent to discussing
something on this list ;-). As John said, you're more likely to receive
useful advice on comp.robotics.misc.

Good luck,

--
Carsten Haese
http://informixdb.sourceforge.net
Jul 9 '07 #4
On Jul 8, 5:06 pm, socialanxi...@gmail.com wrote:
i hope someone here can help me.

basically, me and my friend have a summer project.

in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?

i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.

would you program it the same way you would on a personal computer
(via c, python, etc)?
This might be interesting to you.

http://www.makingthings.com/

~Sean

Jul 9 '07 #5
First you'll need a computer interface to your robot. Lego Mindstorm,
for example, comes with ways to program the onboard CPU. Other
standard robotic toolkits will also come with some kind of interface,
which may or may not have Python bindings.

Cheers,
-T

On Jul 9, 10:06 am, socialanxi...@gmail.com wrote:
i hope someone here can help me.

basically, me and my friend have a summer project.

in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?

i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.

would you program it the same way you would on a personal computer
(via c, python, etc)?

Jul 9 '07 #6
On Jul 8, 5:37 pm, Carsten Haese <cars...@uniqsys.comwrote:
On Sun, 2007-07-08 at 17:06 -0700, socialanxi...@gmail.com wrote:
i hope someone here can help me.
basically, me and my friend have a summer project.
in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?
i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\
ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.
would you program it the same way you would on a personal computer
(via c, python, etc)?

The answers to your questions depend very much on what you're working
with and how the motor is controlled. Is this supposed to be a
self-contained machine, or is it supposed to be connected to a personal
computer as a peripheral device?

The easier way is the peripheral device. In that case, you need some way
of sending signals e.g. from your computer's parallel or serial port to
a relay switch or voltage controller that controls your motor. In that
case, apart from the nitty gritty hardware to make the physical
connections, it's a matter of controlling the parallel or serial port
that the "robot" is attached to, which can definitely be done in Python.

I won't go into details because you're not saying enough about your
project constraints, and as fascinating as your question is, it is
somewhat off-topic on this list (as if that's a deterrent to discussing
something on this list ;-). As John said, you're more likely to receive
useful advice on comp.robotics.misc.

Good luck,

--
Carsten Haesehttp://informixdb.sourceforge.net
I would like the robot to be self contained. basically, I'd like to be
able to program functions in python, ex:

while True:
motor.rotate(1)

and have it repeat the same piece of code every time it's turned on.

Jul 9 '07 #7
On Sun, 2007-07-08 at 19:18 -0700, so***********@gmail.com wrote:
On Jul 8, 5:37 pm, Carsten Haese <cars...@uniqsys.comwrote:
On Sun, 2007-07-08 at 17:06 -0700, socialanxi...@gmail.com wrote:
i hope someone here can help me.
basically, me and my friend have a summer project.
in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?
i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\
ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.
would you program it the same way you would on a personal computer
(via c, python, etc)?
The answers to your questions depend very much on what you're working
with and how the motor is controlled. Is this supposed to be a
self-contained machine, or is it supposed to be connected to a personal
computer as a peripheral device?
[...]
I would like the robot to be self contained. basically, I'd like to be
able to program functions in python, ex:

while True:
motor.rotate(1)
Good luck with that. Your best bet IMHO is to find a single-board
computer (commonly referred to as SBC) that is small enough to fit your
form-factor, capable of running Linux, and equipped with a suitable I/O
interface (e.g. serial or parallel port). In theory, this should allow
you to put Linux and Python on it and control your motor in Python as if
it were a peripheral device connected to a personal computer. In
practice, I've never done anything like this, and the devil is in the
details that you'll need to work out for yourself.

--
Carsten Haese
http://informixdb.sourceforge.net
Jul 9 '07 #8
One "generic" way is using your parallel port for outputting voltages
that would control Relays [2] that would be conected to the motor.

Parapin [1] is the easiest way i know to work with parallel ports but
its for C++, the python binding is still being developed [2].
[1] http://parapin.sourceforge.net/
[2] http://en.wikipedia.org/wiki/Relay
http://es.wikipedia.org/wiki/Rel%C3%A9 <- these graphics are kinda better
[3] http://pyserial.sourceforge.net/pyparallel.html

On 7/9/07, Carsten Haese <ca*****@uniqsys.comwrote:
On Sun, 2007-07-08 at 19:18 -0700, so***********@gmail.com wrote:
On Jul 8, 5:37 pm, Carsten Haese <cars...@uniqsys.comwrote:
On Sun, 2007-07-08 at 17:06 -0700, socialanxi...@gmail.com wrote:
i hope someone here can help me.
>
basically, me and my friend have a summer project.
>
in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?
>
i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\
>
ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.
>
would you program it the same way you would on a personal computer
(via c, python, etc)?
>
The answers to your questions depend very much on what you're working
with and how the motor is controlled. Is this supposed to be a
self-contained machine, or is it supposed to be connected to a personal
computer as a peripheral device?
[...]
I would like the robot to be self contained. basically, I'd like to be
able to program functions in python, ex:

while True:
motor.rotate(1)

Good luck with that. Your best bet IMHO is to find a single-board
computer (commonly referred to as SBC) that is small enough to fit your
form-factor, capable of running Linux, and equipped with a suitable I/O
interface (e.g. serial or parallel port). In theory, this should allow
you to put Linux and Python on it and control your motor in Python as if
it were a peripheral device connected to a personal computer. In
practice, I've never done anything like this, and the devil is in the
details that you'll need to work out for yourself.

--
Carsten Haese
http://informixdb.sourceforge.net
--
http://mail.python.org/mailman/listinfo/python-list

--
/* Carlos A. Guerrero M. [Alias: Sid] */
/* ------------------------------- */
/* Linux User 390240 */
http://guerrerocarlos.blogspot.com
http://guerrerocarlos.wordpress.com
http://www.tooche.com.ve
Jul 9 '07 #9
<socialanxiety@......comwrote:
i hope someone here can help me.

basically, me and my friend have a summer project.

in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?

i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.

would you program it the same way you would on a personal computer
(via c, python, etc)?
It needs a bit more than just the motor - you need to organise some i/o
(lines that the computer can control) and some kind of interface to control
the power, and you have to put it all together - can you solder?

It may be easier to forget about the computer stuff and just use relay logic
for direction control - given that it is a DC motor that would turn the other
way, and not a universal motor (like the one in a drill, that turns the same
way given either AC or DC).

Speed control for a small motor can be accomplished by a heavy rheostat
in series with the motor.

And that should be good enough for a summer project.

On the other hand, if you (or your parents) have pots of money then
you can buy digital to analog hardware that can be used to tell a powerful
DC coupled amplifier what to do, and have a stab at programming the
resultant combination.

But if I were you, I would do the first kind of thing, and use the rest of the
summer to soak up the sun, instead of breathing solder fumes in a basement,
or crouching over a keyboard ruining your eyes watching a screen...
HTH - Hendrik

Jul 9 '07 #10
En Sun, 08 Jul 2007 21:06:48 -0300, <so***********@gmail.comescribió:
in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?
This is mostly an electronics question. How much power? For small power
and fine control I'd look for "stepwise motor" on any robotics book; for a
high power "blender" I think you don't care so much about fine control. In
any case, it's the available motor which dictates how you can control it.
i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.
You may write the GUI using python, and the high level controlling API
too. But you may need to use a PIC or some kind of controller, listening
for commands from the PC and acting over the motor accordingly.

Picasso: a Python-controlled robot for doing paintings
http://youtube.com/watch?v=PsbKq5Kysj0

--
Gabriel Genellina

Jul 9 '07 #11
For a robotics project I would highly recommend the use of Phidgets,
they can supply sensors and interface kits with APIs. Not sure if
Python is fully supported yet but there certinally seems to be a
considerable effort ongoing creating an API for python. I've only used
them to date for servo control and accelorometer sencor data
collection through c++ / wxWidgets.

http://www.phidgets.com/

They offer direct motor controllers but I'll be looking to control a
7.2V motor with a 100A draw, so I'll be using the servo controller to
drive a standard Radio Control Car motor controller.

Cheers,

Wes.

On 09/07/07, Gabriel Genellina <ga*******@yahoo.com.arwrote:
En Sun, 08 Jul 2007 21:06:48 -0300, <so***********@gmail.comescribió:
in this project, we need something that would basically function as a
blender. we know we'll need to buy a motor that spins, but what we're
having trouble with is figuring out how to program it. we want to be
able to control the speed of the motor. how would we accomplish this?

This is mostly an electronics question. How much power? For small power
and fine control I'd look for "stepwise motor" on any robotics book; for a
high power "blender" I think you don't care so much about fine control. In
any case, it's the available motor which dictates how you can control it.
i'm new to all of this, so i'm having a hard time wrapping my mind
around how it'd be possible to program one of those things :\

ex: what if i want the motor to turn for 10 seconds. stop for 5. then
turn the other direction.

You may write the GUI using python, and the high level controlling API
too. But you may need to use a PIC or some kind of controller, listening
for commands from the PC and acting over the motor accordingly.

Picasso: a Python-controlled robot for doing paintings
http://youtube.com/watch?v=PsbKq5Kysj0

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list
Jul 9 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Will Stuyvesant | last post: by
3 posts views Thread by Ricardo | last post: by
26 posts views Thread by Wolfgang Keller | last post: by
13 posts views Thread by squash | last post: by
2 posts views Thread by diffuser78 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.