β€Ί β€Ί

[Working] Automatically turn on the hotend cooling fan when hot.

eyeseyes Posts: 70🌟 Super Member 🌟
edited December 2019 in Modifications & Upgrades
I am trying to set the extruder cooling fan to turn on when the extruder reaches a certain temperature. This is how you do it:
******************************************************************************************************************************
// Extruder cooling fans
// Configure fan pin outputs to automatically turn on/off when the associated
// extruder temperature is above/below EXTRUDER_AUTO_FAN_TEMPERATURE.
// Multiple extruders can be assigned to the same pin in which case
// the fan will turn on when any selected extruder is above the threshold.
#define EXTRUDER_0_AUTO_FAN_PIN 11
#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 50
#define EXTRUDER_AUTO_FAN_SPEED   255  // == full speed

If your board only has one FAN port then you must #undef FAN_PIN and #define EXTRUDER_0_AUTO_FAN_PIN to that pin.

In a nutshell FAN_PIN is the blower fan, EXTRUDER_X_AUTO_FAN_PIN is the cooling fan for cold part of the hotend.

************************************************************************************************************************************

The pinout shows the fan pin as PA1 and it is located at the mosfet. Can someone show me exactly where this is on the board? And if anyone has tried this does it work?

Post edited by eyes on

Comments

  • Samuel PinchesSamuel Pinches Posts: 2,585Administrator
    I'm not 100% sure what you are asking.

    I put the full pinout on the wiki: https://jgaurorawiki.com/a5s

    You can use the datasheet to identify the pin on the CPU.




  • eyeseyes Posts: 70🌟 Super Member 🌟
    I knew the pinout was available but didn't know exactly where it was on the board. I am trying to make the hotend fan come on when it reaches 50C then turn off when it cools back off. It works on the SKR v1.3 so I think I can get it working here too. I just needed to know where to connect the fan. I'll let you know if I get it working. Where is the datasheet?
    Thank you. 
  • Samuel PinchesSamuel Pinches Posts: 2,585Administrator
    The proceessor on the board is the STM32F103ZET6 - googling that gives you the datasheet from ST: https://www.st.com/resource/en/datasheet/cd00191185.pdf

    Here's the STM32F103ZET6 pinout below for this package, from page 27. The left side of the pinout is the bottom edge of the chip in the board photo above. In the board photo above, that dot in the bottom left corner corresponds to the top left corner with the #1 pin in the pinout below.





    Thanked by 1eyes
  • eyeseyes Posts: 70🌟 Super Member 🌟
    Thank you. I didn't know you meant the datasheet for the processor. That is a lot of info. 
  • eyeseyes Posts: 70🌟 Super Member 🌟
    I think I may need to control the white 24v plug labeled J21 on the board. It's above the red fan plug. Is there a pin associated with this plug? I'm not near the printer but if I recall correctly the red plug is the part cooling fan and the white plug is the extruder cooling fan. That is the one I want to control. 

    I'm sorry to keep asking but I don't see how to determine from your pinout diagram where each pin is on the board. I don't know how to figure that out from the datasheet either.

    Thank you again for your help.
  • Samuel PinchesSamuel Pinches Posts: 2,585Administrator
    edited October 2019
    I'm happy to help - unfortunately that white socket is just what is labelled - it is 24V, it is not controllable, and it is not connected to the CPU.

    If you want to control the part cooling fan you need to:
    1. choose a new, unused pin from the pinout on the wiki. Rather than trying to solder a wire directly to the cpu with it's tiny pins, the easier option would be to select a pin for the SRAM - which is not populated. There are a lot of pins to choose from there. I suggest PF4 or PF5. PF4 is the pin 1 on the SRAM pads, and pin one is indicated by that white circle. PF4 is the SRAM pad closest to that circle.
    2. purchase an external mosfet. Solder the signal pin to the selected pin you chose in step 1. I suggest to put hot glue over the solder joint afterwards, as the pad is mechanically weak. You may even want to solder an extra wire for the BLtouch mod, while you're at it.
    3. wire up mosfet to gnd and +24V, and wire the fan to the output of the mosfet.
    4. configure firmware to set that new pin as an additional fan, and configure the desired behaviour of that fan.

    Thanked by 1eyes
    Post edited by Samuel Pinches on
  • eyeseyes Posts: 70🌟 Super Member 🌟
    Thank you for the detailed instructions. I already have the bltouch wired and working so I will use one of the additional pins for this. I already have mosfets that I used with my anet board before the USB stopped working on it. For activating the mosfet just use my pin and a ground right? I assume the pins are positive output? 

    I have never used it but I wonder if one of the pins on sram could be used for the filament runout sensor? I may go ahead and solder an extra pin for possible future use. Who know what other cool features may be hiding in Marlin 2.0!

    Thank you again!
  • Samuel PinchesSamuel Pinches Posts: 2,585Administrator
    edited October 2019
    The mosfet will need a signal, a ground, and power in (24V). The pins are +ve output but they are very weak, they cannot power a fan, which is why a mosfet is needed.

    The filament run out sensor pin should be possible to get working in the future without any extra rewiring. It just needs some troubleshooting in the firmware.

    Best of luck!
    Thanked by 1eyes
    Post edited by Samuel Pinches on
  • eyeseyes Posts: 70🌟 Super Member 🌟
    Thank you. If I get it working I'll add instructions in case anyone else wants to set it up.
    Thanked by 1Samuel Pinches
  • eyeseyes Posts: 70🌟 Super Member 🌟
    This mod will keep the hotend cooling fan off until it reaches 50C. You will need a relay and DC buck converter. I am using this buck converter https://www.amazon.com/gp/product/B01GJ0SC2C/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
    and this relay https://www.amazon.com/gp/product/B07L6JXGXV/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
    or if want more than 2 this one. https://www.amazon.com/gp/product/B07GBS62GX/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

    The DC converter input is connected to the 24V power supply. You then adjust it so it outputs 3.3V - this matches the output of the pin used on the board. You will need to solder a wire to pin PG2 on the SRAM. The out put from your buck converter attaches to the VCC and GND on the relay- positive to VCC and negative to GND. Then the wire from pin PG2 connects to IN. The other end of the relay is where you connect your fan.This is the fan that plugs into the white 2 pin connector labeled 24V. This plug will be left unused when you are finished. We will use the COM and NO connections on the other end of the relay.You will need to cut the plug off of your fan wire and strip the ends. Connect the black wire to negative on the power supply. Connect the red wire to the NO on the relay. Then connect another wire from the positive on the power supply to the COM on the relay.

    Next you need to edit configuration.adv.h:

    Find 

    #define E0_AUTO_FAN_PIN -1
    #define E1_AUTO_FAN_PIN -1
    #define E2_AUTO_FAN_PIN -1
    #define E3_AUTO_FAN_PIN -1
    #define E4_AUTO_FAN_PIN -1
    #define E5_AUTO_FAN_PIN -1
    #define CHAMBER_AUTO_FAN_PIN -1

    and change it to 

    #define E0_AUTO_FAN_PIN PG2 //white wire soldered to SRAM - goes to relay
    #define E1_AUTO_FAN_PIN -1
    #define E2_AUTO_FAN_PIN -1
    #define E3_AUTO_FAN_PIN -1
    #define E4_AUTO_FAN_PIN -1
    #define E5_AUTO_FAN_PIN -1
    #define CHAMBER_AUTO_FAN_PIN -1

    This is where you set the auto on temperature if you want a value other than 50C

    #define EXTRUDER_AUTO_FAN_TEMPERATURE 50
    #define EXTRUDER_AUTO_FAN_SPEED 255   // 255 == full speed

    Compile and upload and your fan will be quiet until your hotend reaches 50C. After your print it will turn off once it goes below 50. If you have your printer on most of the time like me you will appreciate a silent printer when not in use!

    I will post photos when I get a chance. I put my printer back together and forgot to take pictures!


    Thanked by 1Samuel Pinches
Sign In or Register to comment.