Hey all, 

I build a simple CNC controller using Python and nmigen.  I thought this 
was nice to share as the one published by machine kit requires vivado 
<https://github.com/machinekit/mksocfpga> .

A video of the working Python / CNC controller can be seen here 
<https://www.youtube.com/watch?v=-0uB2MydtrE> .
This is not the best video and only intended to proof the software works.

The software consists out of the following elements;
   * SPI command interface  (receives command and words, copied from Luna 
<https://github.com/greatscottgadgets/luna>)           
   *  Transactionalized FIFO (buffers instruction in sram, copied from luna)
   * SPI parser (basically an extension of SPI command interface, it 
outlines what to do  
                          with command like start, stop and write.)
   *  Dispatcher; picks up commands from the FIFO buffer and dispatches 
instructions to                             actual hardware
    * Polynomial integrator: creates pulse train for stepper motors; 
basically you send the                                                 
coefficients for the polynomial and the number of ticks in a   
                                               segment. 

The motor follows the path, coef_0 * t + coef_1 * t^2 + coef_2 * t^3.
The trajectory of a motor is divided in multiple segments where a segment 
length is typically 10_000 ticks. If is longer, it is repeated. If it is 
shorter, this is communicated by setting ticks to lower than 10_000. I 
looked into using Bezier curves for motion control. The main advantage is 
that they are calculated on the circuit straight from actual positions 
using de Casteljau Algorithm. My FPGA does not have a hardware multiplier, 
so I didn't implement it. 

My current focus is building a laser scanner. Using FPGAs for CNC is a 
problem I encountered along the way.  I need FPGA's as the laser bundle is 
moving quite fast.

Anyhow, it might be of interest to you as you are active in CNC.  You don't 
need actual hardware to test the code as all can be simulated virtually 
<https://github.com/hstarmans/FPGAG>.

Hope my project can give you some inspiration!

Best,

Rik



-- 
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- 
You received this message because you are subscribed to the Google Groups 
"Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/machinekit/a40d26b7-7789-4759-9019-0c799595ab86n%40googlegroups.com.

Reply via email to