Welcome! Log In Create A New Profile

Advanced

Arduino CNC Shield V3.0

Posted by DR1983 
Arduino CNC Shield V3.0
May 14, 2014 02:32PM
Hi all. I purchased this nifty board from ebay recently and am planning on installing it on one of my printers.
[blog.protoneer.co.nz]

However, I am having some trouble locating a different firmware from GRBL.
I would like to configure this board to use marlin firmware if possible. This is due to me having another printer setup and keeping the same software.

Would anyone be able to assist with this? I assume that I have to change the pins.h file and or create a define section for my board. I will try to add any details I change in my copy of marlin here for future reference. I am attaching images of this board with the pinout. The board connects to an arduino uno.





I understand that I may have to add external temp controller, and I have a max6675 I can attach for a heated bed. I am willing to purchase another unit if needed.

I hope we can all collaborate and make it easier for anyone else who would like to go that route.
Re: Arduino CNC Shield V3.0
May 14, 2014 02:53PM
I think you want to go minimalistic on the printing pheripheals:
- temperature reading, that can work with max6675 idd. Or can also work with a thermistor + a pullup resistor and a 10uF capacitor (you can build these "in air" or on top of a 0.100' pin). Your choice.
- low side fet switches, you can mount them on a pice of aluminium, drain goes to the load (low side), sink to the psu gnd, and gate to the gpio pin. The load has V+ on high side.
- endstops, this is a short connection from gpio to the ground, and it uses the gpio pin internal pullup. If you are in dire need of pins, you can use only one pin for all endstops, connected in series, and have the carriage release each endstop after it bumps in it, so its in continuity after used. You can aslo resort at using no endstops at all, thats possible too. So imo figure out the rest and count pins, leave endstops for the end.
Thats about it smiling smiley
Re: Arduino CNC Shield V3.0
May 14, 2014 03:13PM
Thank you for the help. When I am back at home, I will look into adding the thermistor sensor as described. I may hook this board up as is during this week to start testing.

What I am trying to find is if anyone has information in regards to configuring the marlin firmware, as the board selection does not have an option for arduino cnc. I wanted to copy the pin settings but I only found grbl code in hex.

I have all the connectors needed to hookup the motors and endstops.

Thank you in advance.
Re: Arduino CNC Shield V3.0
May 14, 2014 03:46PM
I dont know if you will be able to shrink marlin size that much that will fit onto an 328. But you can certainly try, you need to start removing all stuff that is not essential until you reach a compile size that fits on 328. Just in case marling is too big, you can also try with Teacup that i think has more chances to fit on 328.

In the first top part of pins.h, there is a motherboard=99 config part (untill recently when somebody else fitted =88 on top of it). The 99 its sort of "custom", you use that, just need to copy a layout and put the pins definitions according to the images above, then you should be set for testing existing functions.

The way i see it this far:
- endstops seem to be sorted already, so can leave them at that;
- A4 and A5 seem to be sda/scl? and are also analog, so those can read 2 temps either with max6675 or with thermistors;
- the spindle enable and coolant enable seem to be on a connector which can be used to take those lines into the gates of two mosfets mounted externally (on same connector there is pin 13 i think should be avoided if i recall that has a led on it?).
So imo up to here, hardware mod is fairly clear.

Something which is probably unforseen, it is enable for all motors at once. But if you dont feel comfortable you can skip this part. As a matter of choice, i would rather use one separate enable for Z, and if its possible even for E. The Z is better if its disabled when not in use, that being 90% of the time since Z is only used for layer change. E can also be disabled when not in use, but not so important as Z. To mod that, i would use pins 0 and 1 which seem to be free, to take lines to two motors at enable (after physically cutting their existing enable tracks). To have the new enable lins set as high, i would either use hardware 10k resistors pullups to 5v, or could perhaps tweak firmware and use internal pullups on those pins.

Anyway this is what i would do, this is just to show one point of view, but you can ofc choose to do everything differently smiling smiley Anyway, have fun smiling smiley
Re: Arduino CNC Shield V3.0
May 14, 2014 03:57PM
That is exactly what I was looking for.

From my latest research, I was unsure if i had two spots for thermistors. I thought it only had one input. I am going to try and run a test compile here at work in a bit. I should be able to shrink the firmware image to fit, as I had previously cleaned up a Marlin config on a my Mendel. I did notice that teacup has the capability to be installed on the 328.

I think that I am going to try and skip the enable for all motors. If my compile works with pins.h I will upload the settings here for reference.
Re: Arduino CNC Shield V3.0
May 14, 2014 04:25PM
Aha ok, for thermistors it just have to be an analog pin, any of them that is A0 - A5 will work, i proposed A4 A5 because the rest to me looked used so dunno what is connected to them there - if anything is. If you have the board in front you can perhaps choose other pins which have nothing else connected on them. If there is anything connected to a pin already, that would change a lot of how that pin behaves and thats no good.

Thermistor pin has 2 support components, one is a 4k7 resistor to 5v and 10uF electrolitic cap to ground. Then the thermistor connects between the pin and ground, forming a voltage divider with the upper 4k7 resistor. The cap smoothens the feedback function. To test the thermistor, you can just connect any resistor instead of the thermistor, like 300 ohms one, and see that it reports a higher temp value.

To test endstops you need to short them to ground, otherwise they will be considered pressed/triggered.

If you try compile, for enable of Z and E put -1 instead of same value to all. Hope it will compile that way. In between slices Z is disabled, and E can also be disabled at times during which x and y need to move. So if Z and E are not separate, then are -1. Otherwise you can also have that common enable hardwired to ground and then motors will be always on and you basically have no software enable line and in pins.h you put all enable as -1 (for tests, but not a wise thing in practice).

Edited 1 time(s). Last edit at 05/14/2014 04:30PM by NoobMan.
Re: Arduino CNC Shield V3.0
May 14, 2014 04:57PM
Yes you can put the config files and pins.h here, and you can use "Formatted code" button from post edit toolbar, so it will be easier to read. Or better attach the entire files directly - to avoid making a great wall of text.
Re: Arduino CNC Shield V3.0
May 14, 2014 06:20PM
This is what I have configured so far. Unfortunately, I will not have the part in front of myself until a few hours from now. I have to verify if i have version 3.0, 3.02, or 3.03 as the last two i read have 2 pins which would have to be swapped.
#if MOTHERBOARD == 99
#define KNOWN_BOARD 1

#define X_STEP_PIN 2
#define X_DIR_PIN -5
#define X_ENABLE_PIN 8
#define X_STOP_PIN 9

#define Y_STEP_PIN -3
#define Y_DIR_PIN -6
#define Y_ENABLE_PIN 8
#define Y_STOP_PIN 10

#define Z_STEP_PIN 4
#define Z_DIR_PIN 7
#define Z_ENABLE_PIN 8
#define Z_STOP_PIN 11

#define E0_STEP_PIN ? --none listed via the images I provided
#define E0_DIR_PIN 13
#define E0_ENABLE_PIN 12
Re: Arduino CNC Shield V3.0
May 14, 2014 06:44PM
What that board is naming X, Y, Z, or A or E, these are just labels, could be any other letter or could be numbered, whatever. To keep most of labels we can use x as x, y as y, z as z, and then A becomes E. But thats just to avoid confusion in labels because otherwise the bottom line is that you have 4 drivers, you can use them whatever manner you like. You can use X for extruder or whatever, does not matter although it would be more confusing.

#define Z_ENABLE_PIN -1 // -1 so the firmware does not disable x and y when it wants only to disable Z

#define E0_ENABLE_PIN -1 // again -1 so firmware does not disable x and y when it wants only to disable E

These two i dont understand where they come from, but i think they are not routed anywhere and can just be wired onboard to D0 and D1.
#define E0_STEP_PIN ?
#define E0_DIR_PIN ?

Provide a link to the source files of the hardware that you have there. In image i see A-step and A-dir only in 4 connectors but not anywhere else.
Re: Arduino CNC Shield V3.0
May 14, 2014 06:57PM
Oh and also no negative pins except -1 (no -5 nor -3 no -6).

#if MOTHERBOARD == 99
#define KNOWN_BOARD 1

#ifndef __AVR_ATmega328P__
#error Oops! Make sure you have 'Arduino Duemilanove w/ ATMega328' selected from the 'Tools -> Boards' menu.
#endif

#define X_STEP_PIN 2
#define Y_STEP_PIN 3
#define Z_STEP_PIN 4

#define X_DIR_PIN 5
#define Y_DIR_PIN 6
#define Z_DIR_PIN 7

#define X_ENABLE_PIN 8
#define Y_ENABLE_PIN 8
#define Z_ENABLE_PIN -1
#define E0_ENABLE_PIN -1

#define E0_STEP_PIN 12 // or other which you can wire it onboard
#define E0_DIR_PIN 13 // or other which you can wire it onboard

#define X_MIN_PIN 9 // investigate whats the deal with the asterisk there
#define Y_MIN_PIN 10
#define Z_MIN_PIN 11

#define X_MAX_PIN -1 // max endstops are not used
#define Y_MAX_PIN -1
#define Z_MAX_PIN -1

Edited 1 time(s). Last edit at 05/14/2014 07:01PM by NoobMan.
Re: Arduino CNC Shield V3.0
May 14, 2014 07:00PM
I found this pin mapping from GRBL. Some of the pins are labeled differently. As an example,

#define SPINDLE_ENABLE_BIT 4 // Uno Digital Pin 12

I currently assigned pin 12, as it should be correct. Would this be changed in Marlin to 4 in order to work?
Attachments:
open | download - pin_map.h (7.3 KB)
Re: Arduino CNC Shield V3.0
May 14, 2014 07:10PM
From little i can gather, SPINDLE_ENABLE and SPINDLE_DIRECTION are not connected anywhere just supposed to be wired from onboard pin to drive some external hardware. In this case you can re-wire them to the onboard A-step and A-dir, because these from that picture, are also not wired anywhere else. In case that from schematic, the connectors P7-P9 and P8-P10 are close to each other, you could simply just put a jumper to connect them, this is how i would of laid it out. But i cant check the layout coz i can not find the source files. Funny coz i would of expected to be open source.

But between SPINDLE_ENABLE and SPINDLE_DIRECTION, which becomes A-STEP and which becomes A-DIR, that depends on you and how you wire them. I would suggest you wire STEP to 12 because i think 13 may have a led on it and thats no good for a step line.
Re: Arduino CNC Shield V3.0
May 14, 2014 07:16PM
Quote
DR1983
I currently assigned pin 12, as it should be correct. Would this be changed in Marlin to 4 in order to work?

No, in marlin that stays 12, as it is labeled on uno. You keep this style of notation, unless requested otherwise - e.g. usually the case with thermistors.

#define HEATER_0_PIN 0 // extruder (digital numbering)
#define HEATER_BED_PIN 1 // bed (digital numbering)

#define TEMP_0_PIN 4 // 4 is A4, this or other pin that has nothing attached to it MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_BED_PIN 5 // 5 is A5, this or other pin that has nothing attached to it MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
Re: Arduino CNC Shield V3.0
May 14, 2014 07:17PM
Thanks again. Once I am at home, I will look into changing where the pins are connected.
Here is the link to the source files as requested [github.com]

I will ensure that i dont negate any of the pins, from the picture I thought they were needed.

I also found from the source just now a file called pinmapping.txt, I believe i can use this to verify as it states it is for porting
example:
Mega328P Arduino Pin Mapping
============================
Digital 0 PD0 (RX)

I assume I can also use the second half as the pin labels correct? (PD0)

Edited 1 time(s). Last edit at 05/14/2014 07:20PM by DR1983.
Re: Arduino CNC Shield V3.0
May 14, 2014 07:22PM
No, not the source files of GRBL - i have no use for that since we use marlin. I meant the source files of the pcb board you use. The source files of Arduino CNC Shield V3.0, meaning the kicad files in which the board was designed. With the source files for the board, i can see exactly what is that board, what is on it, and what connects where, as if i have your board in my hand. Actually, i can see even better. From pictures, its just guesswork.
Re: Arduino CNC Shield V3.0
May 14, 2014 07:32PM
I dont know grbl, but does not matter if you use marlin, just leave grbl aside and to make the pins.h for marlin you need to check the hardware only. The grbl pin allocation i think uses a style to enumerate the port and the number represents which pin of that port is the pin in question. Marlin does not use that style, it just numbers all the pins as they are (why bother which port are they on). So grbl reference is not so useful, and to be frank its actually not even needed.

#if MOTHERBOARD == 99
#define KNOWN_BOARD 1

#ifndef __AVR_ATmega328P__
#error Oops! Make sure you have 'Arduino Duemilanove w/ ATMega328' selected from the 'Tools -> Boards' menu.
#endif

#define X_STEP_PIN 2
#define Y_STEP_PIN 3
#define Z_STEP_PIN 4

#define X_DIR_PIN 5
#define Y_DIR_PIN 6
#define Z_DIR_PIN 7

#define X_ENABLE_PIN 8
#define Y_ENABLE_PIN 8
#define Z_ENABLE_PIN -1
#define E0_ENABLE_PIN -1

#define X_MIN_PIN 9 // investigate whats the deal with the asterisk in the image there
#define Y_MIN_PIN 10
#define Z_MIN_PIN 11

#define X_MAX_PIN -1 // max endstops are not used
#define Y_MAX_PIN -1
#define Z_MAX_PIN -1

// following are proposals 

#define E0_STEP_PIN 12 // or other which you can wire it onboard
#define E0_DIR_PIN 13 // or other which you can wire it onboard

#define HEATER_0_PIN 0 // extruder (digital numbering)
#define HEATER_BED_PIN 1 // bed (digital numbering)

#define TEMP_0_PIN 4 // 4 is A4, this or other pin that has nothing attached to it MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
#define TEMP_BED_PIN 5 // 5 is A5, this or other pin that has nothing attached to it MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!!
This is what i think for now, at very least to test the compilation size this should suffice for being as close as possible. If you get it to compile to a workeable size then this can be further refined.

Hardware check at this stage, pins with stp/dir/en are linked to stepper drivers accordingly. And all the other pins like min/max/heaters/thermistors, should have absolutely no other circuitry on board connected to them.

Edited 1 time(s). Last edit at 05/14/2014 07:34PM by NoobMan.
Re: Arduino CNC Shield V3.0
May 14, 2014 07:49PM
To get it to compile, i also had to set the following:
#define TEMP_1_PIN -1
#define TEMP_2_PIN -1
#define LED_PIN            -1
#define PS_ON_PIN          -1
#define FAN_PIN            -1
The problem is that the compile size is 50522 bytes and it gave me "sketch too big". I did a few changes and i got to ~46.6k but there isnt much i would disable and does not seem like could get it lower. So you have your work cut out to chop the firmware down to a smaller size. I dont think it will work out with marlin, but you can certainly try. At this time i would say you should perhaps switch to teacup in which case the config file will be a little different.

Edited 1 time(s). Last edit at 05/14/2014 07:53PM by NoobMan.
Re: Arduino CNC Shield V3.0
May 14, 2014 07:53PM
I have not been able to locate the kicad files, however, I believe/hope that the Gerber files should be the same thing. [blog.protoneer.co.nz] I got this from [blog.protoneer.co.nz].

I will definitely look into teacup firmware if I cannot make the file small enough.

Edited 1 time(s). Last edit at 05/14/2014 07:54PM by DR1983.
Re: Arduino CNC Shield V3.0
May 14, 2014 08:14PM
No, gerber files are really not same thing as sources smiling smiley Since cant find the sources, then we can surely conclude that Arduino CNC Shield is obviously closed source. If the sources are available for public download, that is what open source is. If the files are not available, then its closed source. There is no middle ground with gerbers or pictures or schematics, these are not sources. Sources are the files of the program in which the design of the board was made, e.g. kicad in this case.

And the context of this is very interesting coz both grbl and arduino are open sources and 1k times more complex. Even more interesting, i dont know what the closed source could possibly protect since that has to be the most (holding back my adjectives) un-interesting cnc shield from all the variants of sorts on the market smiling smiley I dont want to be rude but i find this situation very funny smiling smiley
Re: Arduino CNC Shield V3.0
May 14, 2014 08:35PM
Thank you. I will keep this project on hold for a bit. The controller should work the way it is programmed, I wanted some of the features from Marlin for this project. Maybe I should install the mach3 software for this controller. I may still work on this on the side and give updates when I have the chance. Its weird because I can purchase a kit to build this from scratch.
Re: Arduino CNC Shield V3.0
May 14, 2014 09:33PM
If you come back later to this project, try Teacup and i am confident that it will work, probably even better than grbl, so you could have a 3d printer and a router together like that.

It is always good to have source files of electronics, its much better and clear with those at hand. Perhaps you could try writing to the seller/manufacturer and ask for source files. Worth a try imo.
Sorry, only registered users may post in this forum.

Click here to login