Arduino Forum

Forum 2005-2010 (read only) => Software => Interfacing => Topic started by: theMPloc on Jan 01, 2011, 12:28 pm

Title: another cnc mill questionaire
Post by: theMPloc on Jan 01, 2011, 12:28 pm
hi there, i know there is a lot stuff out there and i did a lot of research in google and and several forums.

i want to build a cnc mill using an arduino (uno or duemilanove) with three axes. i already connected three easydrivers and stepper motors to the arduino and have them running.

the building of the cnc mill is in progress.

what i am looking is the right firmware for the arduino that will make it possible to use either replicatorG as host oder mach3. at the moment i am confused by the amount of different firmwares (gcode interpreter, mendel,....).

would anybody be so nice an tell me exactly which firmware i will have to use and where i can find it for my project?

thank you so much in advance!!!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 01, 2011, 12:36 pm
don't know if it helps
I'm going down the same route! (<- you see what i did there!)

I have written a gcode interpreter for exactly that setup, 3 EasyDrivers connected to a Uno

I have also written a piece of software that sits on the PC and feeds gcode to it

Stir in Eagle and pcbgcode and I have a complete "design" to "cut" solution

If you like I can post the software
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 01, 2011, 12:45 pm
thats supergreat! i would be very happy if you would send me your software.

does this mean that if i design something in a 3d package, export this and create gcode from it then i can feed the mill with your software?

oh i´m excited....
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 01, 2011, 01:22 pm
yup the PC software takes a gcode file and sends it line by line to the Arduino which interprets it and controls the 3 steppers

I'll put it all together inamo
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 01, 2011, 02:16 pm
oh this sounds sooo good! as you tell me that gcode is beeing send from your software to the arduino - am i right, that it is possible to use other software that sends gcode like replicatorG? i mean actually i do not need replicatorG as i have the gcode already but i simply like the user interface :)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 01, 2011, 03:15 pm
I can't speak for ReplicatorG as I don't know it
but, the gcode interpreter "talks" to the PC software

I'll upload them both in a bit
I just tried to make it idiot-proof

trouble is the idiots outnumber us!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 01, 2011, 03:22 pm
ok here are the two parts...

first the software that opens and transmits a gcode file
http://www.mmcpix.com/CNC/CNCdriver.zip

you will need to click File :: Options to chose your COM port (and any other settings you fancy)
As well as sending the gcode it shows a picture of what it's up to
It's aimed at PCB milling btw

second the gcode interpreter that runs on the Uno
http://www.mmcpix.com/CNC/GCode_Interpreter.zip
DO look at _init.pde as you will need to configure it to suit your machine
It supports 3 axes each with limit switches

like I said I think it's idiot-proof, but...

feel free to ask questions, but I take no responsibility for you destroying your Arduino, drivers, motors, house, wife, children, sundry other loved ones or any other part of your immediate environment!

oh and if you make any changes - please let me know what you did

Do you have any info on the machanics of your build, btw?
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 01, 2011, 04:22 pm
i am just downloading your codes. thank you sooo much by now. i will try to figure it out and let you know how i am doing. thank you for your offer to ask you questions.

regarding to my construction: i will build it next week. basically its a similar design to the makebot-router which you can find on www.makebot.com. the difference will be that i will use linear ball bearings. if you like i will keep you informed about how i am doing.

thank you so much again and have a nice day!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 04, 2011, 08:59 pm
hi,

(1) i am just trying the cnc driver. i setup port 8 (where my arduino is connected) but the software is telling me "unable to open port (win error code: 2)".

(2) i wired my arduino the way it says in _init.pde what is strange is that the stepper motors all go on "wake up" and get hot after a while. maybe i am an idiot but in the _init.pde it says pins 14-19 correspond to analog 0-5 so i connected pin 18 to A4 ( where it says analog in). i guess this is bullshit - can you tell me where the pins 14-19 are? i am sorry for asking stupid questions but i maybe an idiot :)


please help!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 04, 2011, 10:28 pm
hello
that happens when it - er - can't open the port!

can you talk to your arduino using the IDE?
which port does that use?
have you told the cnc driver (setup) which port to use?

cheers
Mike
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 04, 2011, 10:34 pm
i can talk to arduino using port 8 and i told cncdriver to use this port (in the tools menu). thats how i connected arduino and uploaded the qgcode interpreter. i also tried it using serproxy on that port and running a flash application which drives a stepper motor.
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 05, 2011, 02:02 am
i tried the same on an arduino duemilanove which connects to port 7. so i did upload gcode interpreter and then started cncdriver. then "tools menu", "options" set port to 7.

i get the same error "unable to open com port"

what do i do wrong  :'(
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 05, 2011, 08:04 am
Not quite sure - I will glare at the code when I wake up!  :)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 05, 2011, 09:39 am
thank you in advance!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 05, 2011, 09:50 am
meant to ask
what OS are you using?
I've tried on Win7 and XP
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 05, 2011, 09:58 am
i´m on windows xp
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 05, 2011, 10:27 am
tried it on windows 7 aswell. did´nt work.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 05, 2011, 09:51 pm
aha we have a result
I managed to reproduce the error
and we have a fix

it's silly windozy! :P

open device manager
find the USB COM port and change it to COM5

that should squish the buglet
do let me know how you get on

cheers
Mike
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 09:51 am
YOU BRILLIANT YOU! good morning by the way. i changed to com5 (windows told me that another device is already using com5) and it works. thank you a thousand times.

i will be finishing the router today or tomorrow and i must say that i was really worried the last days when i thought "oh, i am building a router and when i am finished i don´t know how to drive it". i read about thousand threads and googled for cnc arduino blah blah until my fingers blooded but did not find one solution that i understand.

would you be so nice and provide me with some more information about the gcode interpreter _init.pde regarding how to wire all up?

just to make sure:

what i understand are the stepper controls like

#define X_STEP_PIN 7
#define X_DIR_PIN 6


#define Y_STEP_PIN 2
#define Y_DIR_PIN 3


#define Z_STEP_PIN 9
#define Z_DIR_PIN 10

what i am not shure are:

(1) endswithches

for example: #define X_MIN_PIN 14
#define X_MAX_PIN 15

do i have to connect the switches also to 3.3V, 5V or something else?

(2) motor control

is this the sleep/wakeup for the easy drivers?

(3) panic stop/reset

are these buttons and do they need some 3.3V, 5V or somehting else like the endswitches?



i would be glad if you would help me again and wish you the best possible day!!

Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 06, 2011, 10:15 am
glad to see we made some progres!!

endswitches are limit switches to stop excess travel + and- in each of x, y, z

they can be
a) ignored!
b) connected to microswitches  :(
c) connected to photoswitches  :)
d) connected to hall effect switches :)
basically whatever you have

they can be
a) logic low is good, high is bad
b) logic low is bad, high is good
there is a seting to invert them if they're working the wrong way

in order to "ignore" them to logic high

motor control is used to switch the router spindle on and off
if you're doing this manually, ignore it

panic stop/reset
is used to freeze everything (in case of an emergency)

you can just ignore it (set it to logic high)
panic reset is only checked after a panic, so you can ignore that too

hope that helps

cheers Mike
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 12:16 pm
thank you for your kind answers. for the limiting switches i will use something like these: http://www.google.at/imgres?imgurl=http://www.fischertechnik-fans.de/Images/Tasterinnen.jpg&imgrefurl=http://www.fischertechnik-fans.de/html/Tipps/alternativeteile.php&usg=__cn9bRSjqhrJVgUHl2R2FSplJQJU=&h=589&w=784&sz=73&hl=de&start=0&zoom=1&tbnid=B9XA--RLwVLjNM:&tbnh=113&tbnw=151&prev=/images%3Fq%3Dfischertechnik%2Btaster%26um%3D1%26hl%3Dde%26rlz%3D1C1AVSW_enAT376AT376%26biw%3D1024%26bih%3D513%26tbs%3Disch:1&um=1&itbs=1&iact=hc&vpx=414&vpy=80&dur=432&hovh=195&hovw=259&tx=87&ty=73&ei=kKIlTa3AAYSeOsvd0e0I&oei=kKIlTa3AAYSeOsvd0e0I&esq=1&page=1&ndsp=16&ved=1t:429,r:2,s:0

as a noob i have to ask again: i would think that i need to go with some voltage to the switch wich then goes to a pin on the arduino in case the switch is pressed. am i right? if so, does it matter if i use 3.3V or 5V from the arduino?

another question regarding these switches is, that i thought, that these are also used to set the axis to 0. i mean before the actual cutting starts, the motors should drive the axis to for example axis-min-switch and resets the measurement of the axis to 0 to know where it is, as the stepper motors only measure relativly.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 06, 2011, 12:25 pm
those limit switches will be fine
I would use whatever voltage you have on the Arduino
so the switch (when closed) will connect, for example, 5v to the limit measuring (max or min) pin

you can also use them as "home" switches, but the software makes no provision for that

stepper motors just o what they are told

the software can use absolute or relative positioning
the PC interface allows you to "jog" (move) x y and z manually

how are you generating your gcode?
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 01:46 pm
oh, i see. i use http://www.vectric.com/WebSite/Vectric/cut3d/c3d_index.htm

to generate gcode. as i design my things in 3d (cinema4d) and cut3d generates gcode from 3d formats. if you know an alternative, please tell me.

the thing i´m curious now is how do i position my workpiece so that it is milled correctly? do i just place the head somewhere and then put the workpiece relative to this position regarding the settings in the "tools" "options" menu (origin x, origin y)? < confused again ;) >

is there any way to get the machine finding its 0-axes and then count "absolut" from there on?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 06, 2011, 02:09 pm
I plan to use the limit switches as home so I'll position the workpiece, then home all the axes, then off we go
Title: Re: another cnc mill questionaire
Post by: marzetti on Jan 06, 2011, 04:15 pm
I'm just curious (not trying to be critical) as to why one would want to run a CNC machine with an Arduino when it's relatively easy and inexpensive to simply use EMC2? I run this very powerful and capable software on a 10 year old Pentium 4 machine I got for free so my software and computer costs are zero. The EMC2 community is very active and supportive and development of the software is constant in response to the users needs. Couldn't ask for more!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 06, 2011, 04:39 pm
for me it was the intellectual challenge of implementing it all
you still need something that sits between EMC2, which is software, and the steppers (raw hardware)

the Arduino + EasyDriver combination provides the equivalent of commercial setups like Gecko at £ several hundred

Further most commercial software needs to use the parallel ports as all the timing is done on the PC and you can't wait for USB/serial ports to catch up

by offloading the signal generation to the Arduino, you remove this problem at a stroke

but more than all that see reason 1 above!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 06:00 pm
hi again, just back from working on the mill/router.

first:
"I plan to use the limit switches as home so I'll position the workpiece, then home all the axes, then off we go". -> thats nice. would you keep me informed when you implimented this feature?

second:
why i did not consider emc2: simply because of (1) i am an idiot, (2) because i started doing things with arduino some weeks ago, (3) because when i googled for arduino and cnc all the wonderful machines like makerbot, reprap,... came up and i thought that arduino would be perfect and (4) during googeling i stept over emc but the moment i read linux i went somewhere else.

i was and am very glad when you replied to my thread here, as you kindly provided me a good starting point for all the cnc stuff. thanks to you i will have a closer look to emc the next time - we´ll see.

have a nice evening!
Title: Re: another cnc mill questionaire
Post by: marzetti on Jan 06, 2011, 07:22 pm
Well, the intellectual challenge part I can understand, but I think you'll quickly run into the limitations. A microprocessor simply doesn't have what it takes to do the trajectory planning etc. that is required of any capable CNC machine. As for running linux, it was a no-brainer for me. I popped the live CD in, did the install, ran EMC's configuration wizard and was running within an hour. As for the extra hardware the only thing required besides the stepper drivers was a breakout board for the parallel port.
Again, I'm not dissing the whole idea of CNC on the arduino, just pointing out the deficiencies. I am in fact working on a single axis arduino controller for a digital positioning system, the reason I dove into this microcontroller business. I'll post it here when it's done.
Good luck on your endevours! I'll be watching to see what you come up with.  :)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 07:39 pm
do you mean, that if i want to use emc i can use my easydrivers and only need a parallel breakout box? could you provide me a link of such a box? as my netbook does not have a parallel port - is there a usb solution available or would i need another pc?
Title: Re: another cnc mill questionaire
Post by: marzetti on Jan 06, 2011, 07:59 pm
Yes,all you would need is the BOB. Here's the one I use: http://www.cnc4pc.com/Store/osc/product_info.php?cPath=33&products_id=45. A BOB can be very simple and you could easily build one yourself also (see this site: http://pminmo.com/.
You would definitely need a parallel port however. It's a shame they are being eliminated in newer computers as they are the easiest output to deal with for external devices. Fortunately there are plenty of free or cheap cast-off computers available that will do a fine job. Another option is to add a PCI parallel port card although that wouldn't be an option with a netbook. In case you haven't found it yet, CNCzone.com is the most comprehensive site for all things CNC.
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 08:07 pm
thanks again. i like BOB ;) when i have my machine ready and its working out the way i want, i will definetly give BOB and emc2 a try! another old pc shouldnt be the problem anyway.
Title: Re: another cnc mill questionaire
Post by: marzetti on Jan 06, 2011, 08:16 pm
I don't know how large your machine is or what you intend to cut but you'll probably find that the Easydriver won't give you enough power. I have one here I'm using for testing purposes and I'm finding the .75 A output at 12V will drive my small motor but it has very little torque. It should be better at 24V but I doubt even then it will drive my rig at the speed I need so I'll be building my own driver soon. My CNC router (a small one, 20" x 30" capacity) has 3A drivers and it seems to be adequate.
Good luck!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 08:27 pm
i have my easydrivers connected to a nice 6amps, 24 power supply. when i test my motors they seem to have a lot of power. we´ll see in one or two days.

another question regarding the gcode i create with cut3d: there are a lot of possibilities on how to postprocess the gcode which is saved. it says "The standard list of postprocessor's available in the software are displayed in the pull-down list. Select the postprocessor appropriate to your CNC machine from this list."

for example Axyz (*.nz), Gcode mm (*.tap),  Mach2/3 Arcs (*.txt),..

how can i find out which one to choose or doesent that matter anyway?
Title: Re: another cnc mill questionaire
Post by: marzetti on Jan 06, 2011, 09:25 pm
That's a tricky question since you're using the Arduino. The postprocessing is tied to the specific CNC software and they are all a bit different. I would check and see what other people are using for Reprap machines. The next best idea would be to use either the Fanuc or EMC2 postprocessing as they adhere most closely to the "official" RS274 standard. For the basic G01, G02, G03 etc. commands though they are all about the same. Here is a good reference on G code in case you don't have one: http://linuxcnc.org/docs/html/gcode_main.html
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 06, 2011, 09:29 pm
perfect - fanuc is in the list. wonderful.
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 07, 2011, 09:32 am
good morning!

i powered my z-axis. runs with you cncdriver. thats great.

of course i have a question: i know that the easydriver has a temperature security switch, which switches off at 160°. just to make sure: is it normal, that the big chip on the easy driver gets quite hot after some minutes? what i am also interested is, that even if i do not have the sleep/wakeup pin connected, the stepper motor is always awake - is this ok?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 07, 2011, 10:19 am
indeed
if you connect the enable wire to the easy driver two things will happen
a) it will run cooler as it gets turned off when not needed
b) the motor will also get powered down
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 07, 2011, 12:30 pm
so here is the stupid question: to which pins on the arduino do i connect the sleep/wakup pins on the easydrivers. i tried with the pin 18 (A4) where it says motor pin in the init.pde. i thought that would be an option as when the spindle is on the sleep state would change to wakup state. but then the steppers don´t move a all.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 07, 2011, 01:06 pm
yup
I connect pin 18 to the EastDriver Enable pin
works for me

aha I see what you are doing
I'm not using sleep!
I'm using Enable
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 08, 2011, 09:24 am
hi again. i will use enable then ;) question: in init.pde it says


#define X_ENABLE_PIN 8
#define Y_ENABLE_PIN 18  // sb8
#define Z_ENABLE_PIN 19  // sb8

what does sb8 mean?

have  a nice day!

ps. maybe today i will have the machine ready

ps2 i ordered BOB
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 08, 2011, 11:18 am
:-[
I wanted to use just one pin (8) for the enable so they are all enabled/disabled together
but while breadboarding it was more convenient to have 1 pin for each
never got round to changing it
"sb" means "should be"
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 08, 2011, 05:23 pm
Yipppppiiiiiieeeeeh!

i finished my machine today and it is running with cncdriver!

at the moment i "see the light in the tunnel" and i again want and have to send a big THAAAAAAAAANNNNK YOOOOOOUUUU for beeing so kind, patient and helpful to me. you are a great guy!

now i will have some fun with the machine while i wait for BOB. then i will start with emc2 and i guess, i will have the one or another question to you again.

thank you once more and have a nice evening!
Title: Re: another cnc mill questionaire
Post by: marzetti on Jan 08, 2011, 06:06 pm
Congratulations! It really is a thrill to see your creation come to life, isn't it? I would like to know more details about your machine. Do you have pictures?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 08, 2011, 11:43 pm
glad to hear it's all working :)

I'd be interested in seeing pictures/plans of your machine as I'm still fiddling with the design of mine...

what did you do about limit switches in the? (or did you just disable them!)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 09, 2011, 10:25 am
of course i will send you some pictures! i found out that i made a design fault on the z-axis which at the moment only can move about 10mm instead of 100. i will fix this the next week.

if you want pictures earlier, just let me know and i make them und upload them asap.

i have some questions about BOB (which will arrive next week):

(1) just to make sure: basically BOB replaces the arduino. so BOB will connect to the parallelport on the pc on one side and connect to the easydriver boards, and endswitches on the other side?

(2) do you know if BOB works with Mach3 also?

Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 09, 2011, 10:43 am
:)
any pictures/info/drawings would be good

I don't know BoB!! :o, I only use my own software and hardware
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 09, 2011, 12:17 pm
i am working on the z-axis at the moment, so i will send you some pictures later this day. i don´t have plans, but i can give you details - just ask me.

regarding BOB: ha,ha, aaah - > i just found out that it was not you posting this, it was yankee :). some where on this thread he asked about why not using emc2. he then suggested using BOB (parallel breakout board).

basically, i don´t think that i will need it, as i am happy with your solution. there are just little things that i miss in cncdriver to make it perfect - one thing would be a button where the machine drives itself to the endswitches of each axis and resets the measurement, so that from there on it would be possible to use absolute axis-measurement. the other thing that would be great, would be some possibility to enter values directly in cncdriver. for example to move the x-axis 50mm to the left. so the machine could be manually driven without creating gcode before. and of course some kind of joystick, controller movement would be nice.

"see" you later!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 09, 2011, 01:11 pm
Ok I will add those, not too difficult!
Cheers Mike
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 09, 2011, 01:26 pm
fantastico!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 09, 2011, 02:04 pm
here are the first pix. the machine needs some more time to get finished. need to install endswitches, some kind of cableguidance and stabilize the z-axis.

(http://www.empe.at/cnc/IMG_3358.JPG)
(http://www.empe.at/cnc/IMG_3365.JPG)
(http://www.empe.at/cnc/IMG_3355.JPG)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 09, 2011, 02:37 pm
It looks huge how big is it?
Is that a PC power unit?
Oh and what motors are you using?
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 09, 2011, 07:03 pm
its not that big :) the machine is  700x850mm. working area is about 500mm x 500mm x 100mm.

the power supply it not a pc supply but a supply with 24V 7ampere.

the stepper motors are nema 17. a nice mixture of chinese ones and american ones.

i am drunk at the moment, happy and looking forward for your new and improved cncdriver.

have an extremly nice evening or, as i guess as you are in america, nice day ( and evening lateron of course).
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 09, 2011, 08:52 pm
Bloody cheek, I'm British and in the UK!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 09, 2011, 09:54 pm
you did know that there is "jog" functionality?

the up (^), down(v), left(<) and right(>) as well as Z up (Z^) and Z down (Zv) each move 1 cm in the indicated direction, just by clicking the button!

meant to ask - where are you based?
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 09, 2011, 10:08 pm
i am austrian, directly in the mountains of tyrol and i must say that i love the uk. i travelled there several times.

yeah i found the jog functionality. but here it travels 1mm. i guess i did something wrong in the init.pde but i will find out.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 09, 2011, 10:32 pm
sounds like you may have the steps per inch or steps per mm set wrong
It's meant to move by 1 cm in the direction indicated
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 10, 2011, 09:48 am
i think so. i calculated that i have 4064 steps per inch, as my stepper makes 200 steps per turn and my threaded rod makes a movement of 1.25mm per turn. i put that into init.pde and uploaded it.

in the init.pde there is only a section of steps per inch and no section of steps per mm. is that correct?

today i will add the switches to the machine.

have a nice day, me needs one or two more espressi ;)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 10, 2011, 10:49 am
hmm
I must admit I did hide it
at the very top of the code
with comments!!!!!
have another coffee
cheers
Mike

Code: [Select]
//=====================================
// define the parameters of our machine
//=====================================
#define X_STEPS_PER_INCH 6400
#define X_STEPS_PER_MM   252

#define Y_STEPS_PER_INCH 20000
#define Y_STEPS_PER_MM   2362.2

#define Z_STEPS_PER_INCH 6400
#define Z_STEPS_PER_MM   252.0
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 10, 2011, 04:03 pm
hej, thanx. funny - after having some more coffee and double checking - only the steps per inch are in my init.pde.

now i add the milimeter ones ;) so that´s what my ini.pde looks like now. is this ok?
Code: [Select]
// constant for mm conversions
//============================
#define MM_PER_INCH 25.4

//=====================================
// define the parameters of our machine
//=====================================
#define X_STEPS_PER_INCH 4064
#define X_STEPS_PER_MM   160

#define Y_STEPS_PER_INCH 4064
#define Y_STEPS_PER_MM   160

#define Z_STEPS_PER_INCH 4064
#define Z_STEPS_PER_MM   160

//==================================
//our maximum feedrates units/minute
//==================================
#define FAST_XY_FEEDRATE_INCH 20.0
#define FAST_Z_FEEDRATE_INCH  20.0

//=======================
// Units in curve section
//=======================
#define CURVE_SECTION_MM 0.5

//=========================================
// Set to one if sensor outputs inverting
// (ie: 1 means open, 0 means closed)
// RepRap opto endstops are *not* inverting
//=========================================
#define SENSORS_INVERTING 0

//===============================================
// digital i/o pin assignment
// odd choices are for convenience to connectors
// NB Arduino pins 14-19 correspond to analog 0-5
//===============================================

//============================
// pin 0 used for serial comms
// pin 1 used for serial comms
//============================
#define SERIAL_RX_PIN 0
#define SERIAL_TX_PIN 1

//=======================================================
// shared enable pin (for rapid shutdown off all motors!)
//=======================================================
#define X_ENABLE_PIN 8
#define Y_ENABLE_PIN 18  // sb8
#define Z_ENABLE_PIN 19  // sb8

//===========================
// cartesian bot pins X-plane
// 6 7 A0 A1
//===========================
#define X_STEP_PIN 7
#define X_DIR_PIN 6
#define X_MIN_PIN 14
#define X_MAX_PIN 15

//===========================
// cartesian bot pins Y-plane
// 2 3 4 5
//===========================
#define Y_STEP_PIN 2
#define Y_DIR_PIN 3
#define Y_MIN_PIN 5
#define Y_MAX_PIN 4

//==================================================
// pin 13 used for heartbeat as it already has a LED
//==================================================
# define HEARTBEAT_PIN 13

//===========================
// cartesian bot pins Z-plane
// 9 10 11 12
//===========================
#define Z_STEP_PIN 9
#define Z_DIR_PIN 10
#define Z_MIN_PIN 5  // sb 11
#define Z_MAX_PIN 4  // sb 12

//==============
// motor control
// A4
//==============
#define MOTOR_ON_PIN 18           // HIGH = ON, LOW = OFF

//========================================
// motor direction doesn't have a pin yet!
//========================================
// #define MOTOR_DIRECTION_PIN 20    // HIGH = Clockwise, LOW = Anti-clockwise

//======================
// panic stop/reset
// A2 A3
//======================
#define PANIC_STOP_PIN 16
#define PANIC_OVER_PIN 17

//==================================================
// pin 19 (A5) is used for serial output to display
//==================================================
# define LCD_SERIAL_PIN 19



Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 10, 2011, 04:34 pm
call me stupid but when i press the jog y button, the stepper motor makes exactly one turn what is 1.25 mm in the direction of the axis. what am i doing wrong?

if i send the following code:
Code: [Select]
G21
G1Y500.000


the machine moves 62.5mm
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 10, 2011, 05:59 pm
well one of us is stupid
oops that'll be me - I looked at an old version of the file  :-[
sorry 'bout that

you can remove steps_per_mm as they are not used
I changed the code to calculate them from steps_per_inch

meanwhile
why does your jog not jog enough? hmm

the units are steps per mm not steps per turn
so if G1Y500 moves you 62.5mm then something is set up wrong as it should move 500mm
so multiply your steps per mm by 500/62.5 = 8 and it should work
jog would then move 1.25 * 8 = 10mm as advertised!! :)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 10, 2011, 06:01 pm
your file should look like this:

Code: [Select]

//=====================================
// define the parameters of our machine
//=====================================
#define X_STEPS_PER_INCH 32512
#define Y_STEPS_PER_INCH 32512
#define Z_STEPS_PER_INCH 32512
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 10, 2011, 06:48 pm
ok
I have added a button to home all 3 axes

you will need a new CNCdriver and a new sketch
before I upload them - have you made any changes to the code?
(apart from init_pde of course  :-[ )
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 10, 2011, 08:14 pm
great! no i did not make any changes apart the init.pde. to let you know: now the machine goes 10mm when i want her to;)

Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 10, 2011, 08:33 pm
Excellent
as soon as I finish my supper I will upload Mk II
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 10, 2011, 08:36 pm
superdup
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 10, 2011, 09:58 pm
ok I have uploaded the new shiny versions of CNCdriver (1.02) and the sketch (v1.4)
they are in the same place as before:

http://www.mmcpix.com/CNC/CNCdriver.zip

http://www.mmcpix.com/CNC/GCode_Interpreter.zip

You will notice that I have increased the number of settings in Tools :: Options

I found that I can get twice the speed by setting the
Timers :: Timer to 10mS

It also remembers the sizes and poistions of the forms as well as the panel sizes on the main form

let me know how you get on
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 02:14 pm
hi! i am connecting the switches at the moment and am confused again. init.pde tells me that the switches of the y-axis and z-axis connect to the same pins on the arduino. in my little head this doesn´t make sense. is this ok?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 02:23 pm
two things
a) I just uploaded a new version of the CNCdriver (1.03)
there was a buglet in options setting!

b) cough
I haven't got Z switches installed yet so I faked it by making them the same as Y!
so go ahead and change the pins to 11 and 12
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 03:27 pm
troubles in tyrol. as i have connected the switches the machine behaves strange. basically if i press the arrow buttons, the machine most of the time doesent move at all, just making a small "click" which i guess comes from the enable pin, then followed by a high sound (during the time it should move).  the only axis that moves sometimes is the x-axis. when it moves and i manually press the endswitch it stops as supposed to.

when i disconnect the switches from arduino and try with the v1 of cnc driver the machine moves like it should.

thats crazy ;)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 03:31 pm
did you download v1.03?
you should also check the options settings are "sensible"

you may find that v1.02 has messed up some of the settings
if you want - you can send me your CNCconfig.ini
XP - it should be in the windows folder

a high pitched sound usually means the feed rate is set too high and the motors can't keep up
but if it works with 1.01 then that's odd!

I guess you're using the same version of the sketch?
did you change all the init.pde settings properly?

let me know...
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 03:41 pm
hi again. i am using cncdriver 1.03. which is installed in a seperate folder. i have no clue where to find cncdriver.cfg ;)

here is the init.pde that i use:
Code: [Select]
// constant for mm conversions
//============================
#define MM_PER_INCH 25.4

//=====================================
// define the parameters of our machine
//=====================================
#define X_STEPS_PER_INCH 32512
#define Y_STEPS_PER_INCH 32512
#define Z_STEPS_PER_INCH 32512

//==================================
//our maximum feedrates units/minute
//==================================
#define FAST_XY_FEEDRATE_INCH 50.0
#define FAST_Z_FEEDRATE_INCH  50.0

//=======================
// Units in curve section
//=======================
#define CURVE_SECTION_MM 0.5

//=========================================
// Set to one if sensor outputs inverting
// (ie: 1 means open, 0 means closed)
// RepRap opto endstops are *not* inverting
//=========================================
#define SENSORS_INVERTING 0

//===============================================
// digital i/o pin assignment
// odd choices are for convenience to connectors
// NB Arduino pins 14-19 correspond to analog 0-5
//===============================================

//============================
// pin 0 used for serial comms
// pin 1 used for serial comms
//============================
#define SERIAL_RX_PIN 0
#define SERIAL_TX_PIN 1

//=======================================================
// shared enable pin (for rapid shutdown off all motors!)
//=======================================================
#define X_ENABLE_PIN 8
#define Y_ENABLE_PIN 18  // sb8
#define Z_ENABLE_PIN 19  // sb8

//===========================
// cartesian bot pins X-plane
// 6 7 A0 A1
//===========================
#define X_STEP_PIN 7
#define X_DIR_PIN 6
#define X_MIN_PIN 14
#define X_MAX_PIN 15

//===========================
// cartesian bot pins Y-plane
// 2 3 4 5
//===========================
#define Y_STEP_PIN 2
#define Y_DIR_PIN 3
#define Y_MIN_PIN 5
#define Y_MAX_PIN 4

//==================================================
// pin 13 used for heartbeat as it already has a LED
//==================================================
# define HEARTBEAT_PIN 13

//===========================
// cartesian bot pins Z-plane
// 9 10 11 12
//===========================
#define Z_STEP_PIN 9
#define Z_DIR_PIN 10
#define Z_MIN_PIN 11  // sb 11
#define Z_MAX_PIN 12  // sb 12

//==============
// motor control
// A4
//==============
#define MOTOR_ON_PIN 18           // HIGH = ON, LOW = OFF

//========================================
// motor direction doesn't have a pin yet!
//========================================
// #define MOTOR_DIRECTION_PIN 20    // HIGH = Clockwise, LOW = Anti-clockwise

//======================
// panic stop/reset
// A2 A3
//======================
#define PANIC_STOP_PIN 16
#define PANIC_OVER_PIN 17

//==================================================
// pin 19 (A5) is used for serial output to display
//==================================================
# define LCD_SERIAL_PIN 19




Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 03:45 pm
that looks ok
I guess you are using the same sketch with CNCdriver 1.01 and 1.03?

CNCconfig.ini is the file you want
should be in windows folder
or get the PC to search for it!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 03:50 pm
i found something out (its funny)

when i press the jog to the left button and nothing happens - then i (manually press the x max switch one time and then press the jog to the left button again the machine moves to the left. if i then press (manually) the x min switch , the machine stops.
Code: [Select]
[Main]
Top=0
Left=0
Height=612
Width=1032
FilePanelWidth=480
ReplyPanelWidth=203
JogPanelWidth=200
MainPanelHeight=225
[Options]
Top=149
Left=509
Height=589
Width=441
[Serial]
Port=COM5
BaudRate=19200
[Drawing]
PenWidth=3
PenColor=16777215
PixelsPerUnit=256
OriginX=2,5
OriginY=2,5
CursorPenWidth=1
CursorColor=65535
CursorSize=16
StepSize=64
DoStep=0
[Timer]
ShortCommandTick=10000
LongCommandTick=30000
TimerTick=50
[GCommands]
RapidMove=G0
RapidMove2=G00
FeedMove=G1
FeedMove2=G01
ClockwiseArc=G2
ClockwiseArc2=G02
AntiClockwiseArc=G3
AntiClockwiseArc2=G03
Dwell=G4
Dwell2=G04
Inches=G20
MM=G21
Absolute=G90
Relative=G91
[MCommands]
GetPosition=M114
Start=M254
RequestLast=M255
[CommandInitCommands]
Count=0
[JogCommands]
JogIncX=RapidMove X10
JogDecX=RapidMove X-10
JogIncY=RapidMove Y10
JogDecY=RapidMove Y-10
JogIncZ=RapidMove Z10
JogDecZ=RapidMove Z-10
[HomeCommands]
HomeStart=RapidMove
HomeEnd=
HomeX=
HomeY=
HomeZ=

Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 04:04 pm
aha I can see that you are a few settings missing
easiest way to fix is with 1.03
tools :: options
initialisation tab
add

Absolute
MM


Home tab
set
Move Command RapidMove
X clause X-100
Y clause Y-100
Z clause Z-100

Save

try that!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 04:18 pm
tried that. hmm. doesn´t change that much. first the jog buttons didn do. after pressing one of the endswitches on the x axix, it was possible to move the x-axis in both directions.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 04:47 pm
are your switches NO or NC (Normally Open or Normally Closed)
or
are they HIGH or LOW when activated?
do you have a voltmeter?
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 04:54 pm
i checked them with a volt/ohm meter. they are open (0) when not pressed and closed (1) when pressed. i connected all the switches to the 5V on arduino and connected the "other side of the switch" to the pins given at init.pde on arduino.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 05:13 pm
ah
I wonder if a pull-down resistor (10k) to ground would help!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 05:18 pm
i have a 10kohm resistor. where should i put it? (sorry, if you still don´t know i am a total noob ;)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 05:27 pm
ok no probs
one side of each switch goes to +5volts
the other side goes to the Arduino
connect 10k between the "arduino" side and ground
so when the switch is open the 10k will connect it to ground

rinse and repeat for each switch
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 05:34 pm
just to make sure: for example the xmin switch gets 5V from the aruino and comes back to pin 14 on the arduino so i connect the wire which goes to pin 14 also with the resistor to gnd on the arduino?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 05:35 pm
10/10 give yourself a gold star and go to top of the class! ;)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 05:38 pm
so basically i connect all switches pins via resistors to gnd. strange but i will try. fact is that i only have 10 10k resistors and some 1k resistors. can i use 1k also?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 05:39 pm
I would prefer 10k
there are only 6 switches? (only needed on the limit switches)
so 10 should be enough

try it on just the x-axis (for example) to make sure that is the fix
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 05:43 pm
ì meant i have 5 10k resistors. trying at the moment...
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 05:51 pm
tried it on the y-axis. god and you know why but it works.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 05:52 pm
that's because
a) noise on an open input can do strange things
b) the input is pulled high internally

suggest use 1k where you need to, but "upgrade" to 10k as soon as you can
keeps the current nice and low
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 06:28 pm
so! :) basically this helps. all axes move. the x-axis does not always move but thats the one where the 1k resistor sits. have you any idea how i can solve this just for the moment where all the shops have closed?

if i press your wonderful home button the machine goes towards the endposition but stops to early. i guess this is because the machine simply is to slow?

anyway - another big THANK YOU!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 06:35 pm
HOME works by stepping all the axes -10cm then asking "are you home yet?"
rinse and repeat
if it stops short, that's because it thinks it's there already
You sure they're 1 k resistors (brown red red)
10k is brown black orange
100k brown black yellow
1M brown black green

what colour are yours?
if they were say 1M then they would be close to useless
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 07:02 pm
5 are brown black orange
1 is brown black red
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 08:16 pm
yup quite right 10k and one 1k
odd that it doesn't work
the only downside is that it draws more current than needed
try swapping it for one of the 10k
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 11, 2011, 08:19 pm
just doing some cleaning up the wires - stuff. by the way - the steppers make a different sound now ;) during the movement there is a high sound getting lower - a little like a veryvery tiny turbine ;)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 11, 2011, 08:25 pm
you might try adjusting the pots on the easy drivers
remember (if you have v4.3) the max and min are the wrong way round !
what motors are you using
max current from easy driver is 750 mA
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 11:47 am
i replaced the 1k resistor with a 10k. so there are only 10k now. i cranked up all easydrivers to max ( i know that this is the opposite direction to what is printed on the easydrivers). but

some troubles in tyrol: the y-axis behaves as it should. x-axis and z-axis don´t. they sometimes go the distance they should but more often they stop before.

also the home button doesen´t drive the machine home. i have to press the button several times until the machine reaches home.

please help.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 12:03 pm
ok a small test first...

do the jog buttons (x, y, z) reliably move 1cm in each direction?
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 12:08 pm
only on the y-axis.  by the way: the motors still make this nice turbine sound.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 12:21 pm
hmm
do you want to post your CNCconfig.ini settings again so I can glare at them!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 12:31 pm
Code: [Select]
[Main]
Top=0
Left=0
Height=612
Width=1032
FilePanelWidth=480
ReplyPanelWidth=203
JogPanelWidth=200
MainPanelHeight=225
[Options]
Top=350
Left=509
Height=448
Width=300
[Serial]
Port=COM5
BaudRate=19200
[Drawing]
PenWidth=3
PenColor=16777215
PixelsPerUnit=100
OriginX=2,5
OriginY=2,5
CursorPenWidth=1
CursorColor=65535
CursorSize=16
StepSize=64
DoStep=1
[Timer]
ShortCommandTick=10000
LongCommandTick=30000
TimerTick=50
[GCommands]
RapidMove=G0
RapidMove2=G00
FeedMove=G1
FeedMove2=G01
ClockwiseArc=G2
ClockwiseArc2=G02
AntiClockwiseArc=G3
AntiClockwiseArc2=G03
Dwell=G4
Dwell2=G04
Inches=G20
MM=G21
Absolute=G90
Relative=G91
[MCommands]
GetPosition=M114
Start=M254
RequestLast=M255
[CommandInitCommands]
Count=2
Init1=Absolute
Init2=MM
[JogCommands]
JogIncX=RapidMove X10
JogDecX=RapidMove X-10
JogIncY=RapidMove Y10
JogDecY=RapidMove Y-10
JogIncZ=RapidMove Z10
JogDecZ=RapidMove Z-10
[HomeCommands]
HomeStart=RapidMove
HomeEnd=
HomeX=X-100
HomeY=Y-100
HomeZ=Z-100
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 12:39 pm
well the settings are correct
I have a bad feeling the prolem is in the Tyrol not the software  :)

Q1
ok x-axis works correctly - jogs both ways and homes correctly?

let's focus on the y axis first
what happens when you try to jog in each direction?
does it move at all?
does it move 1cm every time?
does it work both ways?
what happens to y when you hit home (once)

finally - (dangerous stuff now)
in CNCdriver, the big window top left
you can type commands in there - scary

try this, it will report where the Arduino thinks X, Y and Z are as well as the state of the limit switches

first jog the x and y so they are away from home
hit home once
then clear the big window and type

M114

hit the run button and tell me what you get in the middle window
(you can resize them if it helps)

cheers
Mike
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 12:55 pm
12:55:33.55 -- N0 M254 *0
12:55:33.61 << ok 0

12:55:33.61 -- N1 M114 *6
12:55:33.68 << ok 1 C: X:0.0000 Y:0.0000 Z:0.0000 XMin: 1 XMax: 0 YMin: 1 YMax: 0 ZMin: 1 ZMax: 0
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 01:05 pm
hmm. here´s a new funfact: i just gave the machine the following gcode and it did exactly what it should.
Code: [Select]
G91
G21
G01 Y10
G01 X10
G01 X50
G01 Y50
G01 X-50
G01 Y-50

Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 01:09 pm
you can see from the reply to M114 that it thinks all 3 MIN limit switches are closed
1 means that switch is closed, 0 means open
tis means it thinks it reached home

the home code basically says step backwards 100mm on each axis then see if we got home yet
rinse and repeat until all 3 report home
it will only step those axes that are not home
so if all 3 are in mid space it will step  all 3
if z reaches home first next iteration will only step x and y
if that makes sense

btw
glad to see your code fragment is working!

did you get to answer the long list of questions in the previous post?
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 01:33 pm
jogging ;)


Y is travelling correctly (both directions)
X is sometimes travelling correctly (both directions), sometimes to short
Z is sometimes travelling correctly (both directions), sometimes to short

somehow i get the feeling, that if the machine is at home, the z-axis is travelling correctly but for example when i am at x10, the z-axis starts to misbehave.

by the way: the gcode is posted before is also working sometimes. y always travels as it should, but x and z dont.


oooh question: is it correct, that M114 tells me where the machine is? because if i home the machine and then for example let i move y10 and then check M114 it tells me x0 y0 z0 what really confuses me.


by the way: great that it is possible to enter gcode directly!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 01:44 pm
yes and er no!

if M114 is used in the middle of a script it correctly reports position
if M114 is used by itself, the Run button first resets the interface, so it thinks it's at 0, 0, 0 already
the limit switches are, however read correctly

it would be interesting to put a volt meter on the limit switches for x (and z) as it sounds like they may still be coming on at the wrong time
(dirty joint maybe?)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 01:57 pm
checked all the switches. everything is correct :/
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 02:11 pm
i tried the following: when i disconect all switches from the arduino all axis move how and where they should. i checkt the wiring and everything is fine and i doublechecked the switches which are fine. strange world.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 02:19 pm
ok
a common problem is noise
the motors make electrical noise (as well as singing to you)
that can make the Arduino think the switch came on

maybe small capacitors (0.1 microFarad) from the arduino microswitch pins to ground may help

they need to be at the arduino end of the wire, not the microswitch end btw
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 02:30 pm
ok. this meand the capacitors should be where the resistors are now. is this correct?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 02:35 pm
I hope the resistors are directly connected at the arduino - then yes! :)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 12, 2011, 02:48 pm
the wire that comes back from a switch is connected to arduino. on this wire there is also the 10k resistor connected which goes to gnd on the arduino.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 12, 2011, 02:51 pm
that's good
add the capacitors there
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 13, 2011, 10:42 am
good morning. got some 0.1 400V capacitors (getting electronic components in tyrol is like looking for kangaroos in austria). i will try them out. readying some more threads on makecnc.com i found out that noise on limit switches is quite a common problem and it seems that this issue is always solved with 0.1 capacitors. i never found anything about 10k resistors so maybe i don´t need them. we´ll see and i keep you informed!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 13, 2011, 11:27 am
:)
noise is a common problem, glad to hear the "usual" solution is 0.1 microfarad capacitors (400v is overkill, but does no harm; and probably all you can get anyway!)

you will need the resistors to ensure the inputs aren't floating, so I would use both
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 13, 2011, 11:45 am
i am just messing around with the capacitors. classic noob question: do capacitors have a "direction". on one pin of the capacitor it says "hi" at the moment this is where i have the wire coming back from the switch connected. and it does not work.

so my idea is to do the following:

the wire coming back from the switch goes to the according pin on the arduino. then i will add a resistor on the wire that comes back from the switch. then i will add a capacitor there and connect it to the pin which says "hi" the other pin will be connected to gnd on the arduino.

basially thats how i had it already just with a capacitor added in the line. or should i wire the capacitors and the resistors parallel?

how about that?
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 13, 2011, 12:09 pm
some capacitors (high value ones) are polarised, so it DOES matter which way round they go
they are usually marked with a + and -
low value (the sort you are using) are generally not, so it doesn't matter which way round you connec them
one end of the capacitor should go to ground, the other should go to the input pin
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 13, 2011, 12:36 pm
tried and failed. machine moved a little. now it says all switches are 1.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 13, 2011, 12:48 pm
well we're definitely poking the right place
very odd

wild guess
instead of connecting one ond of the capacitor to ground, connect it to +5
(think that means it's in parallel with the resistor but that's ok)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 13, 2011, 01:02 pm
to make sure: that is how i have it now:
(http://www.empe.at/cnc/001.jpg)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 13, 2011, 01:17 pm
Nooooooooooooooooooooooooooo
+5v to switch is good
one side of10k to other side of switch is good
other side of 10k should go to ground
capacitor should be in parallel with resistor

try that!
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 13, 2011, 01:23 pm
like that ?

(http://www.empe.at/cnc/002.jpg)

ps.: did i tell you lately that i am a noob? ;)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 13, 2011, 01:26 pm
perfick :)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 13, 2011, 01:45 pm
its a miracle! with a tear in my eye i see the machine moving to all the places i want her to. i think it will take some time until i trust this baby but i guess we did it.

oh my god, i am tired!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 13, 2011, 01:48 pm
:) :) :)
excellent news!
well done you
have a beer (ok maybe a bit early)
:) :) :)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 13, 2011, 04:23 pm
beside of the fact that i have to redesign my machine to make it stronger erverything works now. i am extremly thankful for your kind help!

one last thing: would you tell me with which software you generate the gcode for the cncdriver as i struggle a little getting the right code out of cut2d and cut3d.

have a very nice day!
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 13, 2011, 04:32 pm
my interest is pcb milling
so I use Eagle to design then layout the pcb
there is a plug-in pcb-gcode that creats the gcode directly from the layout

I don't know cut2d or cut3d
Title: Re: another cnc mill questionaire
Post by: joel383 on Jan 22, 2011, 09:34 am
great thread guys. have you tried your program in linux(Wine?)
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 22, 2011, 09:51 am
nope
strictly windoze man, me

is wine windows-on-linux?

give it a try!!
Title: Re: another cnc mill questionaire
Post by: joel383 on Jan 22, 2011, 01:37 pm
Yes, its an emulator.

well, it opens... do you have a bit if g-code i could try to run. i don't have anything built, but i will try to see if it talks to the arduino.
Title: Re: another cnc mill questionaire
Post by: joel383 on Jan 22, 2011, 02:32 pm
when i try to compile the sketch GCode_Interpreter.pde i keep getting this error:
'Serial' was not declared in this scope
this is the line it highlights line 70:
  Serial.begin(19200);

here is the whole error
Code: [Select]
GCode_Interpreter.cpp: In function 'void setup()':
GCode_Interpreter:69: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void loop()':
GCode_Interpreter:82: error: 'Serial' was not declared in this scope
GCode_Interpreter:125: error: 'Serial' was not declared in this scope
GCode_Interpreter:131: error: 'Serial' was not declared in this scope
GCode_Interpreter:132: error: 'Serial' was not declared in this scope
GCode_Interpreter:147: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'boolean Checksum(char*, int)':
GCode_Interpreter:193: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'boolean ProcessComment(char*, int)':
processComment:6: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'boolean ProcessGcode(char*, int)':
processGcode:95: error: 'Serial' was not declared in this scope
processGcode:104: error: 'Serial' was not declared in this scope
processGcode:126: error: 'Serial' was not declared in this scope
processGcode:130: error: 'Serial' was not declared in this scope
processGcode:134: error: 'Serial' was not declared in this scope
processGcode:138: error: 'Serial' was not declared in this scope
processGcode:141: error: 'Serial' was not declared in this scope
processGcode:154: error: 'Serial' was not declared in this scope
processGcode:159: error: 'Serial' was not declared in this scope
processGcode:200: error: 'Serial' was not declared in this scope
processGcode:245: error: 'Serial' was not declared in this scope
processGcode:257: error: 'Serial' was not declared in this scope
processGcode:266: error: 'Serial' was not declared in this scope
processGcode:277: error: 'Serial' was not declared in this scope
processGcode:288: error: 'Serial' was not declared in this scope
processGcode:299: error: 'Serial' was not declared in this scope
processGcode:308: error: 'Serial' was not declared in this scope
processGcode:317: error: 'Serial' was not declared in this scope
processGcode:325: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void DebugUnits()':
processGcode:333: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'boolean ProcessMcode(char*, int)':
processMcode:19: error: 'Serial' was not declared in this scope
processMcode:32: error: 'Serial' was not declared in this scope
processMcode:45: error: 'Serial' was not declared in this scope
processMcode:57: error: 'Serial' was not declared in this scope
processMcode:69: error: 'Serial' was not declared in this scope
processMcode:83: error: 'Serial' was not declared in this scope
processMcode:95: error: 'Serial' was not declared in this scope
processMcode:107: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void process_string(char*, int)':
process_string:19: error: 'Serial' was not declared in this scope
process_string:34: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void dda_move(long int)':
stepper_control:119: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void Heartbeat()':
stepper_control:224: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void calculate_deltas()':
stepper_control:315: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void disable_steppers()':
stepper_control:397: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'void enable_steppers()':
stepper_control:412: error: 'Serial' was not declared in this scope
GCode_Interpreter.cpp: In function 'bool PanicStop()':
stepper_control:428: error: 'Serial' was not declared in this scope
stepper_control:443: error: 'Serial' was not declared in this scope
Title: Re: another cnc mill questionaire
Post by: joel383 on Jan 22, 2011, 02:42 pm
i tried this:
Code: [Select]
G91
G21
G01 Y10
G01 X10
G01 X50
G01 Y50
G01 X-50
G01 Y-50


and got the same "unable to open com port (win error code: 2)"

I'll have to look at the com ports tomorrow, its almost 5 AM

Also: When this error box popped up, I accidentally clicked outside of it and to my dismay noticed that the close min and max buttons were gone! now i had a window i couldn't minimize to get back to the pop-up error box.
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 22, 2011, 03:20 pm
the missing serial library...
which version of the Arduino IDE are you using?
I use 21

The second problem (COM port)...
is caused by not selecting the right COM port!)
try tools..options and select the COM port that your Arduino is connected to

and finally...
the error box is modal
try using ALT-TAB to find it!
(silly windoze)
Title: Re: another cnc mill questionaire
Post by: theMPloc on Jan 22, 2011, 11:41 pm
@joel: use sketch 21 - it works then. if you use 22 then you get this error.

regarding the ports. go to the device manager and set the port of the arduino to com5.
Title: Re: another cnc mill questionaire
Post by: joel383 on Jan 23, 2011, 03:05 am
looks like its too big for my Diecimila.

even if i tried to use integer instead of using floating point it only saves two kb

Code: [Select]
Binary sketch size: 17612 bytes (of a 14336 byte maximum)
processing.app.debug.RunnerException: Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
     at processing.app.Sketch.size(Unknown Source)
     at processing.app.Sketch.build(Unknown Source)
     at processing.app.Sketch.build(Unknown Source)
     at processing.app.Editor$DefaultRunHandler.run(Unknown Source)
     at java.lang.Thread.run(Thread.java:636)


edit: thanks theMPloc
Title: Re: another cnc mill questionaire
Post by: mmcp42 on Jan 23, 2011, 12:34 pm
nooooooooooooooooo
do not use integer instead of float to save space!

a better idea is to hack out some of the lesser used routines
the two arc functions are good candidates to lose
G2 and G3 in the Gcode file
you could also discard the spindle controls if you're not using them
M3 M4 and M5 in the Mcode file

if you do make changes, let me know what you did
cheers and good luck
Mike

PS could always buy a bigger Arduino :)