MechMate CNC Router Forum

Go Back   MechMate CNC Router Forum > Computing, Software & Programming > 80. Computer Hardware & Software
Register Options Profile Last 1 | 3 | 7 Days Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #61  
Old Thu 06 September 2007, 06:59
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Aubrey,
What about starting with one of the discrete designs that are available and modifying it to meet your parts availability and cost perspective? That way you might at least eliminate some of the snags that you might run into with a brand new design. I think you will still learn a lot with the redesign , building and troubleshooting the board. Just a thought
Reply With Quote
  #62  
Old Fri 07 September 2007, 17:35
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Quote:
Originally Posted by domino11 View Post
Aubrey,
What about starting with one of the discrete designs that are available and modifying it to meet your parts availability and cost perspective? That way you might at least eliminate some of the snags that you might run into with a brand new design. I think you will still learn a lot with the redesign , building and troubleshooting the board. Just a thought
Hi Heath,
I think that that is more or less what is happening.
The original concept is the PICStep courtesy Alan.
Unfortunately, his "source" is mnemonics, a "language" which I am not anywhere near up to speed with as yet.
Therefore I will have to re-develop the code going into the PIC. For this I am using PIC Basic as Basic was the first language I learned and also because I know someone who has a compiler and is prepared to compile the code for me.
In doing this, I have learned (amongst others) that data is presented to the port in 5 uS pulses (thanks Mike) which is something I didnt know.
I am also sure that there will be a number of other pitfalls that I will stumble across and when this happens, we investigate and fix them.

The only "unique" feature on this project is that the logic and the power circuits are split off onto thier own boards. Once the logic board is developed, the user has the choice of using anything from a basic 8 power transistor push-pull type power circuit to one using the 2 of the most up to date power h-bridge chips or anything in between.
It all depends on what is affordable, available or required by the user.

In the final analysis, if the logic is not up to scratch, it doesnt matter what power circuit you use, it wont work properly.
Thus, using a microprocessor to sort out the logic, makes the most sense as it is relatively easy to modify the code, re-compile it and burn (maybe a bad word to use) it into the processor memory.
If we were to use discrete logic gates and the like to generate the logic, each time we "fix" an error or make an improvement, it would mean a new PC board which would cost plenty and therefore defeat one of the objects of this exercise.

The next question:
How many different types of stepping are there?
In post 56, I made an example of stepping using 4 "command bytes" which is for "Full Step - Full Torque" movement.
If we replace all the "01" parts with "00", this can be called "Full Step - Normal Torque" but I personally think that this mode is not required.

Half Stepping:
10 00 01 00 = coil 1 north + coil 3 south (halfsteparray[1])
10 10 01 01 = coil 1+2 north + coil 3+4 south (halfsteparray[2])
00 10 00 01 = coil 2 north + coil 4 south (halfsteparray[3])
01 10 10 01 = coil 2+3 north + coil 4+1 south (halfsteparray[4])
01 00 10 00 = coil 3 north + coil 1 south (halfsteparray[5])
01 01 10 10 = coil 3+4 north + coil 1+2 south (halfsteparray[6])
00 01 00 10 = coil 4 north + coil 2 south (halfsteparray[7])
10 01 01 10 = coil 4+1 north + coil 2+3 south (halfsteparray[8])

The Dark Red steps have been inserted in between the original steps of the Full Step sequence to get "HalfStep" logic but at this point I start getting a bit confused as to what to do next. Maybe I should have paid more attention at school

Can anyone help out?

We still need Quarter and Eighth stepping (I think eighth stepping also goes under the name of "micro-stepping" - Am I correct?)
Why am I interested in getting all the stepping arrays sorted out at this time? At this time, I still have 3 pins available on the PIC so I thought it may be nice to be able to select the stepping mode using jumpers connected to "some" of these pins.

Best and have a good weekend.
Aubrey
Reply With Quote
  #63  
Old Fri 07 September 2007, 18:17
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Hi All,
Drew this up after watching the Rugby World Cup opening ceremony.
Logic Board layout
Power is 5 volts
Step/Dir comes from the Breakout Board
8 signal wires plus supply voltage (to run the opto isolators) connects to the power board.
3 jumpers (ie 8 options) for selecting step mode (full, half etc)
Cost estimate:
PIC = R15.00
Crystal (from old computer motherboard, external modem or whatever) = free
Opto's @ R6.00 ea = R48.00
Caps, resistors, pins = R20.00
23 parts in total, not counting the header pins.
Cost (without PCB) about ZAR83.00 or about US$11.50
If you want to take the chance and leave out the opto's, its R35.00 or US$4.90

At a rough guess, I'd say that these sorts of prices are definitely "affordable".

Next thing to do is tie down the signal logic arrays for the rest of the stepping modes.

As soon as thats done, go thru to Pretoria, buy the bits and build the prototype and see what it does.

Please remember that this layout was designed by an electronically challenged fitter and turner and probably has a number of things wrong with it at this time. (testing is going to be fun )

Anyway, 2:20am local - hitting the sack
Goodnight
Attached Images
File Type: jpg logicboard.JPG (151.1 KB, 360 views)
Reply With Quote
  #64  
Old Sat 08 September 2007, 04:33
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Logic Board 1.01

Made some changes and improvements to the Logic Board.
Added pull-down resistors to the mode selection jumpers in case I get up to my old trick of forgetting them.
Add another 3 resistors to the parts count.
Cost must be all of US$12.00
Also added another row of pins to the power board output so that I can use an old ribon cable (IDE drive type) to make the connections.
Condensed things and neatened them up.
Was going to add place for LED's but thought better of it. The pulses are so short and quick, you wont see a thing.
Have a good weekend guys.
Aubrey
Reply With Quote
  #65  
Old Sun 09 September 2007, 13:50
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Aubrey,
Not that I am any expert on stepping algorithms, but I have written some assembly language programs to control some stepper boards for some projects we have done at work in the past. Are you sure that pic basic will execute fast enough for your stepper contoller? Will the processing overhead with the basic interpreter be too slow? All of the work I have done before has all been assembly for the speed aspects. Also there are probably hundreds of algorithms for stepping sequences out there. There are full step , half step then all the micro step functions. Then add all the different modifications that are out there for max torque, speed acceleration etc, sine wave etc. I would try checking allegro's site as well as national and sgs thompson for any stepper app notes to help you out. allegro has been doing this for many years and they have it down to a science. The app engineers there helped me out 10 years ago when I first started my stepper project then. There wasnt as many driver chips etc, so back then you HAD to incorporate the proper stepping algorithm you wanted to use, as well as acceleration modifications etc. You just cant go from a stop to full stepping , you have to have an acceleration ramp of some kind, timing and phasing all play a role. Hope this isnt swaying you off your project, just some background
so you can read up some more to do what you want.

later
Reply With Quote
  #66  
Old Mon 10 September 2007, 14:22
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Hi Heath,
Quote:
Originally Posted by domino11 View Post
Are you sure that pic basic will execute fast enough for your stepper contoller? Will the processing overhead with the basic interpreter be too slow?
As far as I know, PICBasic is compiled to native machine code before being burned to the chip, unlike systems like the "Basic Stamp" and others which is an interpreter running the "basic code" component.
If this is the case, there should not be too many speed issues.
However, if it should be an "interpreted" type setup, then we probably will have speed issues and the programming will have to be done in mnemonics and linked to create a hex file for burning.

Quote:
Originally Posted by domino11 View Post
Also there are probably hundreds of algorithms for stepping sequences out there. There are full step , half step then all the micro step functions. Then add all the different modifications that are out there for max torque, speed acceleration etc, sine wave etc.
Admittidly this is true. However my brain is telling me that seeing as there are only 4 coils, each capable of being "north", "south" or "none", there can only be a finite number of possibilities. I dont think that it would be possible (for arguements sake) to get the motor to step to 2 degrees 12 minutes 51 seconds. That sort of action is only possible using servo type motors with very fine encoding devices as far as I know.

The PICStep code has 2 arrays (one for each h-bridge chip as far as I can make out, at this point in time my ability to make heads or tails out of mnemonic code really sucks) containing 64 entries. I have seen a comment "; 1/16 Step" in there so I assume for the meantime that that means Alan is in fact doing 1/16th stepping.

Quote:
Originally Posted by domino11 View Post
....as well as acceleration modifications etc. You just cant go from a stop to full stepping , you have to have an acceleration ramp of some kind, timing and phasing all play a role.
I dont think that any of the currently available driver boards have the capability in themselves of being able to calculate the accelleration that will be required at any point.
Surely that is the function of the software that is sending signals to the driver circuitry?
In other words, the g-code interpreting app (Mach3 or whatever) is set up with parameters indicating the maximum accelleration/decelleration and maximum speed (for G00) applicable.
The g-code file will have the feed rate in it. It is the app's function to send the step/dir instructions to the driver at the appropriate intervals.
These intervals would get shorter as the motor has to accellerate, stay constant once the required speed has been reached and getting longer so that the motor is able to slow down in an elegant fashion when approaching the end of the cut.
Lastly, there is no controler board (Gecho or any other) that is able to "know" what the next instruction will be and when it will be getting it. (no disrespect to these boards intended!)

The only time that the stepper driver board would have to take care of the accelleration/decelleration function would be if it was taking the place of the g-code interpreter but this is not the case in our situation.

(Some time back I got the source of a DOS Basic g-code interpreter and just for fun, tried to convert the code to VB5. I found coding to calculate accelleration/deceleration ramps and all that sort of stuff there.)

It is very important to nail down what each section of the entire system has what responsibilities so here goes:

Lets assume that we already have the g-code file.

The G-Code Interpreter (Mach3 or whatever)
Loads the G-Code source file.
Converts the G-Code to appropriate step/direction instructions for each axis.
Passes the step/direction instructions via the parallel port to the rest of the system.
This is where information about where each axis finds itself (the co-ordinate positions)
Also does other stuff but we'll worry about that later.

The Breakout Board
Has a safety device (charge pump) that prevents any spurious signals from being sent on.
Once the charge pump is active, takes the information being received on the parallel port, splits each byte into four 2 bit pairs and forwards each 2 bit pair to the appropriate logic board as quickly as possible.

The Logic Board
Receives a pair of bytes (step/direction), figures out what coils to energise and to what polarity.
This is where the type of stepping (full, half, quarter etc) is to be set as it only receives 2 info bits (step/direction).
Note: the G-Code interpreter does not know what type of stepping (full, half etc) is being done. All it needs to know is that each step command will move the AXIS a distance of 0.005mm or whatever.
Note: The logic board does not know the co-ordinate position of the axis, all it does is work out the command byte to send to its motor to move it one step (full, half or whatever it has been set to) in the required direction.

The command byte contains 2 bits of info (+ve and -ve) for each coil and is passed to the Power Board as quickly as possible.

The Power Board
Receives the command byte from the Logic Board and immediately sends power to the appropriate coils as per the received command.
All sorts of fancy circuitry can be inserted here (choppers etc) but it can also be a very basic driver circuit. The choice is up to the user.

Quote:
Originally Posted by domino11 View Post
Hope this isnt swaying you off your project, just some background so you can read up some more to do what you want.
Not at all! Each post adds to the knowledge. Sometimes it leads to an improvement, sometimes it does not but it is ALL appreciated.

Anyway, wife switched the study light off again, time to go,
All the best,
Aubrey
Reply With Quote
  #67  
Old Tue 11 September 2007, 06:54
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Aubrey,
Check out these links. One is an app note from the atmel corp which references an article in a trade journal. The second link is the authour of the articles web site with the original article intact. Might be interesting. This is the info I originally used in my first stepper motor driver.

http://www.atmel.com/dyn/resources/p...ts/doc8017.pdf

http://mysite.wanadoo-members.co.uk/stepper
Reply With Quote
  #68  
Old Tue 11 September 2007, 15:21
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Quote:
Originally Posted by domino11 View Post
This is the info I originally used in my first stepper motor driver.
Hi Heath
The stepper motor driver, was it a stand-alone or was it driven by another program on a computer?
Looking at the links you sent, I would say that the PIC was the originator of the timing, not an app on a computer although I may be wrong.

I understand that the motor cannot possibly accelerate from standstill to 50rpm (or whatever) instantaneously but for the life of me I cant see where the driver board is getting the information as to what the target speed is, whether it is accelerating, running at a constant speed or slowing down. All it gets is a step pulse and a direction flag.

And so, in true "fools rush in" fashion, I'm going to assume that the g-gode interpreter (Mach or whatever) takes care of the accelleration ramping and sends the command signals via the parallel port in real time.
This being the case, the hardware we are working on has the sole function of taking the signal, processing it and forwarding the result to the coils of the motor.

To get a working example up in the near future, we should also not panic ourselves to death about the "micro" aspect of the stepping sequences but should use "full", "half" and "quarter" stepping options during this stage of development to keep the complexities from becoming overwhealming.

Once we have something that works, we can get it to work better.

If anyone thinks that the logic board is complex, wait till we start on the power board. Hopefully tempers will not get too heated but I am sure that there are going to be a whole truck full of differing opinions as to how to go about that one.

Anyway, sack time so I'll see you all tomorrow.
Best
Aubrey
Reply With Quote
  #69  
Old Tue 11 September 2007, 21:01
Gerald D
Just call me: Gerald (retired)
 
Cape Town
South Africa
Quote:
Originally Posted by Aubrey View Post
And so, in true "fools rush in" fashion, I'm going to assume that the g-gode interpreter (Mach or whatever) takes care of the accelleration ramping and sends the command signals via the parallel port in real time.
That is correct, Mach/whatever does the ramping.
Reply With Quote
  #70  
Old Wed 12 September 2007, 07:23
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Aubrey / Gerald,
Yes I agree that Mach does some speed ramping but that is not what I am referring to. There are still special algoirthms implemented in the driver boards (either in the driver chips themselves or in firmware) like the geckos. This stepping algorithm will greatly affect the torque of the steppers and the performance of the router. Alan over at www.fromorbit.com implemented a new torque algorithm in his picstep to improve the performance. The wave patterns he is talling about is the switching algorithm as I call it. Just want to make sure some of these details get missed and your performance is less than expected. That is why most diy boards use a driver chip that has the smarts built in. The chips are much more than just a dumb power driver.

a clip from Alans site on his new algorithm change:


I'm working with Henrik (mk2lehe @ CNCZone) in upgrading the PICStep firmware to utilise a "High Torque" stepping wave instead of the Sin/Cos wave I'm currently using.

This update should increase the torque of the steppers (I don't know yet how much, but it sounds like a worth while amount) and help reduce the resonace in motors even further.

I'm also toying with the idea of replacing the way the modes are selected and instead of switching to the different wave patterns for Full, 1/2, 1/4 and 1/8 I'll use burst pulses of the 1/8 pattern to make the Full, 1/2 and 1/4 modes work. This will make these modes silky smooth like the 1/8 mode, but offer the increased mechanical step size and potentially a lower drive pulse width.

Also I'll endeavour to fix the "switching modes while the drivers are running" bug too (not that anyone else has noticed it other than Henrik 8) ).
Reply With Quote
  #71  
Old Wed 12 September 2007, 09:07
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Heath,
I'm having a problem understanding the function of the PIC microprocessor when it is used with Mach 3 software. As I understand it, Mach 3 sends sets the direction signal and then sends out timed pulses to command the stepper driver to turn the motor's shaft. The stepper driver (PIC) does not modify the timing intervals between Mach 3's step pulses. So other than doing the very complicated functions of turning the motor's coils on/off in the proper sequence and running the chopper circuitry, I don't think that the PIC should have any ramping routines built in.

In a process control environment where the PIC totally controlled all aspects of running the motor, including running the motor a certain numbers of steps from start to finish, then I would agree that ramping would be part of the PIC's responsibilities. But in a CNC router application, where multiple axes could be moving at the same time, then something external to the PIC, Mach 3 for instance, has to control ramping so that all axes stay synchronized.
Reply With Quote
  #72  
Old Thu 13 September 2007, 13:42
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Hi All

Gerald: thanks for confirming that.

Heath: There are 2 places where "ramping" is going on.
1) the ramping of the speed at which the motor is being stepped.
2) in the chopper driver circuitry the voltage is ramped (at a level much higher than the motor specification) and then chopped once the coils resistance to change has been (quickly) overcome. In effect, high voltage is applied which allows the coil to change its state much more quickly and once the voltage effectively going thru the coil reaches the "legal" limit, the high voltage is chopped to produce the "legal" voltage.

Point 1 is under the control of the "g-code interpreter" which is on the computer.
Point 2 is under the control of the "power" module.

Remember that we have taken the traditional "driver" board and split it into a "logic" module and a "power" module.

Another point to remember is the name of this thread. We are not trying to make the best controler system, simply one that is affordable and in its basic form, does not require scarce (outside the USA/Europe), costly components.

As things stand, the breakout board comes in at maybe $5,00 (probably less)
The Logic board is about $12.00 at this stage. Need 3. Make that $36.00
With a "Bare Bones" power board that uses common power transistors to do the switching, need 4 pairs at (estimated) $2.00 per pair plus some other support circuitry, estimate (high) at $20.00 per board. Need 3 makes it $60.00

Grand Total = $101.00 (or ZAR 730.00)
This is a far cry from $1300.00 (ZAR9300.00) for the "professional" equipment, albeit the performance wont be there.

Once we have the mill moving (slowly), we can start on chopper drivers using any flavour of power h-bridge chip that we want, but that is "later". Lets crawl before we try sprinting.

Mike: You and I are seeing it from the same point of view. I think that Heath is seeing the PIC as the "process controler" instead of the PC/Mach3 being the "process controler".

If a future chopper circuit needs any "processor" power, we can put one on the power board specifically for that requirement.
The beauty of having split the logic module away from the power module is that we only have to upgrade the power module at a later point to upgrade the performance of the whole system.

As to the "High Torque stepping wave" and "Sin/Cos wave" that Alan wrote about, he is so far more advanced in his understanding of the whole process that it makes me nervous. But, once he was where I am so I will just have to learn.

Scary Thought: Where will he be when I am where he is now?

All the best,
Aubrey

Last edited by Aubrey; Thu 13 September 2007 at 13:43.. Reason: fixing typo's
Reply With Quote
  #73  
Old Thu 13 September 2007, 15:14
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Aubrey,
Great, like I said before I am no expert, just trying to help you cover the bases as you round out home plate. Some of this stuff is from 15 years ago for me so please double check my ideas or facts! I agreee with your synopsis and looks like you are looking into all the avenues. Have you decided on what fets/drivers you are going to use? There are a lot of good discrete fets available these days as well as driver chips like the lmd18245 from national that Alan uses.

Gerald,
How do we get you to come over to the Dark Side? Electronics can be as much fun as the mechanicals. Sometimes I feel more comfortable with a soldering iron than a welder.
Reply With Quote
  #74  
Old Thu 13 September 2007, 15:17
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Mike,
I think Aubrey summed my thoughts up better than I did. I was referencing the chopper current ramping which will affect the available torque. This is what I think Alen is doing in his picstep design. He just implemented a new algorithm that improved the torque output in the stepper. You can probably get away without a chopper type drive but the performance will be lower I assume.
Reply With Quote
  #75  
Old Thu 13 September 2007, 22:48
Gerald D
Just call me: Gerald (retired)
 
Cape Town
South Africa
Heath, I might wonder over to your side when I can figure out why you guys block up your plastic pipes with copper
Reply With Quote
  #76  
Old Fri 14 September 2007, 10:12
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Quote:
Originally Posted by Gerald D View Post
Heath, I might wonder over to your side when I can figure out why you guys block up your plastic pipes with copper
Huh?
Reply With Quote
  #77  
Old Fri 14 September 2007, 10:50
Gerald D
Just call me: Gerald (retired)
 
Cape Town
South Africa
Us hydraulics people want our pipes to be clear and free-flowing. Those things that look like pipes on your circuits (I think you call them "wires"), wouldn't they flow more freely if you took the copper blockages out?
Reply With Quote
  #78  
Old Fri 14 September 2007, 12:30
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Hi All
This chap Alan is a very bright lad.
Like most people, I spend at least half of the time taken to get to and from work waiting at traffic lights. This is where I sit and ponder all sorts of things and today it was how Alan handles the array that contains the coil switching settings.
In his source, he uses 2 arrays (one for each power h-bridge I think) but the really cleaver bit is how he seems to step thru the array to get the necessary settings to the coils when they are needed.
I think I have stumbled on the secret!

Lets build our own array of commands first starting with the full steps.

10 00 01 00 (fullstep 1)
00 10 00 01 (fullstep 2)
01 00 10 00 (fullstep 3)
00 01 00 10 (fullstep 4)

Now we add the half steps between each existing step.
10 00 01 00 (fullstep 1)
10 10 01 01 (halfstep 1)
00 10 00 01 (fullstep 2)
01 10 10 01 (halfstep 2)
01 00 10 00 (fullstep 3)
01 01 10 10 (halfstep 3)
00 01 00 10 (fullstep 4)
10 01 01 10 (halfstep 4)

Next, the Quarter Steps also between each entry and then the Eighth Steps to complete the array.
1) 10 00 01 00 (fullstep 1)
2) ?? ?? ?? ?? (eighthstep 1)
3) 10 10 01 00 (quarterstep 1)
4) ?? ?? ?? ?? (eighthstep 2)
5) 10 10 01 01 (halfstep 1)
6) ?? ?? ?? ?? (eighthstep 3)
7) 10 10 00 01 (quarterstep 2)
8) ?? ?? ?? ?? (eighthstep 4)
9) 00 10 00 01 (fullstep 2)
10) ?? ?? ?? ?? (eighthstep 5)
11) 00 10 10 01 (quarterstep 3)
12) ?? ?? ?? ?? (eighthstep 6)
13) 01 10 10 01 (halfstep 2)
14) ?? ?? ?? ?? (eighthstep 7)
15) 01 10 10 00 (quarterstep 4)
16) ?? ?? ?? ?? (eighthstep 8)
17) 01 00 10 00 (fullstep 3)
18) ?? ?? ?? ?? (eighthstep 9)
19) 01 00 10 10 (quarterstep 5)
20) ?? ?? ?? ?? (eighthstep 10)
21) 01 01 10 10 (halfstep 3)
22) ?? ?? ?? ?? (eighthstep 11)
23) 1 01 00 10 (quarterstep 6)
24) ?? ?? ?? ?? (eighthstep 12)
25) 00 01 00 10 (fullstep 4)
26) ?? ?? ?? ?? (eighthstep 13)
27) 10 01 00 10 (quarterstep 7)
28) ?? ?? ?? ?? (eighthstep 14)
29) 10 01 01 10 (halfstep 4)
30) ?? ?? ?? ?? (eighthstep 15)
31) 10 01 01 00 (quarterstep 8)
32) ?? ?? ?? ?? (eighthstep 16)

(The reason why the eightstep entries are "?? ?? ?? ??" is I have not got round to figuring out what coil switching combination will take the stepper to the required position yet - give me time )

And here is where Alan gets very clever. It seems (to my non-expert eye) that if he is stepping in "Full Step" mode, he increments the array element counter by 8.
In other words, the 1st step is array element 1, the next is 9 which (co-incidently) is the next "full step" entry and so it carrys on.
When "halfstepping", the increment in the example would be 4.
When "quarterstepping", the increment is 2.
And when eighth stepping, the increment is 1.

Whats so good about that?
Well, firstly, there is only 1 array, not 4.
Secondly, duplicate information would not be stored. If there were 4 arrays, there would be 4 copys of the full step data, 3 of the half and 2 of the quarterstep data.

To allow us to manually switch between the 4 modes, we use 2 of the pins on the PIC and jumper them high or low. 2 pins would give you 4 valid options.
Will have to remove the 3rd jumper on the pcb as we dont need it.

Mmmm.... I wonder what we can use it for????

In my case, with a leadscrew pitch of 2mm per rev, each eighthstep would move the axis 0.0003125mm. In my opinion, one third of a micron that is WAY to small a resolution.

I think I read someone say that the MechMate moves 75mm per rev of the stepper. That would give a resolution of 0.01171875mm per eighth step. Unless you have a very expensive digital vernier, you can only measure to that degree of accuracy with a micrometer and when last did you use a micrometer on a piece of wood?

Anyway, I hear a beer calling me and as it has been a rather hectic week, I'm going to listen to it.
Have a good weekend.
Best
Aubrey
Reply With Quote
  #79  
Old Fri 14 September 2007, 12:31
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Quote:
Originally Posted by Gerald D View Post
Us hydraulics people want our pipes to be clear and free-flowing. Those things that look like pipes on your circuits (I think you call them "wires"), wouldn't they flow more freely if you took the copper blockages out?
Ja Well No Fine
A
Reply With Quote
  #80  
Old Sat 15 September 2007, 03:53
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Aubrey,

You're making great progess! If you have time, Google articles and books written by Chuck Raskin, P.E.. His book, "Designing With Motion Hanbook II", published in 1992, was required reading before he would sell any stepper or servo electronics to first-time customers. I really didn't like being forced to buy a book before I could buy parts, but his book answered many of the questions that 'newbys' often have. I've referred to his book as often as I've referred to documentation from Oriental Motors. He has also written articles for "Circuit Cellar", which is an excellent magazine dealing with computer control.
Reply With Quote
  #81  
Old Sun 16 September 2007, 01:50
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Quote:
Originally Posted by Richards View Post
Aubrey,
You're making great progess!
Thanks Mike. I'll be surfing for info on Chuck Raskin later today.


I think that this would be a good time to say
STOP THE BUS

In post 78 I listed an array that is not necessarily correct!
Let me explain:
I have been fighting with the array since about post 62 where I first listed an the halfstep array of motor coil energizing commands.
Since then, I have been trying to figure out what the energizing sequences would be to get the motor to step one eighth of a step but have not been having too much success.
Eventually, I wrote a small VB app to take the byte that I want to send to the stepper and graphically represent it on screen so that I could "see" what happens as far as the coils magnetic fields are concerned when the various bit values are changed in the energising command byte that I want to send to the motor.
Had to do a bit of debugging and eventually got it to work OK for this exercise.
And here is the kick in the teeth!
Simply applying 10 volts to the motor (in appropriate polarity) works 100% for full stepping and half stepping.
I think that it is "ALMOST CORRECT" for quarter stepping as well.
But for eighth stepping and better, IT WONT WORK in its present form!

Everyone say in chorus: "But we told you so!"

Why wont it work?

Here is 2 of the graphical results from the app. The left image is the first full step and the right is the first quarter step. The yellow lines in each represent the central position of the magnetic fields.
Left Image (Full Step 1): As can be seen, there is only 1 line visible. The lines are in exactly the same orientation and therefore there is no "nudging" of the motor shaft due to the interaction of magnetic fields. The orrientation of the rotor/shaft is "north/south" or vertical.

Right Image (Quarter Step 1): Here 2 yellow lines are shown, one for the red half-circle, one for the blue quarter circle. The green line is the (approximate) average position that the rotor/shaft will find itself due to the interaction between where the red field wants to place the rotor/shaft and where the blue field wants to place the shaft.
Note: All green and yellow lines were added manually by me to the image to help me understand what was going on.

The white dot with the green background and yellow circle around it that is pointed to by the red arrow (yea! I know! Its a rainbow!) is where the rotor/shaft must be to sucessfully position at eighth step 1.

The only problem is that using the methodology as it stands, I cant get there!


<edit - for some reason the image wont display inline (for me). You will have to click the link.>
So, to get eighth stepping or better, we will have to make changes somewhere but what and where.

As we are using a PIC to get things done on the logic board, we probably wont have to change anything physical on the logic board. (Note to me: Maybe the opto-isolators cannot handle analog signals.) The programming inside the PIC is another case entirely!

Essentially what is going to have to happen is that we are going to have to change the output going to the power board from a simple 5 volts ON or OFF to a more complicated scenario where the voltage being placed on any pin (and therefore magnet coil) is variable between 0 volts and 5 volts. (Note to me: Can a pin on a PIC be set to output analog signals?)
By varying the strenghths of the fields produced by the various coils, we should be able to position the rotor/shaft at the exact position required.
Theoretically I think that we should be able to "step" the motor in such small increments that it would be rediculous.

Now the complexity of the arrays that Alan uses in the PICStep is starting to make sense. I'll have to study that code again in light of this discovery to see what else I can learn from it.

An equally important point to remember when it comes to the time to build the Power board is that the power transistors/FET's or whatever will now be required to do partial switching.
In effect this means that (assuming the motor voltage is 10 volts) if the Logic board outputs a 4 volt signal (logic board operates between 0 and 5 volts), the power board must be able to output an 8 volt (4/5 * 10v) to the coil.

Mmmmm.... I wonder if the reason that no-one has produced seperated Power and Logic boards is to prevent people (idiots like myself) from using long lengths of wire between the two, thus affecting the voltage of the analog signal being received by the Power board and thus the field strength of the coils and thus the positioning. Long lengths of wire have been known to cause voltage drops and here it would change the positioning of the rotor/shaft. Something to bear in mind when writing the documentation for the final product.

Ok. The world suddenly got a whole bunch more complicated!
Not to worry though, the understanding of the processes involved also made a great improvement and now we are probably better equiped to get this project done with a better level of efficiency and success.

To those who have helped by posting comments and/or info links, thank you. Without your input, this thread would be dead in the water.

To those who are "lurking", hows about a post, subscription or a rating? I must admit that the discoveries that lead to this posting have somewhat sapped my energy but not my enthusiasm. This does not at all mean that its going to be abandoned but a little moral support would be good for the soul if you know what I mean.

Have a good Sunday all.
Best
Aubrey



Last edited by Gerald D; Sun 16 September 2007 at 02:56.. Reason: image problem
Reply With Quote
  #82  
Old Sun 16 September 2007, 02:17
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Quote:
Originally Posted by Richards View Post
Aubrey,
If you have time, Google articles and books written by Chuck Raskin, P.E.
He has also written articles for "Circuit Cellar", which is an excellent magazine dealing with computer control.
To quote one of his articles on circuitcellar.com

It's critical to understand both the operational and system-reaction differences among various types of steppers. For example, a chopper drive always causes stepper motors to vibrate when not commanded to move.
May explain complaints made about motor buzzing, vibrating etc.

The microstep translator is so-named because the stepper motor's current-generated magnetic field enables the armature to be positioned anywhere between its actual detent positions. The most popular microstep ranges available (at reasonable cost) are 2, 4, 8, 16, 32, 64, and 128 steps per full step.

Comments:
Maybe we should call the Logic" board a "Translator" board instead.
128 steps per full step gives a resolution of 50.625 Seconds. That would be high resolution in anyones books!

Aubrey

Last edited by Aubrey; Sun 16 September 2007 at 02:18.. Reason: typo
Reply With Quote
  #83  
Old Sun 16 September 2007, 12:29
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
OK - time to stop feeling sorry for myself!
1) We dont have to use analog signals, we use PWM to get the result we want.
(Pulse Width Modulation - switching the pin on and off very quickly. By changing the length of the on and off parts, the average represents the voltage required. eg. 5v on pin, 50% duty cycle or 50% on, 50% off should give you 2.5v as the average voltage give or take)
I had a look around the Microchip.com site and found out that the PIC is often used to provide stepper driving. I specifically looked at Stepper Motor Control Using the PIC16F684 which explained a number of points.

2) Opto-isolators generally are no good when using analog signals as they have a voltage below which they do not switch. Also, they dont "turn on partially", they are either on or off.
But as we are using PWM (which is digital) we wont need analog signalling.

All of this means that the Logic board design does not have to change which is a good thing. We can use the PIC to do PWM (a built in feature on certain units, if not all). All of this will have to happen in the program.

Speaking about the program, we are going to have to develop it mode by mode starting with the full step and working down, making sure that the mode currently under development does not screw up the operation of any of the preceeding modes.
As both full and half stepping wont need any PWM, when these are being developed, a 100% duty cycle can be used for the PWM setting. This way, when we get to the modes that need PWM, it is already implimented and can simply be used. The PWM cycle percentage info is stored in another array (THATS WHY ALAN HAS 2 ARRAYS - NOW IT STARTS TO MAKE SENSE!)

{Note to Gerald: Hows about a lightbulb smiley so that I can mark those "Eureka" moment?}

Where to now?
Tuesday I have to see a surgeon for a checkup. After that, I'll probably be going to Pretoria (or Tswanie if you are politically correct - wont go there on this forum ) to get parts for a controler project at work and will get the bits for the Logic board at the same time. Another prototype board may be a good investment too.

Hopefully we can have a motor fullstepping on the bench by the weekend sometime as long as the work project does not give too much drama.

Sorry I was so negative in post 81 but panic set in when I realised that stepping below halfstep involved a whole re-think. At one point I really thought that this project had been blown out of the water and I would have to abandon it. I REALLY dont like giving up, its a bad habit to start.

Have a good week.
Best
Aubrey
Reply With Quote
  #84  
Old Sun 16 September 2007, 12:47
Richards
Just call me: Mike
 
South Jordan, UT
United States of America
Opto-isolators typically have minimum pulse-width requirements. Mariss uses good ones on the Gecko products that allow about 200,000 Hz, but many of the average (cheap) opto-isolators would have a hard time keeping up with a 10,000 Hz signal.
Reply With Quote
  #85  
Old Mon 17 September 2007, 11:50
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Quote:
Originally Posted by Richards View Post
Opto-isolators typically have minimum pulse-width requirements. Mariss uses good ones on the Gecko products that allow about 200,000 Hz, but many of the average (cheap) opto-isolators would have a hard time keeping up with a 10,000 Hz signal.
Hi Mike,
Found the manufacturers data sheet, they They quote figures as follows:
Turn-on time : 3.0 µs
Rise time : 2.0 µs
Turn-off time : 2.3 µs
Fall time : 2.0 µs
Cut-off frequency : 250kHz

The number I looked at was "250kHz". I assume (a dangerous word) that this means that the thing will start "mis-firing" above 250kHz.
So lets work at 80% which would give us 200 kHz. If we set the cycle of the signal being generated by the PIC to 200kHz (or less), it should be ok. We cant - its directly related to the crystal speed used on the PIC.

Extract from the basic manual:
PWM Pin,Duty,Cycle
Outputs a pulse width modulated pulse train on Pin. Each cycle of
PWM consists of 256 steps. The Duty cycle for each PWM cycle
ranges from 0 (0%) to 255 (100%). This PWM cycle is repeated Cycle
times. Pin may be a constant, 0 - 15, or a variable that contains a
number 0 - 15 (e.g. B0) or a pin name (e.g. PORTA.0).
The Cycle time of PWM is dependent upon the oscillator frequency. If a
4MHz oscillator is used, each Cycle would be about 5ms long. If a
20MHz oscillator is used, each Cycle would be about 1ms in length.
Defining an OSC value has no effect on PWM. The Cycle time always
changes with the actual oscillator speed.
Pin is made an output just prior to pulse generation and reverts to an
input after generation stops. The PWM output on a pin looks like so
much garbage, not a beautiful series of square waves. A filter of some
sort is necessary to turn the signal into something useful. An RC circuit
can be used as a simple D/A converter:


As we will be using a 20MHZ crystal, the cycle will be 1ms - that should deal with the strain comfortably.

The RF circuit they use as an example is a 10k resistor and a 1uF cap. Simple and cheap.

Your comments please.
Best
Aubrey
Reply With Quote
  #86  
Old Mon 17 September 2007, 13:05
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Aubrey,
At 200 Khz your period is only 5us. The 250 kHz is only the absolute maximum frequency the isolator will tollerate. With the other specs your setup, rise and fall times I dont think you will want to switch that fast. Maybe research a better isolator. As Mike said, gecko needed to use high quality isolators to get to 200Khz. I dont know of any good ones but a google search might be helpfull.
Reply With Quote
  #87  
Old Tue 18 September 2007, 11:08
domino11
Just call me: Heath
 
Cornwall, Ontario
Canada
Aubrey,
I had a closer look at your datasheet and I noticed the following. The specifications for switching mode of operation for that opto has TYPICAL turnon time of 3 us and a min turn off time of 18us at an current of 20mA. Rise time and fall times are 2us and 11 us respectively. This looks to me like a max frequency (probably not usable at this freq due to tolerances the specs are typ not max) of about 29KHz. Maybe you could get a better isolator, a quick check turned up a 6n136, fairchild makes these and they are relatively easy to get here at most suppliers and they are a lot faster. Another option would be for logic level couplers used in data transmission, these can operate in the vicinity of 20 to 40 Mbaud. I dont have any part numbers off the top of my head but let me know if you are interested and I can dig some up. The 6n136 are probably easier and cheaper to get.
Reply With Quote
  #88  
Old Tue 18 September 2007, 17:09
Tom Caudle
Just call me: Tom
 
Texas
United States of America
Those series of opto's are only usable to a few kilohertz. When your combination of rise and fall times become greater than the period of the shortest pulse you are pretty much through. Most processor chips need fairly snappy rise and fall times because you are only reading a pin for maybe 2 to 4 clock cycles. With trapezoid waveforms you will miss pulses.

The 6N136 series for faster risetimes and even then you have to be careful with deep saturation.

Then with microstepping your raw clock cycles start to come into play. In running CNC and spinning motors at 600 to 800 RPM you find you need lots of steps quickly. It's not unusual for 25.000 steps per second to be too slow. While that is no problem for a PIC remember that you are going to be burning multiple clock cycles and trying to do microstepping. Things add up pretty quickly. To spin a stepper at 10 Rev/sec (600 RPM) you need 200 * 10 or 2000 separate transitions. For 1/4 stepping you need 8000 per sec etc....
If your chip has to do anything else but generate the step sequences you quickly start facing max stepping issues.

I'll stop here. I don't want to spoil all your fun. (
Reply With Quote
  #89  
Old Tue 18 September 2007, 20:00
Aubrey
Just call me: Aubrey
 
Jhb
South Africa
Hi Heath, Tom,
Very good points that have been raised with regard the limitations of the CNY17-1X opto-isolator.
Could not find a local price for the 6N136 but based on the price of US$ 2.81 from RS Components (normally on the high end of the price spectrum) this will be about ZAR 21.00 each or 10 times more expensive and we need 8 per motor.

Been thinking about it a lot.
We have been doing a lot of problem solving for situations (microstepping variants) which we have not got to yet and are getting mired down, which is not a good thing.

I have to keep reminding myself that the idea behind this thread is to get the mill to move, not to make a driver that will dominate all the rest. (Net yet anyway! )

Once the bare bones design is built and tested, we can start developing it to get closer to the ideal running specifications.

Because we can in theory step at full and half step rates without PWM driving which will allow the use of the low cost opto-isolator, this is where we should start.
Once we start on phase 2, we must also ensure that we are backwards compatible so that the user can start with the low spec components and ride the upgrade path without having to get a new board.
And remember, we MUST get to phase 2 (microstepping) as soon as possible as I want to build my own MechMate over the December shutdown and with a 75mm per rev requirement, high power microstepping is mission critical.

Someone said to me today that if the opto was causing so much grief, we should simply leave it out. I wont even consider it as a "minimum specification" but I suppose we can put in jumpers that will carry the signal over the hole left by the opto. The guys can go that route if they want to but......

Someone else also explained to me that a silicon switching device generates very little heat when if is full on and full off. The heat gets generated while the state is changing and when it is operating between on and off (half on, quarter on etc). Therefore we must make sure that it spends as little time as possible between on and off (transision or partially conducting) to prevent destructing of the lower cost, lower specification components that will be used in the Power module.
Chopper circuits get the rise ramp happening steeper but at a cost of higher component count AND bigger power supply. A trade-off will have to be made somewhere so I think the base Driver board should also be as simple and inexpensive as possible and the full and half modes on the Logic board should have to be optimised for the base Driver board. To start with anyway.

Guys, I dont know where this project is going! It may go nowhere. It may also become the "Linux" of the CNC hobby field with a whole bunch of guys devloping Power board designs each with different pro's and con's and others doing the same to the Logic board. Users might be able to "mix and match" to get the ideal setup for thier machine. I simply dont know!

All I do know is that the longest journey starts with a single step and so to get that "single step", I need to build the prototype Logic and Power boards.
If it does not work, I'll see if I can get it to work. When it does work, then we look at improving it but all the time we have to stay true to the original concept of "a lower cost electronics" solution that the new guy can afford and build without robbing a bank to pay for it.

For the next 2 weeks or so I wont be as active on this forum but I will look in every other day or so. The reason involves about 350 resistors, many diodes transistors and caps, about 50 relays, 20 or so limit switches, 6 pieces of 12 inch by 4 inch Veroboard and 2 big 40 pin PICS which are all eventually going to to become an electro/pnumatic production machine controler. A lot of soldering, testing and fault finding lies ahead so wish me luck.

I've already bought a whole bag of bits, everything (I think) for the Logic board and most of the goodies for the Power board. Finished the 5v power supply today and on Saturday will be scrounging a transformer for the Power board main supply at the local HiFi repair shop but from tomorrow onwards, I will have to concentrate mainly on the boss's project.

But PLEASE dont let this thread die while I'm scarce, to quote the Terminator, "I'll be back!"

Suggestions, Wish Lists, Specs (volts/amps) of the motors that you may want to drive using this setup and anything else will be appreciated and answered, eventually.

All the best
Aubrey

Last edited by Aubrey; Tue 18 September 2007 at 20:04..
Reply With Quote
  #90  
Old Wed 19 September 2007, 19:58
Bill McGuire
Just call me: Bill
 
Weiser, Idaho
United States of America
Aubrey...
Good luck putting your board together...
Hope your Dr's visit went well...
Reply With Quote
Reply

Register Options Profile Last 1 | 3 | 7 Days Search Today's Posts Mark Forums Read

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 13:41.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.