Brushless motor spindle

316 views
Skip to first unread message

Martin Gava

unread,
Apr 26, 2014, 12:32:17 PM4/26/14
to cyclone-p...@googlegroups.com
Buenas, antes que nada me presento. Mi nombre es Martin Gava, soy de Uruguay y aficionado a la electrónica
Tengo construida una CNC con electrónica Ramps 1.4, Arduino mega, Motores Nema17, Spindle brusless 5055-720kv 80A y gracias a este fantástico trabajo la estoy pudiendo hacer andar.

Cuando arranque este proyecto me propuse usar LInuxCNC con el Hal2Arduino pero por problemas en la velocidades de los motores desistí y busque otras alternativas. una de ellas era GRBL pero no es compatible con Arduino Mega ya que los motores tienen que estar todos dentro del mismo bus y en Ramps 1.4 estan todos en distintos bus. Buscando alternativas decidí usar Marlin y modificarlo para que funcione como una CNC y no una impresora 3D.

Hasta ahí funcionaba todo perfecto salvo por el nivelado de la cama, por lo cual opte por habilitar Autolevel pero al realizar el fresado en PCB no me quedaban nunca bien.

Buscando en internet me encontré con Cyclone PCB y realmente me pareció fantástico. 

Lo configure para Ramps, modifique los datos de los motores ya que uso micropasos y no tengo engranajes y arrancaron las pruebas.
La maquina funciona de maravillas y el nivelado es perfecto, por lo cual esa tarea para mi estaba terminada, solo quedaba hacer funcionar el spindle brushless el cual utiliza la librería Servo.h y dentro de los archivos de Cyclone PCB no se encuentran, por lo cual copie los 2 archivos de marlin (Servo.h y Servo.cpp) a Cyclone PCB y configure todo tal cual lo tenia con marlin.

Mi problema esta en que simplemente con colocar #include "Servo.h" y Servo Spindle; ya me da un error en la compilación

Marlin_main.cpp.o: In function `_GLOBAL__sub_I_Spindle':
Marlin_main.cpp:50: undefined reference to `Servo::Servo()'
/usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr6/crtm2560.o: In function `__bad_interrupt':
../../../../crt1/gcrt1.S:195: relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_53' defined in .text section in /usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr6/crtm2560.o
collect2: error: ld returned 1 exit status

Vale aclarar que abriendo los ejemplos de servo en arduino funciona sin problema.

Alguna idea sobre esto? estaria eternamente agradecido.

Disculpen que no escribo en ingles pero lamentablemente no se el idioma igualmente dejo copia traducida en google

--------------------------------------------

Sorry is a translation of google .

Hi, first of all I introduce myself . My name is Martin Gava , I'm from Uruguay and amateur electronics
I have built a CNC machine with electronic Ramps 1.4 Arduino mega, Nema17 Motors , Spindle brusless 5055 - 720kv 80A and thanks to this fantastic job I can do the walk.

When starting this project I decided to use LinuxCNC Hal2Arduino but problems with motor speeds gave up and look for other alternatives. one was GRBL but is not compatible with Arduino Mega because the engines have to be all in the same bus and Ramps 1.4 are all in different bus. Seeking alternatives Marlin decided to use and modify it to work as a CNC and not a 3D printer.

So far everything worked perfect except for the level of the bed, which enable Autolevel but chooses to perform milling PCB I never fit well .

Searching the internet I found Cyclone PCB and I really thought it was fantastic .

The set for Ramps , modify data as microstepping motors and I do not use gears and pulled the tests.
The machine works great and the level is perfect , so the task for me was over , there was only operate the brushless spindle which uses Servo.hy Seller within Cyclone PCB files not found , so copy the 2 files marlin ( Servo.hy Servo.cpp ) Cyclone PCB and configure everything as they had with marlin .

My problem is that simply put # include " Servo.h " Servo and Spindle ; and gives me an error in the compilation

Marlin_main.cpp.o : In function ` _GLOBAL__sub_I_Spindle ' :
Marlin_main.cpp : 50 : undefined reference to ` Servo :: Servo () '
/ usr/lib/gcc/avr/4.7.2/../../../avr/lib/avr6/crtm2560.o : In function ` __bad_interrupt ' :
../../../../crt1/gcrt1.S : 195 : relocation truncated to fit: . R_AVR_13_PCREL __vector_53 against symbol ` ' defined in text section in / usr/lib/gcc/avr/4.7.2 / ../../../avr/lib/avr6/crtm2560.o
collect2 : error : ld returned 1 exit status

Worth mentioning that opening examples in arduino servo works without problem.

Any thoughts on this ? would be eternally grateful.

Samuel Kranz

unread,
Apr 26, 2014, 1:02:01 PM4/26/14
to cyclone-p...@googlegroups.com
Hi, welcome to our group:)

Would you mind posting some parts of your code?

Daniel "yOPERO" Garrido

unread,
Apr 26, 2014, 1:15:56 PM4/26/14
to cyclone-p...@googlegroups.com
Hola Martin  Bienvenido al grupo!

Welcome to the group!

I think this line:

Marlin_main.cpp:50: undefined reference to `Servo::Servo()'

is telling you that you do not have the Servo library in your arduino environment, Try installing it and make sure it works alone before trying it out with marlin.

Martin Gava

unread,
Apr 26, 2014, 10:02:03 PM4/26/14
to cyclone-p...@googlegroups.com
Paso parte del código como me lo pidieron, igual no hay misterio ni nada raro.


-----------Mariln_main.cpp------------

#include "Marlin.h"

#include "ultralcd.h"
#include "planner.h"
#include "stepper.h"
#include "temperature.h"
#include "motion_control.h"
#include "cardreader.h"
#include "watchdog.h"
#include "ConfigurationStore.h"
#include "language.h"
#include "pins_arduino.h"
#include "Servo.h"

#if DIGIPOTSS_PIN > -1
#include <SPI.h>
#endif

#define VERSION_STRING  "1.0.0"

Servo Spindle;
---------------------------------------------------
yOPERO entiendo lo que dices, pero la librería en arduino vienen por defecto, igualmente copie las librerías que traía marlin dentro de Cyclone_PCB

No importa cual use <Servo.h> o "Servo.h" el error es el mismo

Ya lo probé con 2 sistemas operativos diferentes y da el mismo problema en los dos.

Adjunto algunas imagenes

------------------------------------------------------------------------------------------------

Google translator 

Step of the code as they asked me, as there is no mystery or anything weird. 


----------- Mariln_main.cpp ------------ 

# include "Marlin.h" 

# include "ultralcd.h" 
# include "planner.h" 
# include "stepper.h" 
# include "temperature.h" 
# include "motion_control.h" 
# include "cardreader.h" 
# include "watchdog.h" 
# include "ConfigurationStore.h" 
# include "language.h" 
# include "pins_arduino.h" 
# include "Servo.h" 

# if DIGIPOTSS_PIN> -1 
# include <SPI.h> 
# endif 

# define "1.0.0" 

Servo Spindle; 
-------------------------------------------------- - 
yOPERO understand what you say, but the library in arduino come by default, copy the libraries also brought marlin within Cyclone_PCB 

No matter what use <Servo.h> or "Servo.h" error is the same 

Already tried it with 2 different operating systems and gives the same problem in both. 

Attached are some pictures

Samuel Kranz

unread,
Apr 27, 2014, 6:01:02 AM4/27/14
to cyclone-p...@googlegroups.com
Have you tried to import the library to your project? Copying the servo.h an .cpp files to your project directory?

Samuel Kranz

unread,
Apr 27, 2014, 6:11:45 AM4/27/14
to cyclone-p...@googlegroups.com
And have you connected your BL-controller to a Hardware-PWM Output? .. Standard Arduino Servo Library works only with HardwarePWM Outputs.
If you connected the BL-contrller to a non pwm output maybe you can use this library: SoftwareServoLibrary

Martin Gava

unread,
Apr 27, 2014, 8:03:42 PM4/27/14
to cyclone-p...@googlegroups.com
Ya probé de todas las formas y no hay caso, siempre me da un error, hasta estuve probando en diferentes versiones de Arduino IDE y lo mismo.

Alguno podría hacer el intento desde su equipo agregando en Marlin_main.cpp #include <Servo.h> y Servo Spindle; a ver si les compila?

Samuel, el pin que estoy usando es el pin digital 6, el cual es PWM y tambien habia intentado con SoftwareServoLibrary


-------------------------------

Already tried all ways and no case always gives me an error until I was testing on different versions of Arduino IDE and the same. 

Some might make the attempt from your computer by adding in Marlin_main.cpp #include <Servo.h> and Servo Spindle; to see if they compile? 

Samuel, the pin I'm using is the digital pin 6, which is PWM and also had tried SoftwareServoLibrary

Samuel Kranz

unread,
Apr 28, 2014, 2:27:12 AM4/28/14
to cyclone-p...@googlegroups.com
Hmm.. Can you upload your code somewhere so i can try to compile it by myself?

Martin Gava

unread,
Apr 28, 2014, 9:02:07 AM4/28/14
to cyclone-p...@googlegroups.com
Gracias por su ayuda

Thanks for your help
Cyclone-PCB.zip

Samuel Kranz

unread,
Apr 28, 2014, 5:56:25 PM4/28/14
to cyclone-p...@googlegroups.com
Try this.. 


Marlin.zip

Samuel Kranz

unread,
Apr 28, 2014, 5:57:58 PM4/28/14
to cyclone-p...@googlegroups.com
Unfortunately I haven't got an Arduino MEGA so I couldn't test it :(

Martin Gava

unread,
Apr 28, 2014, 9:09:45 PM4/28/14
to cyclone-p...@googlegroups.com
No se que fue lo que hiciste pero funciono.

Estoy realmente agradecido.

Podrías contarnos que cambios realizaste?

Gracias 

En estos dias subo fotos de la maquina y de algun resultado

----------------------------

That is not what you did but it worked. 

I am truly grateful. 

You could tell us what changes you made? 

thanks 

These days I upload some pictures of the machine and some result

Samuel Kranz

unread,
Apr 29, 2014, 3:36:13 AM4/29/14
to cyclone-p...@googlegroups.com
I replaced your servo library and excluded the timer1 .. Marlin uses the Timer1 for the steppermotors so there was a redefinition of it in the stepper library.
Reply all
Reply to author
Forward
0 new messages