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

Set auto fan pins to RAMPS D8 pin #4579

Closed
diegotrap opened this issue Aug 9, 2016 · 31 comments
Closed

Set auto fan pins to RAMPS D8 pin #4579

diegotrap opened this issue Aug 9, 2016 · 31 comments

Comments

@diegotrap
Copy link

diegotrap commented Aug 9, 2016

I have set the Configuration_adv.h parameters to be able to use the D8 (MOSFET) port in my RAMPS 1.4 to connect an extruder fan. This fan has to be ON whenever the hotend is working (typical case for an all metal extruder). These are the resulting lines of code:

#define EXTRUDER_0_AUTO_FAN_PIN 8 //RAMPS_D8_PIN
#define EXTRUDER_1_AUTO_FAN_PIN -1
#define EXTRUDER_2_AUTO_FAN_PIN -1
#define EXTRUDER_3_AUTO_FAN_PIN -1
#define EXTRUDER_AUTO_FAN_TEMPERATURE 5
#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed

This doesn't turn on the fan when the temperature is above 5ºC (always). I have tested it in both RAMPS_14_EFB and RAMPS_14_EFF pin maps.

I think the problem is that pin number 8 is already been used for the bed/other fan and this setting is overriden, but it should be a way to make it work. Many printers use a noisy hotend fan and it would be a great way to turn it off without disconnecting the whole printer.

@thinkyhead
Copy link
Member

What version of Marlin are you using?

@diegotrap
Copy link
Author

Marlin 1.10 RC7

On Thu, Aug 11, 2016 at 9:58 AM, Scott Lahteine notifications@github.com
wrote:

What version of Marlin are you using?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4579 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEE56SUUpYolztKSlDxzqjoarAPTdZVXks5qetYagaJpZM4JgZ6a
.

@thinkyhead
Copy link
Member

thinkyhead commented Aug 11, 2016

Do you experience the same issue with RCBugFix? I'm looking at the RAMPS pins now, and it seems that as long as you're using RAMPS_14_EFB, EEB, or EFF you should have no conflict. In fact, you ought to only have a conflict in the first 2 cases if you are also trying to use a heated bed.

Try with RCBugFix and if you still can't get it to work, post your Configuration.h and Configuration_adv.h so we can test-compile with them and figure out what's going on.

@boelle
Copy link
Contributor

boelle commented Aug 11, 2016

hmm... he might be on to something

one output cant rarely be tied to more than one pin in the pins file...

maybe test this theory by setting all FAN_PIN to -1

just a thought

@jbrazio jbrazio modified the milestone: 1.1.0 Aug 11, 2016
@thinkyhead
Copy link
Member

thinkyhead commented Aug 11, 2016

@boelle That's one way, but I have a technique to see exactly what's going on. I use the given config, and then I add pre-compiler code that checks the values of the pins I'm interested in. When I compile, I can see whether they are set to expected values or something else. If needed, I can add code to print out the values of all the pins at runtime.

@diegotrap
Copy link
Author

I have upgraded to RCBugFix and tried again, the fan still doesn't turn on. I upload the Configuration.h and Configuration_adv.h as .txt so you can replicate this error and we can learn from it.

Thank you very much for your help, thinyhead.

Configuration_adv.txt
Configuration.txt

@thinkyhead
Copy link
Member

Your configuration is good, and everything seems to be setting up correctly, so the checkExtruderAutoFans function is certainly being invoked. I'll test the auto-fan code on one of my printers in a little while, but in the meantime here's one thing you can try. In temperature.cpp change the code in the Temperature::init function that initializes EXTRUDER_0_AUTO_FAN_PIN to the following…

  #if HAS_AUTO_FAN_0
    #if EXTRUDER_0_AUTO_FAN_PIN == FAN1_PIN
      SET_OUTPUT(EXTRUDER_0_AUTO_FAN_PIN);
    #else
      pinMode(EXTRUDER_0_AUTO_FAN_PIN, OUTPUT);
    #endif
  #endif

@thinkyhead
Copy link
Member

thinkyhead commented Aug 14, 2016

I just did a test of RCBugFix both with and without that change, and it seemed to work fine. As soon as the extruder reached the configured temperature the fan came on at full speed. When the temperature fell the fan turned off. As you do your testing, double-check to make sure the fan is connected to the correct plug, and that all the wiring is good.

@boelle
Copy link
Contributor

boelle commented Aug 14, 2016

@diegotrap had any chance to test this?

@diegotrap
Copy link
Author

I have a fan connected with the right polarity to the D8 RAMPS pin. I have changed the fan, measured with a multimeter and there is no signal in that output.

Should I try all the new commits?

@diegotrap
Copy link
Author

diegotrap commented Aug 16, 2016

I have tested the latest version of RCBugFix, with the new commits related to the fans.

I still can't make it work. I have used two different RAMPS, checked all the hardware part and have not being able to get the fan to turn on.

Have you made it work with my same settings in a physical machine?

@thinkyhead
Copy link
Member

thinkyhead commented Aug 19, 2016

Have you made it work with my same settings in a physical machine?

More or less. I was easily able to override the pin and have it function on my Delta, which is also a RAMPS 1.4 variant. As I wrote above:

As soon as the extruder reached the configured temperature the fan came on at full speed.

I didn't borrow all your settings, but there aren't any other settings that could prevent the auto fan code from being invoked. You only need to set EXTRUDER_0_AUTO_FAN to something other than -1 and the code will be enabled.

Try this: Scroll down to the Temperature::checkExtruderAutoFans method in temperature.cpp and make the following change, then try and compile. It should throw the error if all is set correctly.

#if HAS_AUTO_FAN

+ #error "Yep! This code is being compiled!"

  void Temperature::checkExtruderAutoFans() {
    . . .

@Jochem77
Copy link

Jochem77 commented Aug 21, 2016

I had the same problem. But when I changed the heated bed pin in pins_RAMPS_13.h to -1 the fan turned on.

#if MB(RAMPS_13_EFF) || MB(RAMPS_13_EEF) || MB(RAMPS_13_SF)
  #define HEATER_BED_PIN   -1    // NO BED
#else
  #define HEATER_BED_PIN    -1    // BED was: 8
#endif

@thinkyhead
Copy link
Member

thinkyhead commented Aug 21, 2016

when I changed the heated bed pin

@Jochem77 What is your MOTHERBOARD setting? And are you using RCBugFix? Because it has changed the way that the MOSFET pins (Extruder, Fan, Bed, etc.) are reckoned. Based on your feedback, I'll take a look again at the pins files and make sure it's handling various cases properly.

@Jochem77
Copy link

I have 2 printers: one with a Megatronics v3.1 and one with Ramps 1.4. I have no heated bed. Extruder is connected to MOSFET D10, filament fan to MOSFET D9 and E3D extruder fan to MOSFET D8.
I'm using Marlin 1.1.0-RC6.

@thinkyhead
Copy link
Member

thinkyhead commented Aug 21, 2016

@Jochem77 I see. Since RC6 (and RC7) this has changed. Marlin RCBugFix now auto-assigns the pins based on your configuration. It presumes for Extruder-Fan-Fan setups that the Extruder is (as always) on D10, the first (PWM) Fan is on D9 and the second fan is on D8. So you should find that RCBugFix does the right thing without needing to do any pin-tweaking. If you want your extruder fan to turn on based on temperature, you can just set EXTRUDER_0_AUTO_FAN_PIN to 8, and then D8 won't be assigned to FAN1_PIN. (Just be sure with a RAMPS to use BOARD_RAMPS_EFF.)

@boelle
Copy link
Contributor

boelle commented Aug 28, 2016

@Jochem77 @thinkyhead maybe close this one as it seems fixed?

@diegotrap
Copy link
Author

I couldn't fix my issue and tried several times with your proposed solutions. Nevertheless, I don't have much more time to test this and I understand that the thread is closed.

I'll try to have a look again in the future, thanks for your help anyways :)

@thinkyhead
Copy link
Member

thinkyhead commented Aug 30, 2016

@diegotrap If you are able to collect more diagnostics on your end I'm sure we can track it down. The feature still works for me with the current RCBugFix, using BOARD_RAMPS_14_EFF and…

#define EXTRUDER_0_AUTO_FAN_PIN FAN1_PIN

The pin gets defined and then the auto fan just works.

@a29er
Copy link

a29er commented Jun 7, 2017

I have had the exactly the same problem and spent few hours solving it. It turned out that there was no input power on 10A 12V which is used by D8's MOSFET. I just connected 10A input to 5A and the problem gone.

@diegotrap
Copy link
Author

diegotrap commented Jun 8, 2017 via email

@VICLER
Copy link

VICLER commented Dec 12, 2018

Hi guys! Do you know how to enable SOFT_PWM for AUTO_FAN? In my
Configurations_adv.h :
#define E0_AUTO_FAN_PIN FAN1_PIN

and in Configurations.h :
#define FAN_SOFT_PWM

but the FAN_1 spin with standard 500Hz frequency.. I have tried to define FAST_PWM_FAN, but it does not change the PWM frequency too.

If I use #define E0_AUTO_FAN_PIN -1 in Configurations_adv.h then changing the frequency works for FAN1_PIN

@AnHardt
Copy link
Member

AnHardt commented Dec 12, 2018

The number of rotations per second of a fan does not depend on the pwm-frequency. It depends only on the relation of the on- to the off-phases - not on how often the cycle is repeated.

@VICLER
Copy link

VICLER commented Dec 12, 2018

Hi, AnHardt. With 500Hz I do not mind the rps of the fan, but PWM frequency on FAN1_PIN Output. The FAN_SOFT_PWM or FAST_PWM_FAN does not work for FAN_PIN assigned to AUTO_FAN_PIN. It seems that If I define AUTO_FAN it runs only with standard analogWrite(). I want to change pwm frequency cause this 500hz are very annoying..

@thinkyhead
Copy link
Member

thinkyhead commented Dec 12, 2018

FAN_SOFT_PWM … does not work for FAN_PIN assigned to AUTO_FAN_PIN

Correct. At this time FAN_SOFT_PWM is not implemented for the auto fans, but only for the three fans which are controlled by M106.

@VICLER
Copy link

VICLER commented Dec 13, 2018

FAN_SOFT_PWM … does not work for FAN_PIN assigned to AUTO_FAN_PIN

Correct. At this time FAN_SOFT_PWM is not implemented for the auto fans, but only for the three fans which are controlled by M106.

What a pity.. Then I have an another solution for me, but I need your help. I want to turn the FAN1 on by turning on my 3D printer. Can I just set the pwm value for that FAN_PIN in loop() function? What for function do I need for setting the pwm value if I want to use SOFT_PWM? Thanks in advance!

Edit:
So it works now with "fanSpeeds[FanNumber] = val;" inside main loop()

@thinkyhead
Copy link
Member

thinkyhead commented Jan 3, 2019

So it works now with "fanSpeeds[FanNumber] = val;" inside main loop()

That's a fine solution. To use fewer CPU cycles, you might move it to manage_heaters instead.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

2 similar comments
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

bhavin192 added a commit to hemrobotics/reprap-printer that referenced this issue Jul 31, 2021
RAMPS_D9_PIN: FAN_PIN (part cooling fan)
RAMPS_D8_PIN: FAN1_PIN (extruder / hot end fan), set as auto fan pin
	      to turn on the fan when hot end reaches 50°C.

MarlinFirmware/Marlin#3234 (comment)
MarlinFirmware/Marlin#4579 (comment)
https://www.youtube.com/watch?v=0W3VQpL0e8g

Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
bhavin192 added a commit to hemrobotics/reprap-printer that referenced this issue Jul 31, 2021
RAMPS_D9_PIN: FAN_PIN (part cooling fan)
RAMPS_D8_PIN: FAN1_PIN (extruder / hot end fan), set as auto fan pin
	      to turn on the fan when hot end reaches 50°C.

MarlinFirmware/Marlin#3234 (comment)
MarlinFirmware/Marlin#4579 (comment)
https://www.youtube.com/watch?v=0W3VQpL0e8g

Signed-off-by: Bhavin Gandhi <bhavin7392@gmail.com>
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants