Hack Forums
Controlling Motors - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: Controlling Motors (/showthread.php?tid=75553)



Controlling Motors - Endeavour - May 9, 2009

Hey guys, I'm looking to control motors in C++, and I've got a question, would I want to connect the relay to the serial port, or the parallel port? I looked on google ;), but I couldn't find the answer.

Btw, the motors do not need to give input to the computer, they'll only be output.

I don't think it's even possible to have a regular motor as an input object :P

Anyway, thanks a lot in advance guys.


- Dark Array - May 9, 2009

what do you mean with motors?
And do you gonna use a microcontroller?
If you gonna use a microcontroller then it should be possible to program it, but that depends on what controller you are using.

anyway give some more details...


- Endeavour - May 11, 2009

OK, well something like the Arduino has a serial port and a parallel port, right? Well, should I write the program to give voltage through the serial port, or the parallel port, which will then switch the relays to power the motors. (They will be big motors)

So the question is not so much a "How do I?" question, it's more of a "Which should I use?" question, meaning which port should I use for motor output.

I'm sorry if this doesn't really make sense, I only started learning C++ like, 1 month ago.


- romulusdgr8 - May 11, 2009

I haven't used the Arduino specifically, but i have used other microcontrollers like it. U said u are using relays. are u using the relays as (basically a power boost) to turn on the motors?
you shouldn't be using the serial or paralles ports for anything other then to connect to the computer.
you want to plug in all your devices to the digital/analog input/output headers. for example, you would plug a sensor (depending on the type) into the digital or analog input header.
motors are output devices so they go to the output headers
what exactly are you using the relays for?


- Endeavour - May 15, 2009

OK, I'm just using the relays to give large amounts of electricity to the motors, something that the computer cannot give.

Where exactly are these output headers located on a normal computer?

Thanks for the help.


- japon - May 16, 2009

Well.. i havent yet go my hand on any arhuino and only recently learnt it's existance (thx bsdpunk), but what i dont get is the question are you going to be passing through a MC or not? If not, then the parallel port is your best bet and is in fact extremely simple to use on linux, and even simpler on freebsd (which i'd strongly recommend for parallel port programming) thanks to their great "ppi" driver.

http://www.softwareplug.com/FreeBSD/man/ppi/4
http://www.excamera.com/articles/21/parallel.html

And ofc, no matter what the size of your motors (i'm guessing simple DC and not one of those triphased servo thingys) with enough relays, you can power it from your paralell port ;)


- Endeavour - May 19, 2009

Thanks for the information, I really appreciate it, and the links you've given me. :)

As for the MC, well, I may or may not use one. We're still deciding on what to use. Although we'll probably end up using a normal pc.

Seriously, you were a great help. If I could +rep I would :P

Thank you very much,