Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GRBL on arduino nano #1517

Open
roydekleijn opened this issue Mar 25, 2019 · 19 comments
Open

GRBL on arduino nano #1517

roydekleijn opened this issue Mar 25, 2019 · 19 comments

Comments

@roydekleijn
Copy link

Hi,

I like to install GRBL on a Arduino Nano.. In my project I only need 2 steppers + 1 servo (for Z-axis movement) + 2 limit switches

I get the following error:

Sketch uses 30880 bytes (100%) of program storage space. Maximum is 30720 bytes.

Global variables use 1472 bytes (71%) of dynamic memory, leaving 576 bytes for local variables. Maximum is 2048 bytes.
Sketch too big; 

Is there a way I can comment some code? since I only need 2 steppers and 1 servo + 2 limit switches.

I hope this is possible, since changing the bootloader gave me different issues.

Thanks

@Norwegian-Gadgetman
Copy link

Norwegian-Gadgetman commented Mar 25, 2019 via email

@MeJasonT
Copy link

MeJasonT commented Mar 25, 2019

It loads to Nano's ? Are you using GRBL IDE to load the code or XLoader.
You could try Xloader if you haven't already its a cleaner more direct way of uploading the code
http://www.hobbytronics.co.uk/arduino-xloader
Have you used the correct settings in the IDE before uploading - It sound strange why it wont work for you. Are you using the 328 or 168 version of the nano?
IMG_1613

@MeJasonT
Copy link

MeJasonT commented Mar 25, 2019

Sketch uses 30880 bytes (100%) of program storage space. Maximum is 30720 bytes.

What version are you using, this seems to be a huge code for the ATMEGA328 IC based GRBL
If your hardware is configured for Grbl ver 1.1 then you should use the code from here
https://github.com/gnea/grbl/releases

@roydekleijn
Copy link
Author

Thanks for the comments!

I have the 328P version. The reason I use a nano is that I'm building a mini CoreXY plotter with this board: cnc shield V4 (I don't think Teensy fits on this board)

I uncommented the following 2 lines:

#define COREXY // Default disabled. Uncomment to enable.
#define VARIABLE_SPINDLE // Default enabled. Comment to disable.

and I changed the homing settings to:

#define HOMING_CYCLE_0 (1<<X_AXIS)
#define HOMING_CYCLE_1 (1<<Y_AXIS)
  1. because I use CoreXY
  2. because I like to use a servo for lifting the pencil

If I comment #define VARIABLE_SPINDLE // Default enabled. Comment to disable., then the CoreXY is working fine (including homing). But I'm not able to lift the pencil.

@MeJasonT
Copy link

MeJasonT commented Mar 25, 2019

Are you changing #define VARIABLE_SPINDLE because your hardware is configured for ver 0.9 of grbl
https://github.com/grbl/grbl/wiki/Connecting-Grbl
the Z pin homing switch was swapped with the spindle pin, might explain why you have lost your Pencil lol.

@roydekleijn
Copy link
Author

roydekleijn commented Mar 25, 2019

I was changing #define VARIABLE_SPINDLE, because I assumed that it would allow me to control the servo with the M03 and M05 commands.

Are my thoughts wrong here? How else can I control the servo ?

@MeJasonT
Copy link

The spindle output by default is pwm for variable spindle, i believe there is some trickery involved with setting up for lasers but out of the box it should do exactly what you want M3 and M5 will control a spindle with speed set by S*** speed (gcode - M3 S1000 will start a spindle running at 1000 Rpm all be it that the output signal will be 0-255 pulse width.)

I'm confused by the requirement of a spindle when you are using a plotter pencil.
converting the z axis from step to servo control for up/down of the pencil is more the issue you have. Actually you are building a 3 axis machine but the Z isn't required to have variable height?
There will be examples on the web where people have built plotters and changed the code to operate a servo or a solenoid. definitely worth a look.
https://github.com/svenhb/GRBL-Plotter
https://www.instructables.com/id/How-to-Control-a-Servo-Using-GRBL/
https://www.google.com/search?q=using+grbl+as+a+plotter&oq=using+grbl+as+a+plotter&aqs=chrome..69i57.12449j0j4&sourceid=chrome&ie=UTF-8

@roydekleijn
Copy link
Author

@MeJasonT Thanks, maybe I misunderstood the implementation... I will read through your links and see if that helps for a solution.

@roydekleijn
Copy link
Author

Weird, my servo is not moving on the M3 and M5 commands..

@MeJasonT
Copy link

Please can you send details of the servo you are using and how you are connecting it.

@roydekleijn
Copy link
Author

roydekleijn commented Mar 26, 2019

Sure, I tried both SG90 and MG90S. Connecting to 5V and GND and the yellow wire to pin Z+ and Z- (both gave the same result) of the cnc shield v4.

Do I need to change something in config.h?

The cnc shield v4 has also a A6,A7,D12,D13 maybe that can be of some use?

My last try was a default GRBL with only #define COREXY enabled and correct homing setting.

I use these GRBL settings:

image

@MeJasonT
Copy link

MeJasonT commented Mar 26, 2019

umm interesting, is this your board by any chance.
https://www.youtube.com/watch?v=1UKY1_hOipQ
here is a project based on the version 3 controller
http://electricdiylab.com/make-grblarduino-based-cnc-plotter-pcb-ink-plotter/

@roydekleijn
Copy link
Author

roydekleijn commented Mar 26, 2019

yes, that is my board!

CoreXY is working fine, however the servo isn't..

@MeJasonT
Copy link

Has the guy in the second link explained how he got his servo working.

@roydekleijn
Copy link
Author

I like to point also to this thread: bdring/Grbl_Pen_Servo#1 (comment)

@MeJasonT
Copy link

MeJasonT commented Mar 27, 2019

Have you tried any of the suggestions made in that thread. It sounds like the board programmed to run just a servo code works using -Z pin (pin 11 which also corresponds to GRBL Spindle ver 1.1).
It sounds like the guys in link bdring/Grbl_Pen_Servo#1 (comment) are using version 0.9 of GRBL as they are talking about the Z End stop. Just make sure you are not falling down their hole. I don't know what effect pwm has on the servo the two signals are different but many have had success without changing anything. If you happen to have a uno lying around or you can breadbord the nano so that you can connect the servo without the CNC board, Upload GRBL 1.1 to it and see what happens when you send an NC file Or just simply send Spindle commands, Min/max can be any value just remember pen up will = max and down=min (or inverted you decide). Keep the default settings - grbl will quite happily run without any hardware connected, as soon as you change the settings you end up needing limit switches connected and to home imaginary axis. Keep it simple, you can then alter Spindle speed etc to see what effect it has on the servo.

You have a choice of either Z axis Step output or Spindle output for your pen operation, Fix the decision in your mind and don't get side tracked, i did whilst typing this reply. Start talking about spindle control when what you really need is Z axis, however the spindle operation is the most straight forward as you don't need to mess with steps and acceleration settings.

If i get a chance i will set up a demo board and try it myself and pass on my findings, Unfortunately i'm a bit busy at present helping a neighbour move house and full-fill my work requirements. My good lady goes away on Saturday and suddenly my life gets easier ?

@MeJasonT
Copy link

MeJasonT commented Mar 27, 2019

https://github.com/robottini/grbl-servo Its for the older grbl version

@Ianmcmill
Copy link

@MeJasonT all your links redirect to https://github.com/grbl/grbl/issues/url or is that just me?

@franchouille77
Copy link

franchouille77 commented May 12, 2022

I had the same problem with the Sketch too big. error on arduino IDE after enabling coreXY for my CNC plotter. For this I remove a lot of code used for the spindle and coolant, and after what the sketch upload without problem. The code is here:
https://github.com/franchouille77/grbl-light-version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants
@roydekleijn @Norwegian-Gadgetman @Ianmcmill @MeJasonT @franchouille77 and others