Introduction: Sbase/Smoothieware - Use a Free PWM Pin and Power Expander or SSR to Control Fans.
Running out of available spots to attach a heated bed, hotend or a fan we do thankfully have the option to use one of the General Purpose Input/Output (GPIO) pins on the MKS Sbase and combine it with a Solid State Relay (SSR) to power the attached device.
Please correct me if I use the GPIO term in error here. I am not educated in electronics :)
Why PWM pin
I am going to use a PWM pin to control some 12v fans on my 24v system and need the ability to adjust them up and down and not just on and off.
If we just wanted to turn them on and off, we could use the analog pins on the upper left corner of the board, labeled J8. One of them is a Gnd as well, making it really easy to set up.
At a later point, in the very near future, I am going to make another instructable using a standard SSR and one of the non-PWM pins to turn an attached fan or led on and off.
Step 1: Finding an Available PWM Pin
Aside from the PWM pins allready packed with a Mosfet (heaters and fan outputs) our EXT2 output has 2 PWM outpus and we also have one in our J8 pin group in upper left corner and an unused one from E1, unless you use all 5 drivers.
PWM-pins list and location
- P1.23 - J8 pin upper left corner
- P2.12 - E1 - Epsilon external driver pins. Upper right-ish corner.
- P3.25 - EXP2 lower right side where an LCD might go.
- P3.26 - EXP2 lower right side where an LCD might go.
See the photo for exact location.
Note:If you are using a SmartController (LCD) it is connected to the EXP2 and you can not use these PWM pins for other things. They are used to turn the controller back and forth
Step 2: Configuring Smoothieware to Use New Pin
Configuring firmware is one of the easy things when we talk Smoothieware.
In my photo I have listed all of our available PWM pins and uncommented the ones I do not use.
You can see how I have uncommented the standard FAN pin 2.4 and enabled the pwm pin on E1; 2.13.
Now we just need to do the wiring.
Step 3: Wiring Sbase to Use Our New Settings
PWM pins on Sbase delivers 3.3v or so and is considered + in regards to wiring.
Note: I recommend using wires easily recognizeable when doing electrical and electornical things. Like red for power/+/vin and black for -/gnd.
Sbase to Power Expander
Now simply connect your red dupont wire to the PWM P2.13 and lead it down to the signal/control + on the Power Expander. Do the same for your black wire from GND to -.
I use a smallish 12v 3amp DC-DC converter which I have configured to give 12v output. I draw wires from + and gnd to the Power Expanders input + and - respectively
Note: Do use a converter with more amperage than you want. Many out there are much lower than this 3amp version.
Note: if you are going to use the same voltage as you have in your system in generel: meaning you just use PowerExpander as a sort of Mosfet to add an extra device, you just skip the DC-DC converter.
Now you simply draw lines from +/- output to your fan. I recommend you do a measuring using Multimeter while setting output speed on your fan.
Instead of just twisting your wires, I recommend finding some sort of pin to terminate it with instead. I mostly just use the male dupons pin which can be bought very cheaply, for these thin wires. Then put some heatshrink on it to cover exposed metal.
I use some larger pins for my bigger wires, but do not know the name of those, as I buy them locally.
Now your all set up, and everytime your controller starts the fan, it is going to activate the PowerExpander, which will power the fans with 12v instead of our normal 24v :)