adding a third fan to ramps1.4 for pwm


I am looking for assistance to add a third fan using a servo pin on ramps 1.4.

I don’t actually plan to use it as a fan but rather for pwm to control router speed via marlin.

I have ramps 1.4 board with the dual endstops firmware.

I previously changed the marlin firmware to the EFF configuration. I can switch 12v relays on and off for fan0 and fan1 with manual gcode (e.g. for fan 0, M106 P0 S255 to turn on and M106 P0 S0 to turn off fan0 from repetier host). I use those relays to switch the shopvac power and turn the dewalt router on and off.

I have tried to use pin 6 (one of the servo pins on ramps board, it is the second from the left on the top row of servo rail) for the third fan.

In the file “pins_RAMPS.h” I made the following edits:

I added

#define FAN2_PIN 6

and I deleted the definition of pins for servo use:

#ifdef IS_RAMPS_13
#define SERVO0_PIN 7 // RAMPS_13 // Will conflict with BTN_EN2 on LCD_I2C_VIKI
#define SERVO0_PIN 11
#define SERVO1_PIN 6
#define SERVO2_PIN 5
#ifndef SERVO3_PIN
#define SERVO3_PIN 4
I saved this change and then compile and upload the marlin firmware to the board.

I then use a Dupont connectors to connect pin 6 on ramps to the anode of an LED , with a 220 ohm resistor attached to ground ( 2 pins below D6 on ramps) on the cathode leg of the LED, to try to have a test circuit to see if things are working right. As a positive control, using a usb power supply for 5V and ground instead of the pin 6 and the ramps ground on the circuit it works correctly and the led lights up brightly.

After I connect to the board with repeater host, when I try to modulate the brightness of led with M106 P2 S255, there is no increased brightness. Or, if I just hook up the ramps ground and pin 6 pwm wire to a voltmeter and try M106 P2 S255 or M106 P2 S0 there is no change in the voltage reading. The fan0 and fan1 I can control and continue to work correctly.

Thank you for your assistance



I was able to get it to work by moving the pwm output to pin 4 on ramps 1.4 board

and using

M42 P4 S255

with variations of S giving different brightness of the led

rather than using the fan command M106

That is the easiest way, you can also look into my newer firmware it has some of this built in with a few configurable features in config_adv.h specifically for speed control.

1 Like