Sbase/Smoothieware - Use a Free PWM Pin and Power Expander or SSR to Control Fans.




Introduction: Sbase/Smoothieware - Use a Free PWM Pin and Power Expander or SSR to Control Fans.

About: I'm blogging about my projects before they make it to Once I've finished a subject on my blog, I'll put it together and post it on Instructables, so you can get a preview on my site.

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 :)

I am not going to use a standard SSR, but instead a Power Expander. I'm using the Power Expander as it is really small and more effective than any SSR out there.

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 -.

DC input

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.

DC Output

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.

Crimping wires

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.

Have fun!

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 :)



    • Metalworking Contest

      Metalworking Contest
    • Water Contest

      Water Contest
    • Tiny Home Contest

      Tiny Home Contest

    13 Discussions


    Nice job!

    I wonder if a RRD Fan Extender ( will do the job instead of the power expander?

    3 replies

    I guess it might.
    I'm using various mosfet boards as well, which are basically fan extenders.

    Try searching for "arduino mosfet board" on ebay or similar.



    I wanted to control heatthink fan and smoothieboard fan (so they stop making noise once the print job is done). To do this I use a simple mosfet and 10k resistor. Base on this website ( taking motor as fans. The input pin is the 1.22 because I didn't need pwm but it can be done with a pwm pin as the 1.23.
    The config.txt can be easily modify using the smoothie page.

    Using mosfet and resistors, which needs to be soldered, is much too much bother for most people.. too much hassle and potential for errors and such.


    1 year ago

    I'm not attacking Smoothieware. I'm PROMOTING smoothieware. FOR FREE.

    What I am doing is helping people for free. Doing your work. For Free.

    I'm stating facts about the unfriendly tone of your Google groups, as thousands of people see them (gathered from all the countless messages I recieve).

    It's ok you view it differently, since you have promoted that kind of environment.

    Just please do not come over here, and ruin the good mood.

    In this forum, we try to HELP each other. Not Critize each other.

    1 reply

    No, you were definitely attacking the Smoothie project, but you are such a coward that you have since deleted your messages. Because *everything* you say in them is false. You talk about events that *only happened in your head*, they do not exist except in your imagination, and the document I compiled proves that.


    1 year ago

    Regarding your "document".. I can put together an endless list of pointless attacks you have made, here, on your own foras, github and especially on the reprap forums.. but I try to focus on furthering the community, not hammering anyone.
    Yes, I can get carried away now and then, I am humand, and this is not my work, so my work cap is not on... but I do not go search for people to annoy.. like you do here.

    Can't you see how bad it is you come here like this Arthur? I'm freaking trying to promote Smoothieware, but you, as the people who has most to gain, work very actively to destroy it by being so darned negative.

    1 reply

    I sent you this document, and you answered it via email, and in your answer, you explained that you DID NOT EVEN READ IT.

    This document explains in detail how the things you are saying are false, with proof and links and quotation, and you are SO SURE you are right you do not even read it. That is insane !

    The accusations you are making against the Smoothie project or against me are *false*, the things you say happened happened *only in your head*, and if you were to read the document, you would *see that*.

    Anybody believing dintid's constant accusations against Smoothie, *please* read the document :

    Hi Dintid,

    I was long searching for these details. Thanks for such excellent write ups with MKS sbase boards. I am using this board in my printer as well and it seem to have worked pretty well so far. I have one question though. I am presently using dupont style JST connectors for the connections which is rather flimsy as this board needs 2.54mm pitched xh-JSTs. I tried to crimp some with spare XH receptacles but horribly failed wasting some of them. The connectors you are using are these pre-crimped or have you crimped it? What crimp tool do you use to get it done?

    1 reply

    I have crimped my own motor wires. I usually start using a needle-clamp (I think it's called that. I'm danish). I then use a very cheap crimp tool I bought in Biltema (Scandinavian store). But it's the same as any cheap crimp tool you can buy anywhere.

    Sometimes tweak it with my needle-plier after crimping to make it fit into the plugs.

    Thanks for sharing. The fact that there is just a fraction of PWM enabled pins available on MKS SBase compared to the original Smoothieboard is a big downside to me. I have it running on a cartesian printer with servo-based probe and dual extruder. So P1.23 and P2.13 are used, fan out as well (for heatsinks). I now have to sacrifice the LCD for the hotend / print fan(s). That is a shame, as a couple of extra pins surely would not break the manufacturing budget. Otherwise, it is a quite nice board tho.

    On a related subject: I cannot get a SRD-05VDC-SL-C 5V Relay to switch my PSU on / off. Relay is always on (NC). These are the settings in my config.txt:

    switch.psu.enable true
    switch.psu.input_on_command M80
    switch.psu.input_off_command M81
    switch.psu.input_pin_behavior momentary #probably not required
    switch.psu.output_pin 1.27ov! # Y_Max Endstop; tried all options and combos: open drain, pull-down, inverted to no avail. Maybe pin is missing capabilities??

    switch.psu.output_type digital # on/off only

    Any ideas, pointers?

    1 reply

    Hello Googliola.
    I believe you can run must of the gpio pins as pwn though not as true "hpwm" setting? Just a thought?

    I really do not know about the on off stuff. I always turn my printer physically on/off, and it sounds like you are more at home with the configuration than me ?

    I'm sure you can ask on smoothies google groups on how to use it. They might have an idea. Just don't start out with "hi, I'm using MKS Sbase board..." ?

    From the ARM CPU point of view those signals are GPIOs (General Purpose Input/Output), the Pn.nn designation is the original ARM signal names on the chip itself, so you can know exactly which ARM pin you are using.
    In the smoothieware design they are all assigned to a specific function but it's only a name written on the board and within the config file.
    The config file design is enough flexible to allow you to use them as general purpose as well so to redefine their assignment. It's an advanced feature for people who knows what they're doing. It's a very smart design and I personally like it more than adruinos based boards.