Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
joystick [2017/01/25 15:06] arthur |
joystick [2021/02/22 16:52] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | [[div style=" | + | < |
- | [[f>image joystick.png width=" | + | [[https:// |
- | Image modified from [https:// | + | </WRAP> |
+ | = Joystick Module | ||
- | = Joystick Module | ||
- | <callout type=" | ||
- | Note this page is a work in progress and the joystick functionality is not yet released in smoothieware. | ||
- | </ | ||
- | [[f> | ||
== What is Joystick? | == What is Joystick? | ||
- | + | Joystick is a module for SmoothieBoard which adds the ability to use joysticks with your machine. It is much like the [[Switch]] module, but can read from things which output an [[https:// | |
- | Joystick is a module for SmoothieBoard which adds the ability to use joysticks with your machine. It is much like the [[Switch]] module, but can read from things which output an [*https:// | + | |
Some possible uses for the Joystick module: | Some possible uses for the Joystick module: | ||
- | * Moving your machine | + | * Moving your machine |
- | * Manually overriding your machine' | + | * Retracting an extruder on a 3D-printer |
+ | * Focusing a laser cutter | ||
+ | * Manually overriding your machine' | ||
+ | * Controlling spindle speed with a knob on a mill | ||
== Getting Started | == Getting Started | ||
- | <callout type=" | + | <callout type=" |
Note this page is a work in progress and the joystick functionality is not yet released in smoothieware. | Note this page is a work in progress and the joystick functionality is not yet released in smoothieware. | ||
+ | To test it you need to use pull request [[https:// | ||
</ | </ | ||
=== Hardware Requirements | === Hardware Requirements | ||
- | [[div style=" | ||
- | [[f> | ||
- | [[f> | ||
- | [[f> | ||
- | Images from SparkFun Electronics [http:// | ||
+ | {{ :// | ||
+ | {{ // | ||
+ | {{ // | ||
- | To begin, you will need a device that you want to read. Some example devices are shown here, but really any variable resistor (potentiometer) or device that outputs 0-3.3 V should work. For more information on how potentiometers work, see [*https:// | + | |
+ | To begin, you will need a device that you want to read. Some example devices are shown here, but really any variable resistor (potentiometer) or device that outputs 0-3.3 V should work. For more information on how potentiometers work, see [[https:// | ||
For the rest of the document, the examples will be for a 2-axis joystick like in the right-most picture. This joystick has two separate potentiometers for each axis, and has springs inside to return the knob to the center when released (think PlayStation controller knob). | For the rest of the document, the examples will be for a 2-axis joystick like in the right-most picture. This joystick has two separate potentiometers for each axis, and has springs inside to return the knob to the center when released (think PlayStation controller knob). | ||
Line 38: | Line 36: | ||
If you have a potentiometer, | If you have a potentiometer, | ||
- | [[div style=" | + | {{//external/ |
- | [[image https:// | + | |
- | Image from SparkFun Electronics [http:// | + | |
The above image shows a basic schematic of a potentiometer. Pins 1 and 3 are the ends of the potentiometer, | The above image shows a basic schematic of a potentiometer. Pins 1 and 3 are the ends of the potentiometer, | ||
<callout type=" | <callout type=" | ||
- | Use caution when connecting a potentiometer to your SmoothieBoard. If Vin is a higher voltage than the SmoothieBoard' | + | Use caution when connecting a potentiometer to your SmoothieBoard. If Vin is a higher voltage than the SmoothieBoard' |
</ | </ | ||
The analog pins on the SmoothieBoard which can be connected to a wiper (Pin 2 in above schematic) are shown in the table below: | The analog pins on the SmoothieBoard which can be connected to a wiper (Pin 2 in above schematic) are shown in the table below: | ||
- | [[div style=" | + | ^ Analog Pin ^ Smoothie Assignment |
- | ||~ Analog Pin ||~ Smoothie Assignment | + | | 0.2 | uart0 txd | Not recommended (used for ISP programming of the bootloader and for debugging) | |
- | || 0.2 || uart0 txd || Not recommended (used for ISP programming of the bootloader and for debugging) | + | | 0.3 | uart0 rxd | Not recommended (used for ISP programming of the bootloader and for debugging) | |
- | || 0.3 || uart0 rxd || Not recommended (used for ISP programming of the bootloader and for debugging) | + | | 0.23 | hotend.thermistor_pin | Not recommended (used for thermistors and has built-in 4.7 kΩ pull-up((Thermistor pins could be used if the pull-up is desoldered, do so at your own risk.))) | |
- | || 0.23 || hotend.thermistor_pin | + | | 0.24 | bed.thermistor_pin | Not recommended (used for thermistors and has built-in 4.7 kΩ pull-up) | |
- | || 0.24 || bed.thermistor_pin | + | | 0.25 | thermistor2 | Not recommended (used for thermistors and has built-in 4.7 kΩ pull-up) | |
- | || 0.25 || thermistor2 | + | | 0.26 | thermistor3 | Not recommended (used for thermistors and has built-in 4.7 kΩ pull-up) | |
- | || 0.26 || thermistor3 | + | | **1.30** | spare | Recommended pin | |
- | || 1.30 || spare || Recommended pin || | + | | **1.31** | spare | Recommended pin | |
- | || 1.31 || spare || Recommended pin || | + | |
See [[Pinout]] for a diagram of the SmoothieBoard with the pins labeled. | See [[Pinout]] for a diagram of the SmoothieBoard with the pins labeled. | ||
For a joystick, you will need to connect each wiper (the left/right and up/down) to different analog pins (e.g. 1.30 and 1.31). | For a joystick, you will need to connect each wiper (the left/right and up/down) to different analog pins (e.g. 1.30 and 1.31). | ||
- | + | {{://joystick: | |
- | (image of joystick | + | |
== Configuration | == Configuration | ||
Line 73: | Line 65: | ||
The configuration file, at its most basic level, must tell the SmoothieBoard how to convert the 0 to 3.3 V that it reads into a more useful range of numbers. The range that the Joystick module uses is -1 to 1. It is also possible to use a 0 to 1 range if negative values don't make sense for your application. | The configuration file, at its most basic level, must tell the SmoothieBoard how to convert the 0 to 3.3 V that it reads into a more useful range of numbers. The range that the Joystick module uses is -1 to 1. It is also possible to use a 0 to 1 range if negative values don't make sense for your application. | ||
- | The way the Joystick module performs this conversion is to first measure the voltage coming in. The module then subtracts off an offset, called | + | The way the Joystick module performs this conversion is to first measure the voltage coming in. The module then subtracts off an offset, called |
- | [[div style=" | + | <WRAP center round box 80%> |
- | [[=]] | + | {{ ://joystick: |
- | [[image Joystick%20Mapping%20Diagram.png width=" | + | |
- | //Example Mapping from joystick | + | |
- | [[/=]] | + | |
+ | Example Mapping from joystick position to output with < | ||
+ | </ | ||
=== Auto-Zeroing | === Auto-Zeroing | ||
- | The joystick module has an optional feature which automatically determines | + | The joystick module has an optional feature which automatically determines |
- | This feature is useful for joysticks, where the {{zero_offset}} is somewhat unknown (it is usually around 1.65 V but different devices have slightly different center values). It would not make sense to enable for sliders or knobs, since the knob doesn' | + | This feature is useful for joysticks, where the <kbd>zero_offset</ |
- | <callout type=" | + | <callout type=" |
- | Be careful not to move the joystick during the {{startup_time}}, otherwise the {{zero_offset}} will be wrong and the joystick will have undesirable behavior. | + | Be careful not to move the joystick during the <kbd>startup_time</ |
</ | </ | ||
=== All Configuration Options | === All Configuration Options | ||
- | [[div style=" | ||
- | ||~ Option ||~ Example Value ||~ Explanation || | ||
{{page> | {{page> | ||
+ | == Usage | ||
+ | === Jogging | ||
+ | < | ||
- | == Examples | + | To use the joystick for jogging, configure two different modules with two different names. For example, one module will be called " |
- | [[code]] | + | <file - joystick-2D.config> |
- | example block of code | + | joystick.horizontal.enable |
- | [[/code]] | + | joystick.horizontal.pin |
+ | joystick.horizontal.endpoint | ||
+ | joystick.horizontal.auto_zero | ||
+ | joystick.horizontal.startup_time | ||
+ | joystick.horizontal.refresh_rate | ||
+ | joystick.horizontal.start_value | ||
- | {{example G code}} | + | joystick.vertical.enable |
+ | joystick.vertical.pin | ||
+ | joystick.vertical.endpoint | ||
+ | joystick.vertical.auto_zero | ||
+ | joystick.vertical.startup_time | ||
+ | joystick.vertical.refresh_rate | ||
+ | joystick.vertical.start_value | ||
+ | </ | ||
- | <callout type=" | + | With the joystick configuration done, you will simply need to configure the [[Jogger]]. The only pertinent config for the joystick/ |
- | Example primary callout text. | + | |
- | </callout> | + | |
- | <callout type=" | + | <file> |
- | Example info callout text. | + | jogger.enable |
- | </callout> | + | jogger.data_source_alpha |
+ | jogger.data_source_beta | ||
+ | </file> | ||
+ | |||
+ | These options tell the jogger the names of the joystick modules to read when jogging. | ||
- | <callout type="warning" icon=" | + | <callout type="success" icon=" |
- | Example warning text. | + | You're all set! For more jogging configuration options, see [[Jogger]]. |
</ | </ | ||
- | <callout type="danger" icon=" | + | === Feed Rate Override |
- | Text | + | < |
+ | <callout type="warning" icon=" | ||
+ | Note: no feed rate override has been implemented in smoothie yet. The following example is purely hypothetical. | ||
</ | </ | ||
- | <callout type=" | + | To use the joystick to override your machine' |
- | Text Success | + | |
- | </callout> | + | |
- | == Usage | + | <file - feedrate-override.config> |
- | === Jogging [[# Jogging]] | + | joystick.fro.enable |
- | Describes how to use the joystick | + | joystick.fro.pin |
+ | joystick.fro.endpoint | ||
+ | joystick.fro.zero_offset | ||
+ | joystick.fro.refresh_rate | ||
+ | </ | ||
+ | |||
+ | With the joystick properly configured, you will simply need to tell the Feed Rate Override module((Doesn' | ||
+ | |||
+ | < | ||
+ | feedoverride.data_source | ||
+ | </ | ||
+ | |||
+ | <callout type=" | ||
+ | You're all set! For more feed-rate override configuration options, see [[Feed Rate Override]]. | ||
+ | </ | ||
- | === Feed Rate Override [[# FRO]] | ||
- | Describes how to use the joystick to override the feed rate. | ||
== Developer Documentation | == Developer Documentation | ||
- | Link to Joystick developer doc page which gives info on how to interface with the module when writing other modules. | + | For information |