DoESLiverpool / somebody-should

A place to document practices on the wiki and collect issues/suggestions/to-do items for the physical space at DoES Liverpool
31 stars 11 forks source link

Find a home/use for the XY stepper Rpi operated motor frames #649

Closed goatchurchprime closed 3 years ago

goatchurchprime commented 6 years ago

I got a couple of 1m x 0.5m (approx) XY frames with stepper motors and greasy leadscrews that used to be part of a hot wire cutter (of expanded polystyrene) built in around 1994.

I've installed Jupyter and https://github.com/Nikolay-Kha/PyCNC (which uses DMA to avoid the need for a realtime microcontroller <-- this is the radically simplifying feature) onto a borrowed RPi and wired them to two A4988 stepper motor drivers https://www.pololu.com/product/2128 and powered it from a bench power supply.

This gives us the capability to drive its motions with direct programmatic control (through the Jupyter notebook interface), which is more versatile than only having a G-code interface.

The speed and error rate isn't great, but I think it can fullfill people's urge to build routers, pen-plotters, pick and place machines, and cake icing raster scanning decorators -- and so skip straight to the issue of working out what you want to cut or plot (and with what interface) as well as getting expertise on the issues with this hardware and carriage design, before using up too much time and energy building anything nicer.

I'd like to be able to store it for availability on a thin shelf with the electronics boxed up, its own dedicated Rpi, and instructions. If it doesn't get used by anyone in six months, we can break them down for parts.

Video of action here: https://www.instagram.com/p/Bd8CP7RBo0q/?taken-by=doesliverpool

goatchurchprime commented 6 years ago

Wiring: The two stepper motorw have wire pairs blue-red and yellow-white Ground and 5V from the Pi X step:GPIO21 X dir:GPIO20 Y step:GPIO16 Y dir:GPIO19

ssh pi@192.168.0.211 Password for the Rpi and the Jupyter notebook are the same as for the laser cutters

sudo jupyter notebook See http://jupyter-notebook.readthedocs.io/en/latest/public_server.html for setting password and configurations c.NotebookApp.ip = '*' The configurations are in /root/.jupyter which I have symlinked to ~/.jupyter

Now you can access the python through the wifi from your own computer: http://192.168.0.211:8888/tree?

This one notebooks/cnctest_pulseinterface.ipynb interfaces into the PyCNC code and generates a hilbert curve

This one notebooks/cnc_test_raw/cnctest_bareattempt.ipynb is copying out the bare minimum of the code (mainly the interface to the dma) for operating the two axes into its own directory.

goatchurchprime commented 6 years ago

Sample code for making a hilbert curve:

import sys
sys.path.append("PyCNC")
from cnc import hal

def pg(ts, n, p):
    d = 1 if n > 0 else -1
    yield (True, d, d, 1, 1)
    for i in range(abs(n)):
        if p:
            yield (False, i*ts, None, None, None)
        else:
            yield (False, None, i*ts, None, None)

xcurr, ycurr = 0, 0
def goxy(x, y):
    global xcurr, ycurr
    if x != xcurr:
        hal.move(pg(ts, x-xcurr, False))
        xcurr = x
    if y != ycurr:
        hal.move(pg(ts, y-ycurr, True))
        ycurr = y

def hilbert(x, y, xi, xj, yi, yj, n):
    if (n <= 0):
        goxy(int(x + (xi + yi)/2), int(y + (xj + yj)/2))
    else:
       hilbert(x,           y,           yi/2, yj/2,  xi/2,  xj/2, n-1);
       hilbert(x+xi/2,      y+xj/2 ,     xi/2, xj/2,  yi/2,  yj/2, n-1);
       hilbert(x+xi/2+yi/2, y+xj/2+yj/2, xi/2, xj/2,  yi/2,  yj/2, n-1);
       hilbert(x+xi/2+yi,   y+xj/2+yj,  -yi/2,-yj/2, -xi/2, -xj/2, n-1);
ghost commented 6 years ago

Depending on my possible help to your group, this is one extension along side my knowledge of my RPi robots. I have commented on your move to a post by Jackie 1050

amcewen commented 6 years ago

How about a CNC embroidery machine :-)

DoESsean commented 5 years ago

Almost a year and a half on, what's going on with this? Owt? Nowt?

RiverMersey commented 4 years ago

Could this thread / issue be closed now?

amcewen commented 3 years ago

I haven't seen these round the space for a while now, so presumably a home was found for them? :grin: