Hello Guest it is January 15, 2021, 08:47:26 AM

Author Topic: Motion plugin for virtual hardware(for tests) - lets share our knowledge  (Read 30282 times)

0 Members and 1 Guest are viewing this topic.

really interesting, actually thats EXACTLY what I'm trying to do, but instead of atmel MCU I'll be using a Microchip PICmcu and instead of an Altera FPGA I'll be using 3 pics mcu specialized on driving step-motors (to decrease the learning/development time).

I did something like that. Using LPC2378 and 4x LPC2104 as step motors accelerators.
I would say that this is not the right way to go.  The communications channels between processors are the bottlenecks. It is not efficient to split work like that. Most efficient way is floating point CPU and FPGA as FIFO step/dir generator.

I am not sure which PIC you have choosen, but unless it is PIC32 you will have problems with computing power - I do know what I am saying as I have my own motion planner ( for different commercial software - not Mach).
I can show you prototype of my small toy - see attachement. Largest available through hole dsPIC. If I get it running nicely - I will sell just DIY schematics + plugin license , so everybody could make it himself ( no SMD technology, single layer board which can be etched).
Preliminary tests show that it can go up to 100..150kHz with 2 seconds buffer and 4ms time slices using LPT style data generated by Mach ( kind of "LPT player" mode).

« Last Edit: March 28, 2011, 01:46:08 PM by jarekk »
Something you may find interesting.



This looks strange. Even if it uses HID USB classes it still needs Mach plugin.  Will be interesting to see review. I have seen it being sold as option with some Chinese CNC machines.
Actually all I need is something to make my USB become a parallel port, I was thinking of making it using a PIC18F4550, so he would basically take the USB data and converto to all the 17 I/O's of the DB-25, the other pic's would just receive the signal and then turn pass it on, OR the signal will just be driven to the board outputs (there is no need for extra processing since I already have a working external steper motor driver, a working stepper motor driver that works with MACH3 paralell, the driver is controlled by a pic 18F4520).

basically wha I gonna do is a board with DB25 input AND one USB input, the USB input will work like an USB/Paralel converter and the DB25 will be the normal paralel input (in the case it have one).

The extra 3 PIC's MCU are to drive a servo motor driver and read the Quadrature encoders IF it ever gets implemented.
« Last Edit: March 28, 2011, 02:06:14 PM by Scoppio »
Actually all I need is something to make my USB become a parallel port,

So basically you want to do something like my proto - USB to LPT converter for Mach.
But life is not that simple  - USB has it bottlenecks, so you need to buffer data ahead. Mach can give you the trajectory ahead, so no problem.
But it does not give you directly anything like DB25 output pins state - you are getting either point coordinates ( the hard way, you need motion processing) or amount of LPT pin "ticks" within your time slice ( you can configure it - I use 4ms). So basically you have to send to your device packages containing "tick" counters for each slices. 4ms x 4 axes gives you at least  4000 variables of raw data  per second. And this is the challenge - as you need to continuously buffer data and generate step/dir signals. Not mentioning poor Mach documentation about how to get the data and interact with Mach internals...

I think that I get it now.
I'll discuss about it with my partners and try to figure out how to do it with the info we have in hands, thanks Jarekk
Hi all, I'm new to the forum, I met and spoke with Brian Barker at the recent CNC Workshop in Michigan and he mentioned that he had an example plug in for sending data to an external (USB) pulsing engine. Since this seems to be the way to make contact I'll try here first. The CNC Workshop was a lot of fun. I would highly recommend it for any CNC hobbyist!

Similar to a lot of other people in this thread, I'm interested in rolling my own pulsing engine. (or at least looking at what it would take to do so) The particular hardware that I am looking at using is an ATMEL XMEGA processor with an FTDI USB interface. I've got several breadboards with this processor and an FTDI Serial and Parallel interfaces left over from a recent project where I work, and they just look like a solution waiting for an answer. The XMEGA had a lot of really nice timers in it that look like they are begging to become a pulse engine...

What I'm probably looking for is an example of how the data would be send to a USB port which contained pulses per time period. I think I saw mentioned a 4 ms frame time in a previous post.

What will most likely happen is that I'll look at it for a while and then go buy a smooth stepper. But I'd kind of like to know how it all works and maybe take a stab at it myself.

So thanks in advance!
I can show you something:

I am actually building hardware for my virtual plugin.
I intend to make it as DIY project - as I have choosen mostly through hole components  and easy to assembly SMD components. It also uses FTDI, either as SMD or DigiKey module - so everybody will be able to prepare it himself ( PCB is single layer board, you will be able even to make it on universla board).

Right now it works as standalone device ( not yet from Mach, only from my test app - Mach will be next). I plan publish Eagle design and to sell plugin licenses for the software.

With XMega you should be able to make something similiar ( although it is slightly less powerfull then the dsPIC - I have choosen one of most powerfull CPUs found in DIP package). The critical parameters are the CPU speed  and RAM size. 16kB is minimum I would say.

In mach SDK you have examples of sending USB data. Just that you need target device which processes it properly.

Timers are not that easy to be used as pulse engine - you would need at least four independent 32 bit timers with configurable pin control, otherwise you may have resolution problems to operate with e.g. 100kHz pulse frequency. Most designs (like SmoothStepper)  use specialized cascaded high frequency timers in FPGA

« Last Edit: June 29, 2011, 03:48:11 AM by jarekk »

Offline rcaffin

  •  1,033 1,033
    • View Profile
Re: Motion plugin for virtual hardware(for tests) - lets share our knowledge
« Reply #17 on: November 24, 2011, 05:40:48 PM »
Very interesting, but the USB as a connection between a PC and a CNC machine may not be ideal.
The voltage levels on the USB interface are very restricted and they are NOT immune to noise.

The USB is fine for hooking up a keyboard, a mouse, a camera, to a PC: they are all floating. But a CNC machine may be handling kilowatts of power, and that has HUGE potential for noise problems. It can be done of course - the SmoothStepper does it, but you need to keep the USB card well away from the CNC and have TOTAL optical isolation.

Just my experience and 2c.

Re: Motion plugin for virtual hardware(for tests) - lets share our knowledge
« Reply #18 on: November 25, 2011, 02:22:04 AM »
USB is not ideal - I agree. I sometimes use galvanically isolted USB ( Analog devices provides chip with trafo coupling e.g. ADUM3160 ), but it still does not help if you use plasma cutter because USB does not handle gracefully mess on physical layer.
Re: Motion plugin for virtual hardware(for tests) - lets share our knowledge
« Reply #19 on: January 30, 2012, 04:17:45 PM »
do your project still Continue to  jarekk?