MechMate CNC Router Forum

MechMate CNC Router Forum (http://www.mechmate.com/forums/index.php)
-   80. Computer Hardware & Software (http://www.mechmate.com/forums/forumdisplay.php?f=7)
-   -   Lower Cost Electronics Part 2 (http://www.mechmate.com/forums/showthread.php?t=398)

Aubrey Sun 16 September 2007 01:50

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!" :o

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! :mad::mad::mad::mad::mad:

http://www.mechmate.com/forums/attac...1&d=1189928027
<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.

:rolleyes: 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!:confused:
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



Aubrey Sun 16 September 2007 02:17

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!:eek:

Aubrey

Aubrey Sun 16 September 2007 12:29

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. :D 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 :mad:) 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

Richards Sun 16 September 2007 12:47

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.

Aubrey Mon 17 September 2007 11:50

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

domino11 Mon 17 September 2007 13:05

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. :)

domino11 Tue 18 September 2007 11:08

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.

Tom Caudle Tue 18 September 2007 17:09

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. (:)

Aubrey Tue 18 September 2007 20:00

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! :D)

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.:eek: 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

Bill McGuire Wed 19 September 2007 19:58

Aubrey...
Good luck putting your board together...
Hope your Dr's visit went well...

Aubrey Fri 05 October 2007 21:25

Hi All
Just to let you all know that I have not fallen off the face of the earth.
Quote:
Originally Posted by Bill McGuire View Post
Aubrey...
Good luck putting your board together...
Hope your Dr's visit went well...
Thanks Bill. Dr visit went ok. Almost got full mobility back, strength is still not so good but the pain is gone.

I have to get a couple of boards etched this week so I'll sneak in the logic board as well. The power board will be done on Veroboard for the meantime.

Busy battling with PICBasic Pro, cant get it working properly. If its not up and running properly by Monday, I'll be taking a crash course in mnemonics programming.
May be for the good. Fortunately, I pick up programming languages very quickly. EXCEPT C for some reason or other but I do PHP which is evidently much the same.
Maybe I suffer from "C" dyslexia or something. (No insult intended at all, some of those people who suffer from dyslexia really have it tough. But they survive and have my respect.)

About the opto-isolator thing, initially going with the unit proposed. There WILL be an upper speed limit but this is the first step of a development and there are probably going to be a number of other "problems" to overcome before it becomes a real issue to going forward.

Did some reading on reference material that I downloaded but had not yet got to. Evidently, if you full step using 2 coils (one North, one South) the resonance frequency is different to the one using only 1 coil (North only).

Basically what the author suggested is stepping using the method with the highest resonance frequency untill you are past the resonant frequency of the lower one and then switch to the method with the lower frequency. That way you never actually achive resonance.

For example, method 1 resonates at 2000 steps/sec, method 2 at 2500 steps/sec. So you use method 2 below 2250 steps/sec and method 1 above 2250 steps/sec. There is also a warning that every design of motor (and individual motors within the same model series) have different resonance frequencys. Maybe it would be a good idea to make the threshold frequency adjustable using a trimpot on the board. That way it is adjustable without playing around in the PIC's program.

He also warns that microstepping is not an exact science in that a 1/8th step's position probably wont be exactly in the center of the leading and trailing 1/4 step. Also, 2 identical motors can behave in different ways and/or positions using identical input signals. However the same is also true when full stepping he says. The difference is that a 0.1 degree error in positioning is far less of an issue when stepping 1.8 degrees (5.5%) than it is when stepping 0.225 degrees (44.4%)

Isnt it wonderfull having so many variables! Yea - Right!

But then again, the hobby machinist is not dealing in microns. My personal opinion is that a theoretical accuracy of 1/100th of a millimeter is way more than sufficient. Anyone who boasts of better than that (especially on wood or plastic) is probably kidding themselves. I'd like to know how to measure a micron on wood! My micrometers cant get that accuracy reliably on metal and metal is far more dimentionally stable than wood. Are we trying to machine parts for the shuttle or what?

All the best
Aubrey


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

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