Newer page can be found at cstep.luberth.com

C:\DOS\QBASIC                                                                              C:\QB45

page was last modified:

Home Build Hobby Plotter / Engraver

Minimal in Software & Hardware But Quite Nice Results
Ancient GWBasic & QBasic Motion Controlled Stepper xy-table

A NEW PAGE & MORE INFO about CStep




 

Simple Text / CircleText and Logo engraving Machine

[Image of plotter][Steppercontrol print][Drawing made with plotter]


STepDP, Simple Text Engraving Program Dot Peening Video

PStep video WC engraving

another PStep video engraving


Some information

A Qbasic program reads an HPGL drawing and controls stepper motors
Stepper control Print connected to PC's parallel port
I used old Dot Matrix Printer steppers 200 steps per rotation (1.8 degree/step)
I use them in Half step mode that makes 400 steps per rotation (0.9degree/halfstep)
Used 2 motors slaved for the wide axis (to prevent sticking)
Resolution of plotter 0,11 mm per half step
Power suply old PC trafo
Drawing speed +/- 10 meters/minute
Max. drawing size almost A3 on my table
Ramp up / Ramp Down Motor Speed
Differend Speed for when Penup or Pendown Useful for engraving
Possible to add a third moter for z axis

Hardware

I used 2 (3 on print for the looks of print) ULN2803 IC's & 2 microswitchesfor home position

A verry simple Qbasic program For plotter control
Zipped file with example drawings (*.PLT) Outputs are REM-arked
qbplot00.bas Minimal Qbasic program for Plotteralike control
qbplot01.zip Qbasic Plotter control program
Bresplot.zip plotter example using Bresenham lineroutine Should solve some problems

forked from: ブレゼンハム - wonderfl build flash online Flash as3 Bresenham grid line example draw a line from point to point

Qbasic Plotter program outputs step and direction pulses
For UCN5804 or other ic's Only step pulse an direction signal per axis
5804plot.bas

HPGL / PLT viewers QBasic
import02.zip
importhp.bas
Sawahpgl.bas

 
 
 

Qb test proram for calculating triangles for rotating knive control24-9-1998
Rotate the knive in direction of move like used in plotter cutters!

<>triangle.bas Requires Quickbasic and a mouse(QB.EXE /L)

forked from: リマソン第2弾 (定義編) - wonderfl build flash online


my interest goes to angle ABC
if line AB is current mve and line BC is net move
if angle ABC plus or min 20 degree of 180 degree
then no rampdown or motion decelaration is needed
because next line vector move is almost the same direction

Law of cosines

The law of cosines is a statement about a general triangle which relates the lengths of its sides to the cosine of one of its angles.

The formula can be used to compute the length of a triangle if the three sides are known. Try dragging points A, B and C.
Law of cosines

Math.pow(CA, 2) = Math.pow(AB, 2) + Math.pow(BC, 2) - 2 * AB * BC * cos(ABC);

ABC = Math.acos((AB * AB + BC * BC - CA * CA) / (2 * AB * BC)); 
BCA = Math.acos((BC * BC + CA * CA - AB * AB) / (2 * BC * CA)); 
CAB = Math.acos((AB * AB + CA * CA - BC * BC) / (2 * AB * CA)); 

See ´┐ŻLaw of cosines - Wikipedia´┐Ż for more about cosine formura.
    
http://www.kynd.info/library/mathandphysics/lowOfCosines_01/

Think this is the Qbasic program for controlling a rotating knive
otherwise it migt be an example to get you started   (zipped file qplot & example drawing)


Info of how steppers are connected to PC

  • stepper.txt electro schematic text file
  • Print layout Raster image layout.jpg 224,706bytes

  •  

     
     
     

    Javascript explanation
    http://www.luberth.com/plotter/text-animation.html
    http://www.luberth.com/plotter/mod_javascript.html

    My Version for a Qbasic program that read/preview's G-M Code files

  • gcode.bas Dos Qbasic code ziped sourcecode and examples GCode file Read andDraw to screen

  •  

      Java raster2vector and my version of basic path optimizing

     





    [Windows Script Font Drawing][Just a Photo][What's up Doc! -> Rabbit's][New pictures of xy-table]




    started this in i think 2004, the reason why i bought a pc (liked motion control(large tiger cnc heidenhain mill at where i worked then)
    15 years later (2009 now), i still frequently get respons to this page

    Cory => I have made a schematic for you to put up for your uln2803 plotter
    so you can put on your site.
    It can be opened in proteus.

    uln2803_stepper_plotter_newlayout.bmp
    uln2803_motor_controller_ares_1_.LYT
    link to proteus pcb design software



    Beste Luberth,
    09/18/2008 03:37 PM
    ik heb Uw vectorize-programma omgebouwd naar Liberty Basic.
    Misschien kunt U er iemand blij mee maken.
    Groeten,
    H. J. J a n s e n
    p a 3 g y d @ a_m_s_a_t ++ o+r+g
    optivk.bas
    pa20a.PLT






    frees.bas
    Beste Luberth,
    eindelijk heb ik Uw qbasic-programma kunnen ombouwen naar
    Liberty Basic, een soort VB maar dan gemakkelijker.
    Het mooie is, dat er ook een "toolpath optimizer" in is
    verwerkt. Misschien is het iets voor Uw web-site.
    Graag tot horens,
    H Jansen. 
    
    
    
    hallo meneer Jansen
    ik heb liberty basic gedownload
    en wilde u programmas proberen
    maar krijg uw programmas niet werkende
    ik krijg een venster als ik run en dan een grijs vierkant linksboven wat groeit
    maar zie geen tekening of zoiets 
    
    
    
    Beste Luberth,
    bedankt voor Uw reactie.
    Wat betreft de Liberty Basic programmaatjes het volgende :
    deze programma's werken met HPGL files van het type dat wordt geproduceerd door SprintLayout 
    en bevatten alleen de
    commando's PU, PD en PA in regels onder elkaar.
    De volgorde is echter dezelfde als bij het tekenen, zodat er
    zeer veel "luchtwegen, penuplines" ontstaan. Vandaar mijn belangstelling voor "toolpath optimize" programma's. "frees.bas" kan zo'n file behoorlijk
    fatsoeneren en geeft aanmerkelijke tijdbesparing. Het programma "optimize.bas" is niet 100% 
    en ik hoopte dat er iemand zou
    zijn die het foutje er uit haalde.
    Van filmpjes heb ik (nog) geen kaas gegeten.
    Gezien mijn leeftijd (74) niet zo verwonderlijk.
    Met vriendelijke groeten,
    Hendrik Jansen. 
    
    
    na verwijderen van de eerste paar regels uit het voorbeeld PLT bestand
    voorwaarde => commando's PU, PD en PA in regels onder elkaar.
    krijg ik wel een tekening in beeld te zien
    example plot drawings milling outline created with sprintlayout pcb designer hpgl export
    sprintlayout_google.PLT
    actant.PLT
    2A.PLT
    frees.bas
    'frees1.bas 19-5-10 Hendrik Jansen. toolpath optimizer toolpath optimiser plotter 'naar plotter van http://www.luberth.com defaultdir$ = "C:\Liberty BASIC\frees" xy = hexdec("&H378"): meet = xy + 1: z = xy + 2 delay = 150: pudelay = 150: pddelay = 150: pijldelay = 100 pfac = 8 sfac = 8 '6.25 offset = 1 '% frezen = 0: boren = 0: plot = 0: xhome = 0: yhome = 0 red = 255: yellow = 65535: blue = 1671168 orange = (255 * 256 * 256) + (128 * 256) a$ = "": b$ = "": f$ = "": x$ = "": y$ = "" dim keystate(145) dim motx(7): dim moty(7): dim motz(7) motx(0) = 1: motx(1) = 3: motx(2) = 2: motx(3) = 6 motx(4) = 4: motx(5) = 12: motx(6) = 8: motx(7) = 9 moty(0) = 16: moty(1) = 48: moty(2) = 32: moty(3) = 96 moty(4) = 64: moty(5) = 192: moty(6) = 128: moty(7) = 144 motz(0) = 1: motz(1) = 3: motz(2) = 2: motz(3) = 6 motz(4) = 4: motz(5) = 12: motz(6) = 8: motz(7) = 9 ForegroundColor$ = "Black": BackgroundColor$ = "Black" TexteditorColor$ = "Black": TextboxColor$ = "White" ComboboxColor$ = "White": ListboxColor$ = "White" [WindowSetup] NOMAINWIN WindowWidth = 1024 : WindowHeight = 768 UpperLeftX = INT((DisplayWidth-WindowWidth)/2) UpperLeftY = INT((DisplayHeight-WindowHeight)/2) [controlsetup] textbox #main.file1, 10, 660, 150, 24 textbox #main.file2, 180, 660, 150, 24 textbox #main.start, 350, 660, 150, 24 textbox #main.xy1, 520, 660, 150, 24 textbox #main.delay, 690, 660, 150, 24 textbox #main.job1, 10, 700, 150, 24 textbox #main.job2, 180, 700, 150, 24 textbox #main.stop, 350, 700, 150, 24 textbox #main.xy2, 520, 700, 150, 24 textbox #main.frees, 690, 700, 150, 24 button #main.intr, "spup", [spup], ul, 880, 660 button #main.home, "home", [home], ul, 945, 660 button #main.hand, "spdn", [spdn], ul, 880, 700 button #main.halt, "STOP", [quit], ul, 945, 700 Open "FREES-CONTROL" for graphics_nf_nsb as #main #main, "font courier_new 12 bold" #main, "trapclose [quit]" #main, "when rightButtonUp [start]" #main.delay, "delay "; " "; delay setupcolor$ = "darkgray" open1 = 0: gosub [freeshoog]: gosub [wissen] [start] #main.job1, "": #main.job2, "" if open1 then close #1: open1 = 0 popupmenu "pijltoetsen", [pijl], "handmatig", [hand],_ "frezen", [frezen], "boren", [boren], "contour", [contour], "wissen", [wis],_ "home", [home], "STOP", [quit] wait [idle] wait [origin] xold = xhome: yold = yhome: xnew = 0: ynew = 0 gosub [freeshoog]: gosub [stappen] wait [setup] #main.job1, "SETUP": #main.job2, "PLOT LADEN" #main.file1, "" : #main.file2, "" gosub [freeshoog] filedialog vraag$, "*.opt; *.plt", f$ if f$ = "" then [start] for i = len(f$) to 1 step -1 if mid$(f$, i, 1) = "\" then pf$ = right$(f$, len(f$) - i): exit for next #main.file1, pf$ #main.file2, "checking file" if upper$(right$(f$, 3)) = "PLT" then confirm "lpt file optimaliseren ?"; a$ if a$ = "yes" then gosub [optimize]: f$ = opti$ end if #main.file2, "" xmax = 0: ymax = 0: xmin = 10000: ymin = 10000 linecount = 0 open f$ for input as #1: open1 = 1 do while eof(#1) = 0 line input #1, in$ linecount = linecount + 1 L = len(in$) in$ = left$(in$, L - 1): a$ = left$(in$, 2) if a$ = "PA" then comma = instr(in$, ",") x$ = mid$(in$, 3, comma - 3) y$ = mid$(in$, comma + 1) x = int(val(x$) / sfac) y = int(val(y$) / sfac) if x > xmax then xmax = x if y > ymax then ymax = y if x <> 0 and y <> 0 then if x < xmin then xmin = x if y < ymin then ymin = y end if end if loop close #1: open1 = 0 xmax = int((offset + 100) / 100 * xmax) ymax = int((offset + 100) / 100 * ymax) xmin = int((offset + 100) / 100 * xmin) ymin = int((offset + 100) / 100 * ymin) #main.xy1, "max "; xmax; " "; ymax #main.xy2, "min "; xmin; " "; ymin #main.delay, "delay "; delay #main.job2, "ARRAY" dim line$(linecount) open f$ for input as #1 for i = 1 to linecount line input #1, x$: line$(i) = x$ next close #1: open1 = 0 for lijn = 1 to linecount scan in$ = line$(lijn) mode$ = left$(in$, 2) select case mode$ case "PU": #main, "color darkgray" case "PD": #main, "color yellow" if line$(lijn + 1) = line$(lijn - 1) then #main, "place "; x; " "; y; " down; circle "; 30 / sfac end if case "PA": L = len(in$) in$ = left$(in$, L - 1) comma = instr(in$, ",") x$ = mid$(in$, 3, comma - 3) y$ = mid$(in$, comma + 1) x = int(val(x$) / sfac) y = ymax - int(val(y$) / sfac) end select #main, "down; goto "; x; " "; y xold = x: yold = y next #main, "flush": #main.job2, "" return [frezen] job$ = "FREZEN" gosub [nulstellen]: frezen = 1 vraag$ = "kies freesfile" gosub [setup]: goto [job] wait [contour] confirm "frees op diepte ?"; x$ if x$ = "no" then [start] job$ = "CONTOUR" gosub [nulstellen]: contour = 1 vraag$ = "kies contourfile" gosub [setup]: goto [job] wait [boren] gosub [nulstellen]: boren = 1 job$ = "BOREN" vraag$ = "kies boorfile" gosub [setup]: goto [job] wait [job] confirm "STARTEN ?"; a$ if a$ = "no" then [start] #main.start, "start "; left$(time$(), 5) freeshoog = 0 #main.job1, job$: #main.stop, "" for lijn = 1 to linecount in$ = line$(lijn) mode$ = left$(in$, 2) select case mode$ case "PU": #main, "color lightgray" if freeshoog = 0 then gosub [freeshoog] delay = pudelay case "PD": #main, "color green" if freeshoog then gosub [freeslaag] if line$(lijn + 1) = line$(lijn - 1) then #main, "place "; scrx; " "; scry; " down; circle "; 30 / sfac end if delay = pddelay case "PA": L = len(in$): comma = instr(in$, ",") x$ = mid$(in$, 3, comma - 3) y$ = mid$(in$, comma + 1) xnew = val(x$) * pfac ynew = val(y$) * pfac #main.xy1, xnew; " "; ynew gosub [stappen] end select next #main.job1, "klaar" #main.stop, "stop "; left$(time$(), 5) goto [start] [stappen] xi = abs(xnew - xold): yi = abs(ynew - yold) IF xi <= 0 then xi = yi IF yi <= 0 then yi = xi IF xi > yi then xplus = 1: yplus = yi / xi IF yi > xi then yplus = 1: xplus = xi / yi IF yi = xi then xplus = 1: yplus = 1 [lus] cu = int(u): cv = int(v) if cu < xnew then u = u + xplus if cu > xnew then u = u - xplus if cv < ynew then v = v + yplus if cv > ynew then v = v - yplus out xy, motx(cu mod 8) + moty(cv mod 8) scrx = int(cu / pfac / sfac) scry = ymax - int(cv / pfac / sfac) #main, "set "; scrx; " "; scry for d = 0 to delay: next scan [retour] if cu <> xnew or cv <> ynew then [lus] #main, "flush" xold = xnew: yold = ynew return [optimize] opti$ = left$(f$, len(f$) - 3) + "opt" popti$ = left$(pf$, len(pf$) - 3) + "opt" #main.file1, popti$ #main.job1, "line en pu count" open f$ for input as #1: open1 = 1 linecount = 0: pucount = 0: xmax = 0: ymax = 0 do while eof(#1) = 0 line input #1, in$ linecount = linecount + 1 if left$(in$, 2) = "PU" then pucount = pucount + 1 if left$(in$, 2) = "PA" then gosub [ontleden] if x > xmax then xmax = x if y > ymax then ymax = y end if loop close #1 #main.job1, "lijsten maken" dim line$(linecount) dim pulijst(pucount) punr = 1 open f$ for input as #1 for i = 1 to linecount line input #1, in$ line$(i) = in$ if left$(in$, 2) = "PU" then pulijst(punr) = i punr = punr + 1 end if next close #1: open1 = 0 #main.job1, "OPTIMIZE" open opti$ for output as #1: open1 = 1 puafteller = pucount oudedoel = int(sqr(xmax^2 + ymax^2)) oudepositie = 0 print #1, opti$ do scan doel = oudedoel for puzoeknr = 1 to pucount - 1 if pulijst(puzoeknr) then in$ = line$(pulijst(puzoeknr) + 1) gosub [ontleden] xdif = abs(xoud - x) ydif = abs(youd - y) dist = int(sqr(xdif^2 + ydif^2)) if dist < doel then doel = dist: punr = puzoeknr end if [uit] next print #1, "PU;" print #1, line$(pulijst(punr) + 1) print #1, "PD;" pastart = pulijst(punr) + 3 do print #1, line$(pastart) pastart = pastart + 1 loop while left$(line$(pastart), 2) = "PA" pastart = pastart - 1 in$ = line$(pastart) gosub [ontleden]: xoud = x: youd = y pulijst(punr) = 0: puafteller = puafteller - 1 loop until puafteller = 1 print #1, "PU;" print #1, "PA0,0;" close #1: open1 = 0 return [ontleden] L = len(in$) in$ = left$(in$, L - 1) mode$ = left$(in$, 2) comma = instr(in$, ",") x$ = mid$(in$, 3, comma - 3) y$ = mid$(in$, comma + 1) x = val(x$): y = val(y$) return [wis] gosub [wissen]: goto [start] [wissen] #main, "cls; home; down; setfocus; fill black; flush" return [delay] for d = 0 to 40000: next return [pijl] #main.job1, "PIJLTOETSEN" #main.job2, "escape" delay = pijldelay do if keyState(_VK_LEFT) then xptr = xptr + 1: gosub [xymotor] if keyState(_VK_UP) then yptr = yptr - 1: gosub [xymotor] if keyState(_VK_RIGHT) then xptr = xptr - 1: gosub [xymotor] if keyState(_VK_DOWN) then yptr = yptr + 1: gosub [xymotor] if keyState(_VK_SUBTRACT) then gosub [freeshoog] if keyState(_VK_ADD) then gosub [freeslaag] loop until keyState(_VK_ESCAPE) #main.job1, "": #main.job2, "" goto [start] [xymotor] if xptr > 7 then xptr = 0 if xptr < 0 then xptr = 7 if yptr > 7 then yptr = 0 if yptr < 0 then yptr = 7 out xy, motx(xptr mod 8) + moty(yptr mod 8) for d = 0 to delay: next return [hand] #main.job1, "HANDBEDIENING" #main.job2, "motors los" out xy, 0: out z, 0 xor 11 notice "klaar ?" goto [start] [nulstellen] frezen = 0: boren = 0: contour = 0 pdcount = 0: linecount = 0 xold = 0: yold = 0 return [freeshoog] out z, 0 xor 11 #main.frees, "HOOG": freeshoog = 1 call pause 1000 return [freeslaag] out z, 1 xor 11 #main.frees, "LAAG": freeshoog = 0 call pause 1000 return sub pause del t = time$("ms") while time$("ms") < t + del: wend end sub function keyState(keycode) calldll #user32, "GetAsyncKeyState", keycode as long, state as long if state <> 0 then keyState = 1 end function [spup] delay = delay - 50: if delay < 0 then delay = 0 pudelay = pudelay - 50: if pudelay < 0 then pudelay = 0 pddelay = pddelay - 50: if pddelay < 0 then pddelay = 0 #main.delay, "delay "; delay goto [retour] [spdn] delay = delay + 50 pudelay = pudelay + 50 pddelay = pddelay + 50 #main.delay, "delay "; delay goto [retour] [home] #main, "color lightgray" gosub [freeshoog] #main.job1, "homing !" mode$ = "UP" : xnew = 0: ynew = 0: gosub [stappen] [quit] gosub [freeshoog] #main.stop, "stop "; left$(time$(), 5) confirm "STOPPEN ?"; a$: if a$ = "no" then [start] OUT xy , 0: out z, 0 xor 11: OUT meet, 0 if open1 then close #1 close #main END



    [Fischer Technic Basic Plotter]

    Fischer Technic BASIC Plotter (Date +/- 1985)

    This example was controlled by BBC, C64, AppleII, CPC64, or MSXBasic
    Fischer Technic is a german plastic construction toy
    Frequently used for educational prototyping of robotics
    Nice Qbasic example(ammazing speed difference 8086 or p4-2Ghz they never could have dreamed this speed in 1985) (no hardware control) onlyprints to screenScreenshot of GWBasicasic plotter screen output

    30612-fischer-plotter.zip Font is stored in font files
    will not work in newer basics (bload & varptr only 4 basica/gwbasic)

    GWBasic.zip you wil need this old Basic for 30612-fischer-plotter.zip
    bl2data.bas a gwbasic program that loads font files and writes datatext file
     
    Rebuild / Converting an old penplotter to vinyl cutter !?
    Alten Stiftplotter umrsten zu einem Schneideplotter !?
    Knive holder Knife holder for penplotter pen plotter swivel drag

     
     


    Copyright  1998 Luberth All right's reserved
    Luberth Dijkman Bangert 23 1619 GJ Andijk (N.H.) The Netherlands

    Thanks goto:

    Vlam Machinefabriek B.V. Andijk for abuse of machinery
    Martin Harderwijk for old dot matrix printers


    Your page linked here?
    Link
    Short description

    newlinks.html => newlinks are saved here

    forked from: Star Class - wonderfl build flash online



    ? Animated Gifs X

    Google

    A Html5 canvas lineto moveto example disney hpgl plotter drawing on canvas