DDC
  • Welcome
    • Introduction
    • Supported hardware
  • 1: Project planning
    • Switch inputs
      • Switch table
      • Direct
      • Shift register
      • Port expander
    • Analog inputs
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
    • Processing and memory
  • 2. Wiring
    • Switch inputs
      • Matrix
      • Direct
      • Shift register
      • Port expander
    • Analog
      • Analog switches
      • External ADC
    • RGB LED
    • Digital outputs
    • PWM / Circuit control
    • EEPROM
  • 3. Coding
    • Essentials
      • 02_Board.ino
      • 08_Joystick
      • 10_TableAndAnalog.ino
        • Switch table
        • Analog channels
      • 30_Switches.ino
    • Peripherals
      • RGB LED
        • Firmware control
          • LED functions
          • Color
          • Brightness
          • Presets
        • SimHub control
      • Digital outputs
        • Setup
        • SimHub control
        • Firmware control
      • PWM / Circuit control
        • Setup
        • Calibrate
        • Switch control
        • Trigger control
      • Shift register
      • I2C devices
        • ADS1115
        • PCA9555
        • CAT24C512
    • Advanced
      • Analog inject
      • Conditional coding
        • Triggers
        • Editors
      • Field placement
      • Presets
        • 31_RunningPresets.ino
        • 32_Presets.ino
        • Example
    • Upload
    • Naming the controller
  • 4. Connect to SimHub
    • LED control
    • Controller settings and properties
      • How to connect?
      • How does it work?
      • How to control it?
      • Property list
  • Switch library
    • Pushbutton
    • Function switches
    • Toggle switches
    • Hat switches
    • Car control functions
      • QuickSwitch
      • BrakeMagic
      • ThrottleHold
      • Handbrake
    • Pedals & paddles
      • Brake/throttle
      • Clutch
      • Bite point & launch
      • Filtered curves
      • Shifter
    • Funky switch
      • Directional
      • Center push
    • Encoders
      • rotary2Bit
      • rotary4Bit
      • funkyRotary
      • wildEncoder
      • E18
      • rotaryPulse
      • PEC11
    • Rotary switches
      • rotaryAnalog
      • quickRotary
      • SW1
      • Editing functions
    • Multiswitch complexes
      • Hybrid rotary
      • Multifunction rotary
      • Modded encoder
      • Stacked encoder
    • Preset
    • DDS
    • RGB LED control
    • PWM / Circuit control
    • Utility
  • Fast DDC
    • Buttons and LED
    • 4 encoders, buttons and LED
    • Dual clutches, 4 encoders, buttons and LED
    • Dual clutches, 6 encoders, button matrix and LED
  • CB1
    • Ordering
      • Order together
      • Order yourself
        • 1. Open in EasyEDA
        • 2. Export files
        • 3. Edit Pick&Place
        • 4. Pin headers and jumper
        • 5. Order from JLCPCB
    • Wiring
    • Code
      • Essentials
      • Complete project
      • Settings
    • Circuit
    • Shields
      • Robin
  • Collaboration
Powered by GitBook
On this page
  1. Switch library
  2. Pedals & paddles

Filtered curves

PreviousBite point & launchNextShifter

Last updated 1 year ago

All pedal/paddle functions that are used to make a joystick axis will have an alternative function with a curve filter included. The purpose of the filter is to adjust the rise of the output curve.

Particularily with hall sensors, it can be difficult to design a device that has a completely linear output. Either too much happens too soon (above to the left) or to much happens too late (above to the right).

The filter functions have an extra two values to fill in, but appart from that they are identical to the filter-less versions:

  • curvePush -> The direction of curve adjustments. "1" will push the curve flat, "-1" will lift the curve up. "0" wil disable the whole filter. There is nothing inbetween, so really "1" and "-1" are the only values you should be using.

  • expFactor -> How hard you're pushing the curve. Decimal values from 0 and up. In practice doesn't reach higher than 10 before the function stops working and you'll get no value at all from your paddle/pedal. This is because the numbers used in the calculations get too big for the arduino to handle. Anyways, expFactor set to 10 is an extreme adjustment. and will not be needed. Likely, you'll use a value between 0 and 1.5.

The figures above show how curvePush = 1 (left) and curvePush = -1 (right) worrks, and how different values of expFactor (0.5 - 5) will alter the curve. In the case, a value of 2 is needed to reach linearity, which is a pretty big adjustment.

While this is useful for improving the linearity of a pedal output, there are many other ways to take advantage of this filter:

  • For a DIY handbrake, you might want it a bit more responsive, lift the curve a little

  • You can use this on your DIY brake/throttle pedals to make them more/less responsive. Some prefer to not have a linear pedal response.

The filter algorithms have been written from bottom-up without using libraries to ensure as little processing power and memory usage as possible. However, these functions will use more memory and processing power than their filter-less versions. So if you don't need a filter, don't use a filter function.

filteredBrake()

void filteredBrake(int analogChannel, int releasedValue, int fullyPressedValue, int curvePush, float expFactor)

For a load cell on analog channel 4, it could look like this:

filteredBrake(4, 640, 212, 1, 1.2);

With a curvePush of 1, this will flatten the response curve, meaning you'll get more braking power towards the end of the travel. ExpFactor of 1.2 is a sizable flattening of the curve.

  • None

filteredThrottle()

void filteredThrottle(int analogChannel, int releasedValue, int fullyPressedValue, int curvePush, float expFactor)

For a potentiometer on analog channel 4, it could look like this:

filteredThrottle(4, 0, 1023,-1,0.7);

With a curvePush of -1, this will raise the response curve, meaning you'll get more output of the throttle at the start of the paddle/pedal travel. ExpFactor of 0.7 is a moderate push of the curve.

  • None

filteredBitePot()

Similar to bitePot(), but with added filter.

void filteredBitePot(int analogChannel, int startValue, int endValue, int curvePush, float expFactor)

For a potentiometer on analog channel 2, it could look like this:

filteredBitePot(2, 0, 1023, -1, 0.3);

With a curvePush of -1, this will raise the response curve, meaning you'll get more output of the potentiometer at the start of the rotation. ExpFactor of 0.3 is a small adjustment of the curve.

  • None

filteredSingleClutch()

void filteredSingleClutch(int analogChannel, int releasedValue, int fullyPressedValue, int curvePush, float expFactor)

Type in the analog channel that runs the clutch, and the values you read out from serial monitor.

Example:

void filteredSingleClutch(2, 231, 799, 1, 2.8);

With a curvePush of 1, this will flatten the response curve, meaning you'll get more clutch response towards the end of the travel. ExpFactor of 2.8 is a big push to flatten the curve.

  • biteButton() or bitePot() to set bite point if desired

  • launchButton() to launch, if desired

filteredDualClutch()

void filteredDualClutch(int masterAnalogChannel, int masterReleasedValue, int masterFullyPressedValue, int masterCurvePush, float masterExpFactor int slaveAnalogChannel, int slaveReleasedValue, int slaveFullyPressedValue, int slaveCurvePush, float slaveExpFactor, bool throttleMaster)

Type in the analog channels for the clutches and the values you read out from serial monitor. This for both switches, decide which is master and slave. Lastly, throttleMaster makes master paddle throttle and slave paddle brake in mode 3. if set to true. Opposite if set to false.

Example:

void dualClutch(1, 105, 799, 1, 1.3, 2, 436, 873, 1, 1.5, true);

In this example, both master and slave paddles have curvePush "1", which will flatten the response curve, makeing it more responsive towards the end of the paddle travel. Both have a sizable adjustment of 1.3 for the master paddle and 1.5 for the slave paddle.

  • modButton() to change modes

  • biteButton() or bitePot() to change the pite point.

  • launchButton() if you want 1-handed launches.

You can make for your pedals, ranging from responsive throttle for high-grip conditions to less responsive (flatter curve) for wet conditions and a switch to togle though your throttle shapes.

Similar to, but with added filter.

Similar to , but with added filter.

Similar to , but with added filter

Similar to , but with added filter.

presets
brake()
throttle()
singleClutch()
dualClutch()