FezCNC

try different PB switches. Possibly a noise issue ? Are you using interrupts?

You could of course just touch a wire to GND as a simple switch to validate.

Yes, to the interrupts question, and there are no noise sources to interfere with the signaling. The test were being done in isolation.

So I managed to find the calculations to properly control a stepper motor, and I wanted to link them here to leave a bread crumb for future followers:

http://fab.cba.mit.edu/classes/MIT/961.09/projects/i0/

[quote]There are 7 pins per driver: Step, Direction, Sleep, Enable, Mode1 2 and 3. 7 x 4 = 28

Sleep puts the entire driver into low power mode, while enable enables voltage to the FETs

Further, I need 2 more pins for the limit switches per axis; and there are 4 of them. X1, X2, Y and Z for a total of 6 plus 1 for ground = 7[/quote]

Step and Direction are the only driver related lines that would be controlled separately. Sleep, Enable and modes would be common to all drivers. There is no need to control each driver separately. Limit switches can also be combined. For small machines you really only need a home sensor/switch on each axis (which can also be wired in series consuming only one input). Once homed you know where the limits of travel are. On large/fast machines you do need limits to prevent the machine from damaging itself or you.

How would you wire the 3 axis on 1 pin? Using the analog input or something with different resistance values that determine which home switch was pressed. There is also going to be a step feedback loop on the analog ports to try and detect missed steps and correct for them.

My end machine is intended to have a work area of at least 9 by 5 by 1 feet.

My suggestion would be to first download the manual for Mach 3 and/or EMC2 and do some reading about how CNC controllers work and strategies for reducing the number of I/O needed. As a customer once told me, “I don’t mind reinventing the wheel, what I’m afraid of is reinventing the flat tire.” In other words find out how others have solved the same problems you are facing before trying to reinvent the wheel.

You will likely find that trying to detect missed steps with the FEZ will be impossible. You will need quadrature encoders on each motors and will need the ability to sample each input at at least 2x the max frequency of the pulse train (look up nyquist value). There are some quadrature decoder ICs out there, and it is a good job for a FPGA, I have also talked to one manufacturer recently that is using a small pin count Cortex M0 to off load the quadrature decoding from the main processor.

In reality you will NEVER have a missed step IF you are not overloading the stepper motor. It just will not happen. There are some applications where a machine can have a sudden load change that is unpredictable, picture a conveyor where a large box can suddenly drop on it. In a case like this a stepper, with a ‘missed step detecting driver’ can be used to great benefit. On a machine where you are coordinating multiple axis though you have to slow down every axis to allow one to catch up, it is not a simple problem.

I’m not trying to be negative, in fact I applaud your efforts, but I would hate to see you ‘reinvent the wheel’ only to find it is a flat tire. The time invested in a bit more research will pay off later.

I also can’t picture this…

Wire them in series and you will only know when all axes are homed as switches in series act as an AND boolean function. Do you just drive all motors home, ramming some against the stops until all are homed in this case?

Wire them in parallel and it give you a true then one, or more, axes is homed and you wont know about the other axes. Switches in parallel act as an OR function. Do you move one axes home then back it off till the switch switches off then do the next axes, etc?

Thanks,
Errol

Limit switches should always be wired NC (I forgot this tidbit, sorry.) This way if the wiring gets cut the machine will automatically stop, this is a very basic form of supervision. I have seen machines rip themselves apart, doing thousands of dollars of damamge, because a limit switch wire was broken.

So you have multiple limit switches in series, if any one of then is triggered the circuit is opened. Since homing is typically carried out one axis at a time this arrangement also works for home switches.

@ Jeff: That makes a lot of sense. I fully understand. This does mean however that I need new limit switches :-[

Thanks for the info man!

If you have any questions feel free to ask. I have done CNC related stuff for years and am happy to share.

Ok while I’m working on the RLP driver for the stepper, I thought I would hack your brain Jeff :slight_smile:

I intent to use Nichrome wire in as a feedback loop to let the Fez know where the axis is at any given point in time. This will be used to verify that the axis is in the correct place and if it is not, then compensate.

Have you seen any CNC mills with a feedback feature that allows them to do just that?

I would have to agree with a statement Jeff made a few days ago with regard to the steppers. The big knock against steppers vs servo’s is that they don’t know where they are. If you size the steppers properly it really doesn’t matter because the problem won’t arise unless you send a mill into a piece of stainless with a .5 inch depth of cut. Then it won’t matter because the mill will be in little pieces.

I do a lot of prototyping in everything from foam to stainless with a sherline stepper motor driven mill and unless I do something really dumb with the nc code it just is not a problem. You won’t need nichrome because the computer will count your steps unless it hits a brick wall.

EMC for linux and Mach 3 would be a good place to study.

I missed the post about using nichrome wire, I take it you are wanting to measure its resistance to know where you are? It is an interesting idea but won’t work well I’m afraid. The biggest issue is that it will not be accurate enough. The best analogy I can give is a small Automated Storage and Retrieval system we used to have at the university. The manufacturer used LVDTs to monitor the position of the axis. LVDTs are great but when they are 2m or 3m long they are not very accurate. By the time you accounted for noise and the accuracy of the A2D conversion I could only get within 1cm or so. It was a horrible idea to use LVDTs that large.

I’m building some custom stepper controls for a customer now that will be used on a laser micrometer system. The output of the laser system is analog and it was easy enough for them to incorporate a A2D converter (USB DAQ board) but the problem then became WHEN was a particular reading taken w.r.t. the position of the object being measured. The solution was to clock the A2D with a rotary encoder on the mechanism. Now each reading of the A2D is able to be matched to a rotation angle so they can make use of the data.

Again, contrary to popular belief stepper system do not ‘lose’ steps. You really have to try and do something wrong for that to happen.

Yea, how does a laser system work? If possible I could use that instead.

Remember the problem with the axis not being straight? Well I’ve redesigned the axis and now here are the results. [url]- YouTube

Any info on how the laser system works is kewl.

What laser system?

[quote]I’m building some custom stepper controls for a customer now that will be used on a laser micrometer system. [/quote] - Jeff Brit

Laser Micrometer?

Laser Micrometers measure small things very accurately. For example, I’m building three motion controls now for a customer that is using a laser micrometer to measure the run-out of precision carbide tooling.

The first stage of supervision of position is an encoder on the back of each motor. For large machines sometimes a linear encoder can be used to compare the actual table position to where it should be. Both of these will likely require additional support chips, like quadrature decoders if you want to try to incorporate them with a FEZ based controller.

kurtnelle, I know that you already have a stepper motor driver, but have you looked at the L6470 by ST Microelectronics?

It offers on chip motion profiles(removing high speed clocking on the FEZ?). And it can tell you if the motor missed a step or got stalled…

The only thing i’m contemplating is how do you sync the motion profiles for multiple axes…

@ errol, that is a neat IC. Looks like there is a Busy/SYNC line on pin 22.

@ kertnell, yes a laser micrometer. the bit is rotate whiel hld in a St Marys roller system and a reading taken with each tick on an encoder also driven by the rollers.

1/128 Microstepping? Is that correct?! SPI interface (wow). Being able to offload some work from the Fez is better however I’d need to find a supplier that will sell it to me (harder than it sounds).

If it costs less than my current solution that I’ll definitely use it; as one of the design goals is: lowest possible cost.

If you can point me to an eval board I’d be grateful. I’ll read through the pdf (67 pages) and see what it can do.

Thanks for the tip @ errol

@ Jeff: hey it’s Kurtnelle :slight_smile: Also would you happen to have any literature on laser range finding?