Benbox Laser Machines/CO2 Lasers/3D Printers

Software => T2 Engraving => Topic started by: mattm58 on May 21, 2020, 03:19:59 PM

Title: firmware for core-xy
Post by: mattm58 on May 21, 2020, 03:19:59 PM
Hey @zax, I've rebuilt one of my eleks a3 frames as a core-xy machine.  Do any of the firmware options built into T2 operate as a core-xy?  I tried the 1.1f CNC Z-XY firmware, but x directionals go diagonal and Y & diagonal seem to have the two steppers fighting against each other.  I've also tried the 0.9i as mentioned on one of the other posts and tried a bunch of the options in configuring the eleks mana, but no dice...
Title: Re: firmware for core-xy
Post by: mattm58 on May 21, 2020, 04:13:42 PM
Nevermnid, managed to get it working using 0.9i with eleckscam software setting grbl params.  For anybody else who looks for this in the future, here's my grbl settings:

Connected COM3 115200
Grbl Ready
Origin Set (Home)
$$
$0=10 (step pulse, usec)
$1=25 (step idle delay, msec)
$2=0 (step port invert mask:00000000)
$3=1 (dir port invert mask:00000001)
$4=0 (step enable invert, bool)
$5=0 (limit pins invert, bool)
$6=0 (probe pin invert, bool)
$10=3 (status report mask:00000011)
$11=0.010 (junction deviation, mm)
$12=0.002 (arc tolerance, mm)
$13=0 (report inches, bool)
$20=0 (soft limits, bool)
$21=0 (hard limits, bool)
$22=0 (homing cycle, bool)
$23=0 (homing dir invert mask:00000000)
$24=25.000 (homing feed, mm/min)
$25=500.000 (homing seek, mm/min)
$26=250 (homing debounce, msec)
$27=1.000 (homing pull-off, mm)
$100=100.000 (x, step/mm)
$101=100.000 (y, step/mm)
$102=400.000 (z, step/mm)
$110=5000.000 (x max rate, mm/min)
$111=5000.000 (y max rate, mm/min)
$112=5000.000 (z max rate, mm/min)
$120=200.000 (x accel, mm/sec^2)
$121=200.000 (y accel, mm/sec^2)
$122=200.000 (z accel, mm/sec^2)
$130=5000.000 (x max travel, mm)
$131=5000.000 (y max travel, mm)
$132=5000.000 (z max travel, mm)
Title: Re: firmware for core-xy
Post by: Zax on May 21, 2020, 05:11:27 PM
Yes, the Eleks Mana firmware is the easiest option (Grbl 0.9i). It's included in T2Laser and there's also a menu to configure it, you can switch it between CoreXY and Cartesian coordinates and also use either servo or laser mode.
Title: Re: firmware for core-xy
Post by: ggallant571 on May 21, 2020, 07:42:34 PM
I've been using grbl-1.1f for some time now with core-xy etchers. Need to build with the core-xy feature enabled.
Title: Re: firmware for core-xy
Post by: mattm58 on May 21, 2020, 10:52:03 PM
I've been using grbl-1.1f for some time now with core-xy etchers. Need to build with the core-xy feature enabled.

Would you be willing to share the hex file so I don't have to figure out how to compile it?   ;D
Title: Re: firmware for core-xy
Post by: Zax on May 22, 2020, 03:57:01 AM
All you need to do is enable it (by uncommenting) and then compile:

#define COREXY // Default disabled

I would also recommend to disable homing, although ggallant571 may be able to help with.
Title: Re: firmware for core-xy
Post by: ggallant571 on May 22, 2020, 06:31:23 AM
Homing was a little challenge. I have the X limit switch on the lower left and the Y limit switch on the lower right. Perform the Y first and then the X. This also required entries in the parameters section. No problem sharing the hex. Will do a dump of parameters and post both and the config file.
Title: Re: firmware for core-xy
Post by: mattm58 on May 25, 2020, 05:44:20 PM
Homing was a little challenge. I have the X limit switch on the lower left and the Y limit switch on the lower right. Perform the Y first and then the X. This also required entries in the parameters section. No problem sharing the hex. Will do a dump of parameters and post both and the config file.

Thanks @ggallant571

I've tried flashing your firmware twice with avrdude, but both times I get to 97% writing and then get a "programmer is not responding" error.  At this point I've only got one working nano left and don't want to hose it. 

The working nano is running 0.9i.  All axis movements are correct, but if I try to pulse the laser or turn on/off via the laser control screen the laser comes on but I can't turn it off.  the off button doesn't do anything, and the pulse turns it on and it stays on.  Any ideas?
Title: Re: firmware for core-xy
Post by: ggallant571 on May 25, 2020, 06:16:35 PM
I prefer low level tools for debugging hardware which for grbl devices is a terminal emulator such as teraterm for Windows for gtkterm for Linux. From the command line you can type/execute the basic commands. The list is not very long and can be found with a Google search.

We have:
 G00, G01                      basic X,Y motion
 Fxxx                              motor speed
 M03, M04, & M05          laser enable mode
 Sxxx                               laser power

With the 1.x firmware there is a parameter which disables the laser when there is no motion.

Do you have a spare generic Arduino? If so, you can turn it into a ISP burner. I had similar problem with Nano until I reloaded the boot loader with the "modern" version. The older uses 57600 baud and occupies about 2K code space. The newer is at 115200 baud and uses about 1K. That 1K is likely causing your problem as the 1.f firmware is about 31K.
Title: Re: firmware for core-xy
Post by: mattm58 on May 25, 2020, 10:06:58 PM
Alright, I'm new to all this arduino programming/flashing/etc.  The most I've done is flash the grbl version using T2.

I've got three nanos now that won't flash.  One good one, but I don't want to pull it from the other, working, laser and bork it too.

That being said, what do I need to do to get a working core-xy firmware flashed to a nano?  The 0.9i doesn't seem to work for me, as mentioned above once I turn the laser on it doesn't turn off.  All core-xy movements are good though.  It sounds like I need to move to 1.1, but that doesn't fit with the old bootloader?

Buy more nanos?  Buy a programmer?  I really have no idea what I'm doing here, as you can probably tell...

If the simplest option is to buy a programmer, any suggestions?  It looks like programming using arduino isp requres an uno and not a nano?

Thanks for all your help guys!
Title: Re: firmware for core-xy
Post by: Zax on May 26, 2020, 04:00:07 AM
You can use a Nano as a programmer (search "arduino nano to nano bootloader") or get an AVR programmer (USBASP/USBISP with 6-pin cable or use jumper wires to connect).

If they won't flash then you either have the settings wrong (use XLoader) or there's a problem with the bootloader, like the hex doesn't have one.

You would be better to use Arduino IDE and compile your own firmware, the changes are very simple (search for CoreXY in config and uncomment). You will need to use this to repair the Nano bootloaders anyway.
Title: Re: firmware for core-xy
Post by: mattm58 on May 26, 2020, 12:54:04 PM
Ok, managed to get arduino ide installed, downloaded grbl, was able to compile and upload the example grblUpload.  If I enable core-xy the sketch is too big.  What should I comment out in the config.h file to get it back under size to fit on the nano?
Title: Re: firmware for core-xy
Post by: ggallant571 on May 26, 2020, 02:47:50 PM
Did you ever determine which bootloader you have?
Title: Re: firmware for core-xy
Post by: mattm58 on May 26, 2020, 03:02:01 PM
Old bootloader, it's the only one I can get an upload to work with.

Through screwing around I've managed to get everything working except for resetting the home position the t2 laser control screen.  I'm sure it probably uses one of the optional report fields I commented out to get it small enough. 
Title: Re: firmware for core-xy
Post by: ggallant571 on May 26, 2020, 03:36:58 PM
I think the newer bootloader is a positive step up. You need a ISP loader to install it which can be made from an Arduino Uno or Nano using feature built into the Arduino IDE. You need 6 wires. 5 of the 6 go from programmer to target 6-pin ISP headers. The 6th is a little different.

Did you make the core-xy from scratch?

I have observed that the speeds are typically off by quite a lot (probably the square root of 2). I maintain a log of laser, speed, & PWM for various media.
Title: Re: firmware for core-xy
Post by: mattm58 on May 26, 2020, 03:55:33 PM
I did this one:  https://www.thingiverse.com/thing:3016513

Modified a couple of the plates to add mounts for drag chain.  It started as a standard a3 frame, then I swapped out the Y rails for 1m rails.  I've got two of these exactly the same.  One I have no issues, the other I've spent a LOT of time trying to figure out various issues, I think it boils down to the two Y steppers not staying in sync.  It works great for small items, but when I get further up the Y axis it starts to distort.  I figured if I was redoing things anyway I'd try the core-xy setup that eliminates a stepper.  Obviously don't have it running yet to have any results...
Title: Re: firmware for core-xy
Post by: mattm58 on May 26, 2020, 04:57:13 PM
Ok, fingers crossed, I *think* I may have it working!  At least it is jogging around and pulse/power on-power off.

@zax - please let me know if anything I've commented out needs to be put back in for t2 to work correctly.  I don't plan on doing any flashing of firmware from t2 on this one now.

From the default grbl 1.1h I had to do the following:

enable core-xy (uncomment the #define)

Comment out the following to free up enough space:

//#define REPORT_FIELD_BUFFER_STATE // Default enabled. Comment to disable.
//#define REPORT_FIELD_PIN_STATE // Default enabled. Comment to disable.
//#define REPORT_FIELD_OVERRIDES // Default enabled. Comment to disable.
//#define REPORT_FIELD_LINE_NUMBERS // Default enabled. Comment to disable.

//#define ENABLE_RESTORE_EEPROM_WIPE_ALL         // '$RST=*' Default enabled. Comment to disable.
//#define ENABLE_RESTORE_EEPROM_DEFAULT_SETTINGS // '$RST=$' Default enabled. Comment to disable.
//#define ENABLE_RESTORE_EEPROM_CLEAR_PARAMETERS // '$RST=#' Default enabled. Comment to disable.
//#define ENABLE_BUILD_INFO_WRITE_COMMAND // '$I=' Default enabled. Comment to disable.
//#define FORCE_BUFFER_SYNC_DURING_EEPROM_WRITE // Default enabled. Comment to disable.
//#define FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // Default enabled. Comment to disable.


@ggallant571 - I do plan on picking up another few arduinos so I can make an ISP to flash a 'modern' bootloader to hopefully gain space back and not have to disable all the above.  When you said speed was off, was that in the physical speed it was running at, estimated time remaining it t2, ?  Was it higher or lower?


Title: Re: firmware for core-xy
Post by: ggallant571 on May 26, 2020, 05:20:22 PM
The physical speed is way off. Created a square in gcode with 200mm per side, speed of 800mm/min, and very weak laser. Expected it to take one minute. That was over 2 years ago so will repeat experiment prior to quoting actual number. Should probably try with triangle and circle to see if error is predictable.

If you look at the grbl code where the core-xy motion is calculated it is only a few lines for distance but no compensation for speed.
Title: Re: firmware for core-xy
Post by: mattm58 on May 27, 2020, 01:04:59 AM
Success!  First test, a coaster for a friend, is attached.

Speed is definitely off.  @ggallant571, I think you're right, looks close to square root of 2 off.  I'll look at the code tomorrow and see if I can make a simple fix.
Title: Re: firmware for core-xy
Post by: Zax on May 27, 2020, 03:50:27 AM
Looks impressive. Nice job!
Title: Re: firmware for core-xy
Post by: ggallant571 on May 27, 2020, 07:06:10 AM
If it is a constant I will put the correction factor in my host application. I currently have a separate application for etching wine glasses on a rotary table where the speed is adjusted based on the diameter of the glass. Thinking that a checkbox with machine type (aartesian, core-xy, rotary) would make life easier. Also add diameter if rotary. Am currently reworking this code to fit on a 3.5 inch Raspberrry Pi display.

Brain cell just triggered - could the core-xy adjustment be better handled by the host!!!!

Title: Re: firmware for core-xy
Post by: Zax on May 27, 2020, 07:58:54 AM
It could, but that's a poor way to do it.
Title: Re: firmware for core-xy
Post by: ggallant571 on May 27, 2020, 01:03:41 PM
Already working on rotary table fixture.

Attached is a simple gcode program to etch a square. Each side is 200mm and the speed is set 4800 mm/min. 4800 mm/min is 80 mm/sec and the elaped rime should be 10 seconds. It takes 15 seconds. Tried at 2400 and 1200 and the time were 29 and 54 secs.

My bed is approx 350x350. Edit as needed if your bed is less than 200x200.
Title: Re: firmware for core-xy
Post by: mattm58 on June 01, 2020, 03:22:47 PM
Alright guys, getting back to attempting to update the bootloader on the two  non working nanos.  Got a borrowed nano flashed with the ISP code, then realized none of the nanos on my eleksmaker controllers have the iscp pinouts.  How do you program these, or is it time to toss these and pick up some new ones with iscp pins?
Title: Re: firmware for core-xy
Post by: ggallant571 on June 01, 2020, 04:08:36 PM
The signals on the ISP header are the MOSI, MISO, SCK, PWR, GND, & RESET. All are available on the standard I/O headers. Makes it difficult to update while in fixture but perhaps makes it easier if you have a generic breadboard. 
Title: Re: firmware for core-xy
Post by: Zax on June 02, 2020, 04:13:54 AM
It's very easy, just connect:

Programmer --> Target
5V to Vin
GND to GND
10 to RST
11 to 11
12 to 12
13 to 13
Title: Re: firmware for core-xy
Post by: mattm58 on June 16, 2020, 01:26:47 PM
Hey Zax, got another question.  Haven't been able to screw with the firmware & arduinos for a while, life got in the way.  I do have a new oddity.  Now, on the core-xy machine any time I bring up the laser control screen it auto sets current position to x:0, y:15, z:0.  It used to set all three to 0, so obviously something happened along the way, but I can't figure out what.  How do I set this back so it auto sets current position to 0:0:0?  This has screwed me up several times because I started the engraving where it was at and Y was off by 15...

Title: Re: firmware for core-xy
Post by: Zax on June 16, 2020, 02:13:46 PM
You've set an offset in Grbl, click Clear Grbl Positions in the Machine menu and it will remove them.
Title: Re: firmware for core-xy
Post by: mattm58 on June 16, 2020, 02:25:43 PM
Thanks, knew it was probably a simple fix, just couldn't figure out where...  :)