Where to get & where to place best Arduino & Marlin

Ask the MakerGear community for assistance...
Dale Reed
Posts: 376
Joined: Thu Apr 10, 2014 1:39 am
Location: Cleveland Heights, Ohio USA

Re: Where to get & where to place best Arduino & Marlin

Post by Dale Reed » Tue Jan 27, 2015 4:44 am

Jin and all,

Yep. You want the software PWM for fans. Following are my personal mods to Configuration.h and Configuration_Adv.h (my personal mods to cmenard's Marlin branch dated 24 Mar 2014). These were for my V3B hot end, before I got on the beta for the dual extruder. That's why the branch it's derived from is almost a year old -- when I did the upgrade from 12/19 volt to 24 volt operation.

Configuration.h:

DEFAULT values of PID constants. I did a quick autotune, rounded the gains down to keep them conservative, and put them in the firmware, so even if I do a revert to factory settings, they'll still be reasonably close. These are overridden by doing an autotune, then a write of parameters, then a save to EEPROM with M500:

Code: Select all

// MakerGear
//    #define  DEFAULT_Kp 7.0
//    #define  DEFAULT_Ki 0.1
//    #define  DEFAULT_Kd 12

// DALE'S AUTOTUNE VALUES FOR 24 VOLT MAKERGEAR M2
#define DEFAULT_Kp 26.00
#define DEFAULT_Ki 2.00
#define DEFAULT_Kd 86.00s
I have enabled PID control of bed temperature:

Code: Select all

// Uncomment this to enable PID on the bed. It uses the same frequency PWM as the extruder.
// If your PID_dT above is the default, and correct for your hardware/configuration, that means 7.689Hz,
// which is fine for driving a square wave into a resistive load and does not significantly impact you FET heating.
// This also works fine on a Fotek SSR-10DA Solid State Relay into a 250W heater.
// If your configuration is significantly different than this and you don't understand the issues involved, you probably
// shouldn't use bed PID until someone else verifies your hardware works.
// If this is enabled, find your own PID constants below.

// DALE ENABLED BED TEMPERATURE PID!
#define PIDTEMPBED
And I did a quick autotune of the bed temperature and saved those DEFAULT (restore to factory defaults) values, too :

Code: Select all

//  #define  DEFAULT_bedKp 10.00
//  #define  DEFAULT_bedKi .023
//  #define  DEFAULT_bedKd 305.4

// DALE'S AUTOTUNE VALUES FOR 24 VOLT MAKERGEAR M2
#define  DEFAULT_bedKp 210.0
#define  DEFAULT_bedKi 8.0
#define  DEFAULT_bedKd 1360.0
I do not have the Viki LCD panel, so this line stays commented out:

Code: Select all

// Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs

// DALE'S MAKERGEAR M2 DOESN'T HAVE A VIKI LCD!
//#define LCD_I2C_VIKI
And here's the magic code to do soft PWM for fan speed control Note especially the SOFT_PWM_SCALE #define value!!!

Code: Select all

// Use software PWM to drive the fan, as for the heaters. This uses a very low frequency
// which is not ass annoying as with the hardware PWM. On the other hand, if this frequency
// is too low, you should also increment SOFT_PWM_SCALE.

// DALE'S M2 USES 24 VOLT FANS WITH SLOW (123 Hz) PWM!!!
#define FAN_SOFT_PWM

// Incrementing this by 1 will double the software PWM frequency,
// affecting heaters, and the fan if FAN_SOFT_PWM is enabled.
// However, control resolution will be halved for each increment;
// at zero value, there are 128 effective control positions.
#define SOFT_PWM_SCALE 4
Configuration_Adv.h

I changed my idle time (before the stepper motors drop power, dropping the bed) to 5 minutes. (Changing this to zero disables the timeout, I believe...)

Code: Select all

//default stepper release if idle
// DALE SET THIS TO 5 MINUTES FOR HIS MAKERGEAR M2!!!
#define DEFAULT_STEPPER_DEACTIVE_TIME 600
As you see, I identify my changes to these header files with my name in the comments, so I can find them later (like now, to enumerate them for you!). Also, I've tried to include enough code before my changes so you can easily find the section in each header file to modify. Sorry if that made this post annoyingly longer. But I hope if makes stuff clear so you don't mess up...

Hope this helps!
YMMV, of course...

Dale

User avatar
insta
Posts: 2000
Joined: Tue Sep 16, 2014 3:59 am

Re: Where to get & where to place best Arduino & Marlin

Post by insta » Tue Jan 27, 2015 5:45 am

600 seconds is 10 minutes, Dale 8-)
Custom 3D printing for you or your business -- quote [at] pingring.org

User avatar
jimc
Posts: 2888
Joined: Wed Apr 09, 2014 11:30 pm
Location: mullica, nj
Contact:

Re: Where to get & where to place best Arduino & Marlin

Post by jimc » Tue Jan 27, 2015 1:45 pm

Alit of the #s in the firmware are double. Its like a 1/2 step

Dale Reed
Posts: 376
Joined: Thu Apr 10, 2014 1:39 am
Location: Cleveland Heights, Ohio USA

Re: Where to get & where to place best Arduino & Marlin

Post by Dale Reed » Tue Jan 27, 2015 5:47 pm

insta wrote:600 seconds is 10 minutes, Dale 8-)
Yeah, I changed the time but not the comment. (Five minutes turned out to be not enough.) Just another "I.D.-ten-T" documentation error.
That's why they don't let me write main-trunk firmware! :lol: I'm an engineer, so it's within a factor of 2. If I were a physicist, it would still be valid if it were accurate within two orders of magnitude.

User avatar
insta
Posts: 2000
Joined: Tue Sep 16, 2014 3:59 am

Re: Where to get & where to place best Arduino & Marlin

Post by insta » Tue Jan 27, 2015 6:08 pm

Dale Reed wrote:
insta wrote:600 seconds is 10 minutes, Dale 8-)
Yeah, I changed the time but not the comment. (Five minutes turned out to be not enough.) Just another "I.D.-ten-T" documentation error.
That's why they don't let me write main-trunk firmware! :lol: I'm an engineer, so it's within a factor of 2. If I were a physicist, it would still be valid if it were accurate within two orders of magnitude.
That incidentally is why I don't like comments in code...
Custom 3D printing for you or your business -- quote [at] pingring.org

Lateralg
Posts: 138
Joined: Mon Apr 14, 2014 8:21 am

Re: Where to get & where to place best Arduino & Marlin

Post by Lateralg » Wed Jan 28, 2015 6:36 pm

What software do you use to edit configuration.h? Notepad, Wordpad, ??

Also, when finished with edit, in what format (file extension) is required?
Gary
Make Better Things
Make Things Better

User avatar
jimc
Posts: 2888
Joined: Wed Apr 09, 2014 11:30 pm
Location: mullica, nj
Contact:

Re: Where to get & where to place best Arduino & Marlin

Post by jimc » Wed Jan 28, 2015 7:12 pm

Gary you download arduino from their website

Lateralg
Posts: 138
Joined: Mon Apr 14, 2014 8:21 am

Re: Where to get & where to place best Arduino & Marlin

Post by Lateralg » Wed Jan 28, 2015 8:10 pm

Jim,

No problem getting it. problem is in editing configuration.h, saving, then uploading without getting the red error message. I think I've found the answer ... use external editor Notepad++. I'm going to try the following:

use File > Preferences "Use External Editor". It makes the code non-editable in Arduino. Then you can use whatever editor you prefer. To compile and upload, save in your editor, then click the upload button on the non-editable Arduino window. It will read the files before compiling. If you watch the grayed-out window, the code will update to whatever you've edited, right before it compiles and uploads.

I'll let you know outcome.
Gary
Make Better Things
Make Things Better

Lateralg
Posts: 138
Joined: Mon Apr 14, 2014 8:21 am

Re: Where to get & where to place best Arduino & Marlin

Post by Lateralg » Wed Jan 28, 2015 10:22 pm

It's been long enough for me to forget how simple it is to make these edits. I didn't go the external editor route ... no advantage for the few edits I needed.

I'm all set ... for now. Thanks for listening.
Gary
Make Better Things
Make Things Better

Dale Reed
Posts: 376
Joined: Thu Apr 10, 2014 1:39 am
Location: Cleveland Heights, Ohio USA

Re: Where to get & where to place best Arduino & Marlin

Post by Dale Reed » Thu Jan 29, 2015 1:19 am

Gary,

I do all my firmware dinking in Linux Mint, and if I'm not opening the files within the Arduino IDE, I use gedit (standard text editor) for these files. The ".h" extension indicates these are C / C++ "header" files, where you put definitions of compile-time constants (#define) and prototypes of the function calls ( int function_name(int parameter1, float parameter2); ) --- stuff like that.

The Arduino IDE is already in the Mint "Software Manager" -- just open Software Manager from the Mint Menu "Administration" group, search Arduino, select it, and click install.

Sorry I can't help you Windoze users much. I would've expected to be able to edit .h files (and .c files, for that matter) in Notepad... they're just plaintext.

Dale

Post Reply