Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
spindle-module [2017/01/25 17:27]
arthur
spindle-module [2017/05/27 20:54]
207.229.187.233 [PWM Spindle] add callout with link to source
Line 1: Line 1:
-<callout type="​info"​ icon="​true">​ 
-The purpose of this page is to document the new spindle module that supports various spindle types. 
-It is currently under development by **bouni**, the code can be found [[*https://​github.com/​Bouni/​Smoothieware/​tree/​feature/​spindle-refactor|here]]. 
-</​callout>​ 
- 
 == Basics == Basics
  
Line 16: Line 11:
 The spindle module has an option which lets you enable or disable the entire module: The spindle module has an option which lets you enable or disable the entire module:
  
-[[code]]+<code>
 spindle.enable ​                                  ​true ​  # set this to false to disable the spindle module spindle.enable ​                                  ​true ​  # set this to false to disable the spindle module
-[[/code]]+</code>
  
 === G-code === G-code
  
 Available G-code commands: Available G-code commands:
-{{M3}} will start the spindle. ​{{M3 S5000}} will start the spindle and set speed to 5000 RPM. +<kbd>M3</​kbd> ​will start the spindle. ​<kbd>M3 S5000</​kbd> ​will start the spindle and set speed to 5000 RPM. 
-{{M5}} will stop the spindle. Last set RPM is remembered and used for next {{M3}} command if S argument is not given. +<kbd>M5</​kbd> ​will stop the spindle. Last set RPM is remembered and used for next <kbd>M3</​kbd> ​command if S argument is not given. 
-{{M957}} will report the current spindle speed and PWM value. This returns not the actual value but the value that was set through M3. +<kbd>M957</​kbd> ​will report the current spindle speed and PWM value. This returns not the actual value but the value that was set through M3. 
-{{M958}} will report the current PID parameters. ​{{M958 Px.xxx Ix.xxx Dx.xxx}} will set them (to save the new values, you need to edit config file manually).+<kbd>M958</​kbd> ​will report the current PID parameters. ​<kbd>M958 Px.xxx Ix.xxx Dx.xxx</​kbd> ​will set them (to save the new values, you need to edit config file manually).
  
 === PWM Spindle === PWM Spindle
  
-> TODO : Transfer the information of the old [[spindle-control]] into this section 
  
 <callout type="​info"​ icon="​true">​ <callout type="​info"​ icon="​true">​
Line 39: Line 33:
 ==== Example config options ==== Example config options
  
-[[code]]+<code>
 spindle.type ​                                ​pwm ​              # sets the spindle module to PWM mode spindle.type ​                                ​pwm ​              # sets the spindle module to PWM mode
 spindle.pwm_pin ​                             2.5               # Big Mosfet Q7. Pin must be hardware PWM capable. spindle.pwm_pin ​                             2.5               # Big Mosfet Q7. Pin must be hardware PWM capable.
Line 50: Line 44:
 spindle.control_D ​                           0.1               # default 0.0001. D value for the PID controller spindle.control_D ​                           0.1               # default 0.0001. D value for the PID controller
 spindle.control_smoothing ​                   0.1               # default 0.1. This value is low pass filter time constant in seconds. spindle.control_smoothing ​                   0.1               # default 0.1. This value is low pass filter time constant in seconds.
-[[/code]]+</code>
  
 <callout type="​info"​ icon="​true">​ <callout type="​info"​ icon="​true">​
 Check the [[http://​smoothieware.org/​pinout |pinout]] to verify if a pin is capable for a certain functionality! Check the [[http://​smoothieware.org/​pinout |pinout]] to verify if a pin is capable for a certain functionality!
 +</​callout>​
 +
 +<callout type="​default"​ icon="​true"​ title="​Going further">​
 +If you want to learn more about this module, or are curious how it works, Smoothie is Open-Source and you can simply go look at the code, [[https://​github.com/​Smoothieware/​Smoothieware/​blob/​edge/​src/​modules/​tools/​spindle/​PWMSpindleControl.cpp|here]].
 </​callout>​ </​callout>​
  
Line 68: Line 66:
 ==== Example config options ==== Example config options
  
-[[code]]+<code>
 spindle.type ​                                    ​analog ​  # set the spindle type to analog, can also be used for ESC spindles controlled by a PWM spindle.type ​                                    ​analog ​  # set the spindle type to analog, can also be used for ESC spindles controlled by a PWM
 spindle.max_rpm ​                                 24000    # set the max spindle speed that is achieved at 100% PWM spindle.max_rpm ​                                 24000    # set the max spindle speed that is achieved at 100% PWM
Line 74: Line 72:
 spindle.pwm_period ​                              ​1000 ​    # the PWM frequency spindle.pwm_period ​                              ​1000 ​    # the PWM frequency
 spindle.switch_on_pin ​                           2.6      # the pin which is used to enable the VFD (optional) spindle.switch_on_pin ​                           2.6      # the pin which is used to enable the VFD (optional)
-[[/code]]+</code>
  
 ==== PWM to analog converter circuit ==== PWM to analog converter circuit
Line 82: Line 80:
 </​callout>​ </​callout>​
  
-<div style='​width:​640px'><​panel type="​default"​ title="​VFD adapter board">​ 
-<image shape="​thumbnail">​ 
 <​html>​ <​html>​
-<img src="https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​analog-vfd-board-pcb.png" style="​width:​100%;"​> +<div class='​panel panel-default wrap_center'​ style='​width:​640px;​padding:​10px '>​ 
-</html>+<div class='​panel-heading'><​h4 class='​panel-title'>​VFD adapter board</​h4></​div>​ 
 +<​image ​src='https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​analog-vfd-board-pcb.png' ​width='​620px'​><br/>
 Used to talk to your VFD via an analog signal Used to talk to your VFD via an analog signal
-</​image>​ 
-</​panel>​ 
 </​div>​ </​div>​
 +</​html>​
  
-[[div ]] 
 This is an example of a small extension PCB that contains a circuit to convert the 3.3V PWM signal into a 0-10V analog signal. This is an example of a small extension PCB that contains a circuit to convert the 3.3V PWM signal into a 0-10V analog signal.
  
  
-<div style='​width:​640px'><​panel type="​default"​ title="​VFD adapter board schematic">​ 
-<image shape="​thumbnail">​ 
 <​html>​ <​html>​
-<img src="https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​analog-vfd-board-schematic.png" style="​width:​100%;"​> +<div class='​panel panel-default wrap_center'​ style='​width:​640px;​padding:​10px '>​ 
-</html>+<div class='​panel-heading'><​h4 class='​panel-title'>​VFD adapter board schematic</​h4></​div>​ 
 +<​image ​src='https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​analog-vfd-board-schematic.png' ​width='​620px'​><br/>
 For the curious For the curious
-</​image>​ 
-</​panel>​ 
 </​div>​ </​div>​
 +</​html>​
 +
  
-[[div]] 
 This is the related circuit diagram for the converter This is the related circuit diagram for the converter
  
  
-<div style='​width:​640px'><​panel type="​default"​ title="​VFD adapter board wiring">​ 
-<image shape="​thumbnail">​ 
 <​html>​ <​html>​
-<img src="https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​PWM-analog-wiring.png" style="​width:​100%;"​> +<div class='​panel panel-default wrap_center'​ style='​width:​640px;​padding:​10px '>​ 
-</html>+<div class='​panel-heading'><​h4 class='​panel-title'>​VFD adapter board wiring</​h4></​div>​ 
 +<​image ​src='https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​PWM-analog-wiring.png' ​width='​620px'​><br/>
 How to connect it to your Smoothieboard and vfd How to connect it to your Smoothieboard and vfd
-</​image>​ 
-</​panel>​ 
 </​div>​ </​div>​
 +</​html>​
  
  
-[[div]] 
 This example shows how to wire the Smoothieboard to an Huanyang VFD using the PCB shown above. ​ This example shows how to wire the Smoothieboard to an Huanyang VFD using the PCB shown above. ​
  
Line 128: Line 118:
 Unfortunately the circuit does not create a completely linear output signal. As you can see in the graph, the signal is better at the beginning and at the end. Unfortunately the circuit does not create a completely linear output signal. As you can see in the graph, the signal is better at the beginning and at the end.
  
-<div style='​width:​640px'><​panel type="​default"​ title="​VFD analog signal linearity">​ 
-<image shape="​thumbnail">​ 
 <​html>​ <​html>​
-<img src="https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​linearity-check.png" style="​width:​100%;"​> +<div class='​panel panel-default wrap_center'​ style='​width:​640px;​padding:​10px '>​ 
-</html>+<div class='​panel-heading'><​h4 class='​panel-title'>​VFD analog signal linearity</​h4></​div>​ 
 +<​image ​src='https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​linearity-check.png' ​width='​620px'​><br/>
  
-</​image>​ 
-</​panel>​ 
 </​div>​ </​div>​
 +</​html>​
 +</​callout>​
  
 +<callout type="​default"​ icon="​true"​ title="​Going further">​
 +If you want to learn more about this module, or are curious how it works, Smoothie is Open-Source and you can simply go look at the code, [[https://​github.com/​Smoothieware/​Smoothieware/​blob/​edge/​src/​modules/​tools/​spindle/​AnalogSpindleControl.cpp|here]].
 </​callout>​ </​callout>​
 +
 === Modbus Spindle === Modbus Spindle
  
Line 151: Line 143:
 ==== Example config options ==== Example config options
  
-[[code]]+<code>
 spindle.type ​                                    ​modbus ​  # set the spindle type to modbus/​RS485 spindle.type ​                                    ​modbus ​  # set the spindle type to modbus/​RS485
 spindle.vfd_type ​                                ​huanyang # set the VFD type, this is necessary because each inverter uses its own commands spindle.vfd_type ​                                ​huanyang # set the VFD type, this is necessary because each inverter uses its own commands
Line 157: Line 149:
 spindle.tx_pin ​                                  ​2.4 ​     # RX pin for the soft serial spindle.tx_pin ​                                  ​2.4 ​     # RX pin for the soft serial
 spindle.dir_pin ​                                 2.5      # RS485 is only half-duplex,​ so we need a pin to switch between sending and receiving ​ spindle.dir_pin ​                                 2.5      # RS485 is only half-duplex,​ so we need a pin to switch between sending and receiving ​
-[[/code]]+</code>
  
 ==== Huanyang VFD Modbus Parameters ==== Huanyang VFD Modbus Parameters
Line 174: Line 166:
 Like an analog spindle, the Modbus spindle needs a external circuit, but that is much simpler. Like an analog spindle, the Modbus spindle needs a external circuit, but that is much simpler.
  
-<div style='​width:​640px'><​panel type="​default"​ title="​VFD Modbus signal adapter PCB">​ 
-<image shape="​thumbnail">​ 
 <​html>​ <​html>​
-<img src="https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​modbus-vfd-board-pcb.png" style="​width:​100%;"​> +<div class='​panel panel-default wrap_center'​ style='​width:​640px;​padding:​10px '>​ 
-</html>+<div class='​panel-heading'><​h4 class='​panel-title'>​VFD Modbus signal adapter PCB</​h4></​div>​ 
 +<​image ​src='https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​modbus-vfd-board-pcb.png' ​width='​620px'​><br/>
 Used to talk to your spindle over RS485 differential signals Used to talk to your spindle over RS485 differential signals
-</​image>​ 
-</​panel>​ 
 </​div>​ </​div>​
 +</​html>​
 +
  
 This is an example of a small extension PCB that contains a circuit to convert the 3.3V UART signal into a RS485 signal. This is an example of a small extension PCB that contains a circuit to convert the 3.3V UART signal into a RS485 signal.
  
  
-<div style='​width:​640px'><​panel type="​default"​ title="​VFD Modbus signal adapter schematic">​ 
-<image shape="​thumbnail">​ 
 <​html>​ <​html>​
-<img src="https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​modbus-vfd-board-schematic.png" style="​width:​100%;"​> +<div class='​panel panel-default wrap_center'​ style='​width:​640px;​padding:​10px '>​ 
-</html>+<div class='​panel-heading'><​h4 class='​panel-title'>​VFD Modbus signal adapter schematic</​h4></​div>​ 
 +<​image ​src='https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​modbus-vfd-board-schematic.png' ​width='​620px'​><br/>
 for the curious for the curious
-</​image>​ 
-</​panel>​ 
 </​div>​ </​div>​
 +</​html>​
 +
  
 [[div]] [[div]]
Line 204: Line 194:
  
  
-<div style='​width:​640px'><​panel type="​default"​ title="​VFD Modbus wiring">​ 
-<image shape="​thumbnail">​ 
 <​html>​ <​html>​
-<img src="https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​RS485-wiring.png" style="​width:​100%;"​> +<div class='​panel panel-default wrap_center'​ style='​width:​640px;​padding:​10px '>​ 
-</html>+<div class='​panel-heading'><​h4 class='​panel-title'>​VFD Modbus wiring</​h4></​div>​ 
 +<​image ​src='https://​raw.githubusercontent.com/​Bouni/​smoothieboard-doku/​master/​RS485-wiring.png' ​width='​620px'​><br/>
 How to connect it to the Smoothieboard and the VFD How to connect it to the Smoothieboard and the VFD
-</​image>​ 
-</​panel>​ 
 </​div>​ </​div>​
 +</​html>​
 +
  
 [[div]] [[div]]
 This example shows how to wire the Smoothieboard to an Huanyang VFD using the PCB shown above. ​ This example shows how to wire the Smoothieboard to an Huanyang VFD using the PCB shown above. ​
 +
 +<callout type="​default"​ icon="​true"​ title="​Going further">​
 +If you want to learn more about this module, or are curious how it works, Smoothie is Open-Source and you can simply go look at the code, [[https://​github.com/​Smoothieware/​Smoothieware/​blob/​edge/​src/​modules/​tools/​spindle/​ModbusSpindleControl.cpp|here]].
 +</​callout>​