Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 08:19 10 May 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Drawing Robot

Author Message
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1140
Posted: 08:53am 23 Apr 2025
Copy link to clipboard 
Print this post

I like stuff that actually moves  


Would be cool to have a PicoMite version
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 82
Posted: 10:02pm 23 Apr 2025
Copy link to clipboard 
Print this post

sorry to bang on about me, but I was rather proud of my drawing machine..

made from a Micromite, cheap stepper module, 2 motors, RC servo and some string.

a mercifully short video here..
https://www.youtube.com/watch?v=Buybf25-wbg

I also like stuff that moves!
Try swapping 2 and 3 over
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 936
Posted: 06:57am 24 Apr 2025
Copy link to clipboard 
Print this post

That's cool! Would you post your code???  

Thanks!

Frank
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1140
Posted: 08:26am 24 Apr 2025
Copy link to clipboard 
Print this post

  DaveJacko said  sorry to bang on about me, but I was rather proud of my drawing machine..

made from a Micromite, cheap stepper module, 2 motors, RC servo and some string.

a mercifully short video here..
https://www.youtube.com/watch?v=Buybf25-wbg

I also like stuff that moves!


Love it...and the mouse trap    
 
darthvader
Regular Member

Joined: 31/01/2020
Location: France
Posts: 80
Posted: 08:31pm 24 Apr 2025
Copy link to clipboard 
Print this post

My own from 6 years ago  

Drawbot Plotter
Theory is when we know everything but nothing work ...
Practice is when everything work but no one know why ;)
 
DaveJacko
Regular Member

Joined: 25/07/2019
Location: United Kingdom
Posts: 82
Posted: 09:02pm 24 Apr 2025
Copy link to clipboard 
Print this post

OK Frank, do you really want to see my code?
This version just does up/down/left/right from the PC cursor keys
so it is as simple as possible, I can explain more if needed..



' gantry plotter demo DPJ 2020 username "DaveJacko"
' uses Pythag's theorem and Bresenham's line drawing algorithm

init
Pin(enabpin)=0
ls=9333 'steps=350mm = plot area size in steps
xnow=ls/2 'start at centre of plot area
ynow=ls/2
l1now=ls*0.707 '1/sqr(2)
l2now=ls*0.707 '=250mm

mainlp:  ' --- the main loop

t$=Inkey$   ' keypresses, u/d = pen raise/lower
If t$="" Then GoTo mainlp
If t$=" " Then Pin(enabpin)=1:PWM 2,stop: End
If t$="u" Then penup
If t$="d" Then pendn

a$=a$+t$
If Len(a$)>3 Then a$=Right$(a$,3)

If a$=lc$ Then moveby -1,0  'cursor keys move the pen around
If a$=rc$ Then moveby 1,0
If a$=uc$ Then moveby 0,-1
If a$=dc$ Then moveby 0,1

GoTo mainlp


Sub MoveBy(mbx,mby)  ' moveby ie move pen relative to current posn.

mbx=mbx*266 '=1 cm
mby=mby*266

' calc turns from mbx,y

l1now=Sqr(xnow*xnow+ynow*ynow) 'maybe +residual l1now
l2now=Sqr((ls-xnow)*(ls-xnow)+ynow*ynow)
xtarg=xnow+mbx
ytarg=ynow+mby
l1targ=Sqr(xtarg*xtarg+ytarg*ytarg)
l2targ=Sqr((ls-xtarg)*(ls-xtarg)+ytarg*ytarg)
l1mov=l1targ-l1now
l2mov=l2targ-l2now

Print "mbx,mby",,mbx,mby
Print "xnow,ynow",xnow,ynow
Print "xtarg,ytarg",xtarg,ytarg
Print "l1now,l2now",l1now,l2now
Print "l1targ,l2targ",l1targ,l2targ
Print "l1mov,l2mov",l1mov,l2mov
Print

xnow=xtarg
ynow=ytarg

' now turn motors by l1mov,l2mov

'directions..
If l1mov>0 Then Pin(dirxpin)=0 Else Pin(dirxpin)=1
If l2mov>0 Then Pin(dirypin)=1 Else Pin(dirypin)=0

'major axis is..
If Abs(l1mov)>=Abs(l2mov) Then 'l1 is major
l1i=Sgn(l1mov)
l2i=l2mov/Abs(l1mov)
ni=Abs(l1mov) 'num of incs
Print "l1 major"
Else 'l2 is major axis
l2i=Sgn(l2mov)
l1i=l1i/Abs(l2mov)
ni=Abs(l2mov)
Print "l2 major"
EndIf


l1acc=0:l2acc=0

For i=1 To ni ' do move
l1acc=l1acc+l1i
l2acc=l2acc+l2i

If l1acc>=1 Then l1acc=l1acc-1:Pin(stpxpin)=1
If l1acc<=-1 Then l1acc=l1acc+1:Pin(stpxpin)=1
If l2acc>=1 Then l2acc=l2acc-1:Pin(stpypin)=1
If l2acc<=-1 Then l2acc=l2acc+1:Pin(stpypin)=1

wait1
Pin(stpxpin)=0
Pin(stpypin)=0

Next i

End Sub

Sub init '---- init

stpxpin=2  ' define step pins
stpypin=3
stpzpin=4
dirxpin=5   '..direction pins
dirypin=6
dirzpin=7
enabpin=9
stoppin=15
'servopin=26 pwm

SetPin 2,dout
SetPin 3,dout
SetPin 4,dout
SetPin 5,dout
SetPin 6,dout
SetPin 7,dout
Pin(9)=1 'enable off
SetPin 9,dout
SetPin 15,din,pullup 'int?

e$=Chr$(27) 'define escape
uc$=e$+"[A" 'cursor keys up/down/right/left
dc$=e$+"[B"
rc$=e$+"[C"
lc$=e$+"[D"

SetTick 1,int1ms  'timer

Pause 100

End Sub

Sub penup   ' lift the pen
PWM 2,50,7
End Sub

Sub pendn   ' drop the pen
PWM 2,50,10
End Sub

Sub int1ms   ' --timer subs
iflag=1
End Sub

Sub wait1
w1lp:
If Not iflag Then GoTo w1lp
iflag=0
End Sub


Try swapping 2 and 3 over
 
Frank N. Furter
Guru

Joined: 28/05/2012
Location: Germany
Posts: 936
Posted: 07:12am 25 Apr 2025
Copy link to clipboard 
Print this post

@DaveJacko:

Thank you very much! I think I need to pick out a few stepper motors from my stash and build something...  

@darthvader:

Did you also realize this with MMBASIC?

Frank
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1140
Posted: 07:41am 25 Apr 2025
Copy link to clipboard 
Print this post

  darthvader said  My own from 6 years ago  

Drawbot Plotter


 

A couple of DC motors + encoders and the PicoMite could make it superfast  
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7503
Posted: 09:01am 25 Apr 2025
Copy link to clipboard 
Print this post

There's a limit to how fast you can draw a line on paper. :)
We used to have fun with one of the old A3 pen plotters. Expensive pens always worked fine, some of the cheaper ones were decidedly dodgy as they got older. The ink simply didn't have time to get out of the tip on fast lines. Mind you, we could get a lot of cheap pens for the cost of one expensive one. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
PhenixRising
Guru

Joined: 07/11/2023
Location: United Kingdom
Posts: 1140
Posted: 09:20am 25 Apr 2025
Copy link to clipboard 
Print this post

  Mixtel90 said  There's a limit to how fast you can draw a line on paper. :)
We used to have fun with one of the old A3 pen plotters. Expensive pens always worked fine, some of the cheaper ones were decidedly dodgy as they got older. The ink simply didn't have time to get out of the tip on fast lines. Mind you, we could get a lot of cheap pens for the cost of one expensive one. :)


Oh sure but closed-loop servo blows steppers away  
 
darthvader
Regular Member

Joined: 31/01/2020
Location: France
Posts: 80
Posted: 09:38am 25 Apr 2025
Copy link to clipboard 
Print this post

  Frank N. Furter said  @darthvader:

Did you also realize this with MMBASIC?

Frank


No , it was like a 3D printer with Marlin.
Theory is when we know everything but nothing work ...
Practice is when everything work but no one know why ;)
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025