[SOLVED]Smoothie Config, Multiplexing same pin for Fan and Servo

Hi, I have a Cetus, and I am trying to use same pin 1.18 as both my fan speed control pin, as well as a 3d touch sensor control pin. So is this a valid config?

## Switch module for fan control
switch.fan.enable                            true             #
switch.fan.input_on_command                  M106             #
switch.fan.input_off_command                 M107             #
switch.fan.output_pin                        1.18              #
switch.fan.output_type                       hwpwm              # pwm output settable with S parameter in the input_on_comand
switch.fan.max_pwm                           225              # set max pwm for the pin, reduce so that we dont trigger zprobe

## Switch module for 3dtouch control
switch.servo.enable true
switch.servo.input_on_command 				M280 
switch.servo.input_off_command 				M281 
switch.servo.output_pin 					1.18 				# Pin connected to the aux-port
switch.servo.output_type 					hwpwm       		# H/W PWM output settable
switch.servo.pwm_period_ms  				20      			#Default is 50Hz
switch.servo.startup_state                  false               # use startup_value as initial setting
switch.servo.startup_value                  93                  # On boot it will go into stow mode
switch.servo.default_on_value               97                  # value set if M280 is issued without the S parameter, also value set if startup_state is true

Update: The config I have in this post does not work!! However I came up with a electronics design to use different PWM duty cycles to mean different things, and hence I can use same pin for different purpose. Look at my subsequent post below.

I do not believe you can define a pin twice.

1 Like

As Douglas said, that’s not how that works. Why do you want to do this?

You can find other hwpwm-capable pins to use here : http://smoothieware.org/pinout

Well, on Cetus I can’t pick and chose the pins as the board is like a transplant. The printer is from Tier Time with their proprietary software while a 3rd party called TinyFab made a Smoothieware compatible board. In the main board I have only one pwm capable pin (1.18). I want to use it for both fan and zprobe 3dtouch (bltouch clone) .

I use Slic3r as slicer and it generates M106 for fan control. I also saw M280 being commonly used for zprobe (3d touch) servo control.

Currently with my custom driver at the end I am able to use the same pin for both. In smoothie config I left only zprobe part with M106 as gcode. So now I can use M106 for both purpose, and if it’s above 89% duty cycle it goes to zprobe, and less than that is for fan.

Reason for my question was just making the gcode more readable, so if I see M280 I can assume servo control and M106 as a fan control.

In the main board I have only one pwm capable pin (1.18). I want to use it for both fan and zprobe 3dtouch (bltouch clone) .

This doesn’t make any sense. Can you explain how you expect this would work, I’m very puzzled.

( as always with boards made by third party that don’t participate in the Smoothie project, I ask if you can to contact the seller to ask him for help. They may not help, but putting them in front of the fact that they should is useful I think )

Well, this is my config as of now:

## Switch module for 3dtouch control
switch.zprobe-fan.enable                        true
switch.zprobe-fan.input_on_command              M106                #M280 
switch.zprobe-fan.input_off_command             M107                #M281 
switch.zprobe-fan.output_pin                    1.18                # Pin connected to the aux-port
switch.zprobe-fan.output_type                   hwpwm               # H/W PWM output settable
switch.zprobe-fan.pwm_period_ms                 20                  # Default is 50Hz
switch.zprobe-fan.startup_state                 false               # use startup_value as initial setting
switch.zprobe-fan.startup_value                 0                   # turn off the pwm out on boot
switch.zprobe-fan.default_on_value              100                 # value set if M280 is issued without the S parameter, also value set if startup_state is true
switch.zprobe-fan.ignore_on_halt                true                # let the fan run even after halt
switch.zprobe-fan.failsafe_set_to               1                   # let the fan run even after halt

3d touch probe has a edge sensing PWM control logic. So it does not care if its a +5V signal being pulled down 3% of the time, or a straight 3% PWM signal. Both are treated same. With that understanding I have a circuit which uses a low side driving signal (i.e. 1.18 from smoothie board is routed to a MOSFET driving pin to low when 1.18 is high) which then split into two, one is connected to 3dtouch probe with a 10k pull up resister, and a signal inverter (PNP transistor driving a MOSFET) driving the -ve of the fan. I can use any PWM signal below 89% (BLTouch care between 89% to 97%) or 98-100% as pure fan control.

e.g.

M106S91.6|G4S1|M106S93; test zprobe

or

M106S100; full fan
M106 S48.45; fan at half speed

Its not straight forward, but works just fine… Cetus in fact uses same fan for both heater block and part cooling. I am trying to use two separate fans, one driven with M106 and one always on.

Well the switch module wasn’t designed to be used this way, and if by chance it happens to work right now, there is no guarantee it won’t stop working with further updates ( it’s actually likely it’ll stop working at some point … )

Excuse my ignorance. But as of now I think I am using switch module as its designed to be used with hwpwm generating 50Hz signal with 20ms pulse width. How I use the generated PWM signal is left to how I design my electronics, right? Could you point me to my config that you think is problematic?

It hasn’t been designed to have two switch modules sharing the same pin, that was never an intended use case.

Edit : looks like you have in fact changed to a single switch setup. That would be just fine.