Author Topic: Stepper Motors And Circuits  (Read 14267 times)

Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #15 on: October 07, 2009, 08:41:22 PM »
Well, I managed to send bytes out the port without that DLL successfully.  It's a cheezy workaround
till I find a good and simple program already made to send a byte out the port as I mentioned in my
last post.

First, Windows free internal Debug (assembly/assembler) program will only work ok with the first 4 data lines (do to d3), but only after sending the "out port"  command several number of times, but it will work.  Overall, probably wont be used by  anyone due to that nature.

I read that you can send a text file out to the printer with this command, I think Windows will allow
this since it (not DOS)  has defined/allotted/accounted for what prn (printer) is in the computer system now:

copy datafile prn

It works ok, it will send the decimal equivalent of the text characters in the file to the printer.  Thats ok
but it's hard to type/enter in characters that have a value of 0, 1, 2, 4, 8, 16, and so on.  So then, you can
make a one byte data file.  I used debug to edit the A character of the file (value 65 decimal or
41 hexadecimal) to the binary values equivalent to 0, 1, 2, 4, 8 , 16 and so on up to 255.  After editing here, I saved the
new data byte back to the file.


note:   copy datafile prn > nul            ; using nul will hide any results from being displayed, nul means to "non existant/nothing"


When ran, a window is quickly displayed and vanishes, however there are ways I read to hide this from being sceen.

I can test each seperate data line, but to allow combinations, which is quite possible, but tedious if I make 255 data files and
batch files, to use those data files with the command shown above.
« Last Edit: October 07, 2009, 09:33:39 PM by Jon »


Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #16 on: October 07, 2009, 08:42:04 PM »
Lastnight and today, I made a new program to send a byte (0 to 255) out of this Win-XP's printer port.  If anyone is having problems with that DLL to access the parallel (printer) port, then this could be a workaround and respectable solution since it does not require that DLL or all those data files as I mentioned in my last post here.  It is probably not lightning fast (how bout a few times a second, is that good enough? I got about a max. of about 10 times a second), but then again the paralell port was never designed to be as fast as possible, that's why they made USB stuff - but that is not as easy to make a project box for.  If you want the program let me know.  I call it pport2.exe (only about 2K bytes long)  and the format to use it is:

pport2  byte          ; where byte is 0 to 255 decimal

[update]  I also have two other programs:
The goal of these programs is to allow the user, someone who has no interest in learning digital or
binary code, to activate remote devices simply by calling a program or clicking on it with the mouse.
They do allow atlease a  minimal amount of programming possibilities that you may need.
 pport3  that can be used to set a particular line on or off.
 pport4  that toggles a line on or off regardless of its current state (on or off).
Let me know and I'll upload it and send a link so you can download it free.

I have made a test program that calls this program (pport2), much like a function call in a programming language, and that program displays numbers 0 to 9 and the decimal point.  In the program I call pport2 with the necessary values to light up the led's on the 7 segment "numeric display" on my project box to look like numbers.

Here is the pport2.exe program I wrote, for sending any value to the parallel port, and it's very useful for non-programmers or programmers alike, to download from a free file hosting site (pardon any  adds), you can rename the program if you want,  to something easier to remember:  

http://www.megaupload.com/?d=8XWEE1IX


When ran, the program does not have any of its own error checking, it only sends out the data on the 8 data lines using the Windows system internal copy command, so you will need a compatable wireing scheme/method and I have one posted here as an image, if yours is different then it is possible it may not work right with this particular program.  The program does not set or read any other of the 25 lines.

Run the program from the command line, or within a  batchfile, ex. a sample calling/running of it would be:  pport2.exe  255
In a batchfile, you can also step through commands by using the pause command on a line, all the user needs to do is
press any key to continue or ctrl break, or ctrl c,  or "X out of the window".
You can also call it from within the code of another program.  This program does create a temporary data file in the folder/directory of which it was ran, thats part of the reason it might seem a bit slow, but if you run it on a flash memory drive or a "virtual drive" in memory, it should be faster.
« Last Edit: October 07, 2009, 09:37:40 PM by Jon »


Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #17 on: October 07, 2009, 08:42:39 PM »
If you don't want to download a program for sending a byte out of the port, here is a method that you can try.   Here is a possible test I made to turn on all (ie. send byte value of 255 out the PC's parallel port) of the datalines or led's.   This works ok on my XP home, and the special DLL ("Dynamic Linked Library" - computer code/program/driver)  to access the printer port is not needed (for now):

Make a 1 byte (data) file.  Go to command prompt and enter ( I numbered the steps, so don't type those in ):

1.  Type in and enter:       copy con test          
2.  press the left alternate key and while holding that down, on the numeric keypad enter 255  
3:  press enter
4.  press left control key and then z key together   OR  enter   left alternate and 26 on the numeric keypad
5.  press enter

It should say something like 1 file copied.  The file made is called test.  Now send it to the printer with:

6.  Type in and enter:     copy test prn

If that does not work right, maby try:     copy test  lpt1

« Last Edit: October 11, 2009, 01:16:20 PM by Jon »

Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #18 on: October 08, 2009, 04:22:59 AM »
When your parallel port project box is working right you can begin to use it for projects, perhaps for a leds, stepper motors, or to switch high power things on or off and below is a circuit for that.  It basically uses a Triac (IC chip) as an electronic switch or relay.

A basic TRIAC 120V circuit





With using the computers 5Vdc to signal the opto-isolator chip:

R1 - 220 ohms (set for the 5Vdc to limit to the current needed, if you use another voltage in, then you should adjust this value of the resistor, higher for higher voltages).  Note, this 220 ohms is the total resistance on the data line from the computer.
R2 - 270 ohms (sets the current for the switching of the triac on/off - check the literature that comes with your triac for a recomended value. This basically allows and limits some of the ac current tapped from the 120vac line to be used for switching the triac on and off.).

You may need to "tweek" the values of the resistors, depending on what your doing.  It is best to check the "data sheets" of the devices to find out maximum values of current and voltage to prevent damage to the device.

NC = no connection

The dot in the upper left corner of the MOC3010 opto-isolator chip IC, and most other IC chip/packages indicates Pin 1, and the other pins are increasingly numbered counter-clockwise.  This opto-isolator chip essentially electrically isolates the computer circuitry from the high power household 120V, and prevents highly likely damage.

Here is a premade board, cheap, that has a opto-isolator chip and a triac, and the price of it cannot be beat, unless you get it for free:  http://www.ereshop.com/index.php?main_page=product_info&products_id=198
« Last Edit: October 17, 2009, 07:35:41 PM by Jon »

Gabriel

  • Administrator
  • Hero Member
  • *****
  • Posts: 651
    • View Profile
Re: Stepper Motors And Circuits
« Reply #19 on: October 09, 2009, 04:04:32 PM »
Thanks for all the info Jon! I know I haven't had much to say, but I have been reading it.

I was actually thinking about trying to build the circuit you provided at this link http://neil.fraser.name/hardware/stepper/cpu.html to control my heliostats. I'm trying to do things for as cheap as possible so that other people who might want to copy won't have to worry about the project costing too much. It looks like that circuit can be built for under $10. The only problem though is that it uses up all eight of the output pins if I were to control two stepper motors, and I will need more than that if I want to use more than one heliostat.

If I had more outputs, then I could control which pair of stepper motors receives the power from the circuit. So, for every extra output, I would have another pair of stepper motors for controlling another heliostat. That's my rough idea anyway.

I don't suppose you have happened across any information about increasing the number of outputs from the parallel port during your research have you?

I have looked on my own some, and learned about shift registers and multiplexers. I'm not sure if either of those are want I want though, and I haven't seen them being used with a parallel port

If you know of something, I would like to hear about it. Even just a single word that I can search on Google would be a big help.

Thanks!
Gabriel


Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #20 on: October 09, 2009, 08:03:11 PM »
Some IC chips use 2 data lines - one for step, and one for direction, and convert the step pulses into 4 bit pulses for controlling the stepper motor.  I think I have some links above.  With that method then 4 stepper motors can be controlled.  Or use the 8 data lines as "step" pulses, and the other control lines as "direction" might have some possibilites - depends on how many control lines there is -  maby use the same signal for all the IC chips maby.  Maby control up to  8 stepper motors this way.

Some options here, though I haven't reasearched much of this, it's just a reasonable guess, and I am considering trying out that circuit you mentioned with some small black transistors (maby I have some or buy a pack of 20 - even risk blowing them just for the test) and a stepper motor from a junk printer someone had tossed along the road.

Somehow put the IC chips or stepper motors in parallel to each other, each receiving the same signal.  Also I guess
with this method, all the stepper motors would have to be identical, each having the same number of degrees per step.

Use the signals from the parallel port's control registers for IC's that have a "chip select" pin.  This pin of the IC will allow (or deny) when set, any incomming data to be "read" or received by the IC.   Essentially, all the data lines will go to each and every IC that has this chip select pin.   4 control bits can then be used to select 1 of 4 IC's where you want the new data to be sent to.  Or, if these 4 bits are decoded as a binary value to a "1 of 8 or 16 output pins" with a special chip, more (stepper motor) IC's or stepper motors can be used.

These outputs have to be "latched" and I beleive it's when they hold their state (1, or 0) once it is set and power is applied to the IC chip.  Sort of like a "memory" or "register".

 Ex. SN74159  IC   http://docs.google.com/gview?a=v&q=cache:bxm07aWic8wJ:www.docentelectronics.com/httpdocs/Electronicsparts/IcChips/IC%2520Chip%2520Pinouts/74159.pdf+4+line+binary+inputs+1+of+16+output+IC+chip&hl=en&gl=us&sig=AFQjCNFejGgvtzap4weMKk_9uTo5hDVSfA

-  It is a "4 line to 16 line decoder",  for us here, it will probably not be used as a "multiplexer" - that is where each of the inputs is selected in sequence usually.  Multiplexer:  http://en.wikipedia.org/wiki/Multiplexer

Also check:  74154 IC  , about $2 - http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&pa=49568&productId=49568&keyCode=PDF,  

4514 IC  -  http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=13522

74HC4514

Some chips might have what is called "open collector" outputs.  I dont think we need them for our projects here, but if so, here is basically what it is:  http://www.acroname.com/robotics/info/concepts/opn_clct.html

  and    http://en.wikipedia.org/wiki/Open_collector

Maby send 4 data lines to a special IC which can decode it to "1 of 16 outputs/lines"..  And then do that for the other 4 data lines, that way there can be 32 outputs.  I am trying to think if the outputs (using 4 of the lines) of a "1 of 16" chip can be used for inputs of another "1 of 16" chip...potentially having up to 64 outputs  from 4 of the data lines from the computer.
« Last Edit: October 09, 2009, 11:19:31 PM by Jon »

gocnc

  • Jr. Member
  • **
  • Posts: 64
    • View Profile
Re: Stepper Motors And Circuits
« Reply #21 on: October 10, 2009, 07:14:25 AM »
Hi Jon
This is a thread that I can relate to however due to lack of time I cant read it in detail.
I have one question about stepper motors being used for solar panels
what exactly is the purpose of steppers doing there
Thanks

Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #22 on: October 10, 2009, 05:59:56 PM »
From what I watched on YouTube.com and thought about:   Stepper motors are often used for "solar trackers".  Solar trackers basically aim the solar panels to have a greater amount  light on them as comparred to a solarpanel that is fixed into a position.  Usually, only one motor is used to turn the solar panel in the horizontal direction (left or right, CW or CCW) and not up and down in the vertical position/dimension.  Light sensors are used to turn the motor on or off to then turn the solarpanel.  Usually there are two light sensors seperated by a "shade dividor" or "screen" or whatever they call it.  As the sun appears to move across the sky, one of the sensors will get shaded and signal the motor to turn on usually [update: I'm wondering if it is possible to get by using only one light sensor, seems likely].  Usually the panel is fixed at an angle equivalent to your lattitude.  Besides light sensors used to control the motor, a computer program or timing method can also be used to turn the motor at a rate of 15 degrees per hours which is equivalent to the "apparent" angle the sun moves across the sky.  It is possible to use a "water motor" to turn the solar panel instead of a stepper motor, but that is off  topic a bit for here, and I think I have a link in my other posts here about that.

[update]  Here is what looks like a 2-axis solar tracker, or atleast a 2 stepper motor tracker since I'm not sure what "axis" but appears more to rotate around 2-axis.  It does look cool if used for some kind of CNC machine also:  
Solar Tracker


[update]  Sometimes the stepper motor is not used to turn a solarpanel, but something else.  The solarpanel is used to charge a battery for later when the steppermotor needs power to turn/move something.
« Last Edit: October 11, 2009, 04:35:52 PM by Jon »

Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #23 on: March 15, 2010, 09:13:20 PM »
Here is a vid I found on YouTube that shows a geared motor that can be useful inplace
of a steppor motor for both solar and cnc stuff.

GM2 motor turning threaded rod


I looked up that GM2 motor and here is some data on it:  http://www.solarbotics.com/products/gm2/

Gabriel

  • Administrator
  • Hero Member
  • *****
  • Posts: 651
    • View Profile
Re: Stepper Motors And Circuits
« Reply #24 on: March 16, 2010, 06:45:06 AM »
That's an interesting coincidence. I was just looking at that guy's website yesterday. http://www.heliostats.org/

Those motors look pretty handy. They are a good price too.

I wonder if it would be possible to rewire them to act like a stepper motor. There might only be two steps per rotation, but that would be fine with a 224:1 to 14:1 gear ratio.

Jon

  • Jr. Member
  • **
  • Posts: 93
    • View Profile
    • YouTube
Re: Stepper Motors And Circuits
« Reply #25 on: March 17, 2010, 07:58:40 PM »
I'm not sure really about how they work, I though they work like a regular motor with a bunch of gearing to reduce speed for some practical applications.  I guess more gearing can also be added to reduce speed even more.

It might even be possible/practical to put two motors onto the same gears to provide double the drive power of the gears.
« Last Edit: March 17, 2010, 08:06:14 PM by Jon »