Steve Massikker
Published © GPL3+

DIY Rudder Pedals for Flight Simulator

Fully adjustable via sketch of Arduino NANO/UNO | Easy making from ready-made components | Non-mechanical unbreakable sensors | Strong frame

IntermediateFull instructions provided6 hours28,516
DIY Rudder Pedals for Flight Simulator

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
Or Arduino UNO for analog output
×1
Arduino Micro
Arduino Micro
If you need only DIGITAL OUTPUT for Windows 8-10
×1
Arduino UNO
Arduino UNO
Or Arduino NANO for analog output
×1
Single/Dual Digital Potentiometer with SPI™ Interface MCP41050
×3
SS49E Hall-effect linear sensor
Or any similar sensors, like - AH3503 (not a switch or not a digital!!!)
×4

Story

Read more

Schematics

TWCS circuit

DigiPOT circuit

For Arduino Joystick Library

Code

Analog output via digiPOTs

Arduino
#include <SPI.h>  

#define CS_RUDDER 10 
#define CS_LEFT 8 
#define CS_RIGHT 9 
#define SENSOR_LEFT_PEDAL A6
#define SENSOR_RIGHT_PEDAL A5
#define SENSOR_RUDDER_LEFT A0
#define SENSOR_RUDDER_RIGHT A1

int val_left, val_right, remap_left, remap_right, rudder,
    val_brake_left, val_brake_right, remap_brake_left, remap_brake_right;

int tuning_rudder = 128;
// int tuning_left_brake = 255;
// int tuning_right_brake = 255;

void setup() {
  Serial.begin(9600);
  SPI.begin();    
  pinMode (CS_RUDDER, OUTPUT);   
  pinMode (CS_LEFT, OUTPUT);   
  pinMode (CS_RIGHT, OUTPUT);  
}

void loop() {
 
  // --------------------------------------------------------
  // RUDDER PEDALS          -128 --- x --- 128
  // --------------------------------------------------------

  // Read and remap sensor RUDDER LEFT 
  val_left = analogRead(SENSOR_RUDDER_LEFT);
  if (val_left <= 950) { 
    remap_left = map(val_left, 30, 870, -128, 0); // -40
  }
  else remap_left = 0;
  // Set limitations RUDDER LEFT 
  if (remap_left > 0) remap_left = 0;
  if (remap_left <= -128) remap_left = -128;  

  // Read and remap sensor RUDDER RIGHT   
  val_right = analogRead(SENSOR_RUDDER_RIGHT);
  if (val_right <= 950) {
    remap_right = map(val_right, 0, 820, 132, 0); // -50
  }
  else remap_right = 0;  
  //Set limitations RUDDER RIGHT   
  if (remap_right < 0) remap_right = 0;
  if (remap_right >= 127) remap_right = 127;  
  
  rudder = remap_left + remap_right;
  

   if (remap_left == 0) {
      tuning_rudder = tuning_rudder + 128;
   }
   else {
      tuning_rudder = abs(tuning_rudder - 128);
   }

  // --------------------------------------------------------
  // BRAKING
  // --------------------------------------------------------  

  val_brake_left = analogRead(SENSOR_LEFT_PEDAL);

  if (val_brake_left <= 328) {
    remap_brake_left = map(val_brake_left, 200, 328, 0, 255);
  }
  else remap_brake_left = 255; 
  if (remap_brake_left < 0) remap_brake_left = 0;

  val_brake_right = analogRead(SENSOR_RIGHT_PEDAL);  
  if (val_brake_right <= 328) {
    remap_brake_right = map(val_brake_right, 200, 328, 0, 255);
  }
  else remap_brake_right = 255; 
  if (remap_brake_right < 0) remap_brake_right = 0;  

/* 
  // ARDUINO SETUP

  // Neutral sensors setup
  Serial.print(val_left); 
  Serial.print(" | " );     
  Serial.println(val_right);
  delay(400);

  // Output setup
  Serial.print(remap_brake_left); 
  Serial.print(" | " ); 
  Serial.println(remap_brake_right); 
  Serial.print(" | " );   
  Serial.print(rudder); 
  Serial.print(" | " );     
  Serial.println(tuning_rudder);
  delay(400);
*/

  // --------------------------------------------------------
  // SEND DATA TO digiPOTs
  // -------------------------------------------------------- 

    digitalWrite(CS_RUDDER, LOW); 
    SPI.transfer(0b00010001);   
    SPI.transfer(tuning_rudder);          
    digitalWrite(CS_RUDDER, HIGH);
    delay(5); // Delay for data time smoothing
    
    digitalWrite(CS_LEFT, LOW); 
    SPI.transfer(0b00010001);   
    SPI.transfer(remap_brake_left);          
    digitalWrite(CS_LEFT, HIGH);
    delay(5);

    digitalWrite(CS_RIGHT, LOW); 
    SPI.transfer(0b00010001);   
    SPI.transfer(remap_brake_right);          
    digitalWrite(CS_RIGHT, HIGH);
    delay(5);
}

Credits

Steve Massikker

Steve Massikker

6 projects • 166 followers
I'm Steve Massikker, a graphic and visual designer and former engineer of civil aviation.

Comments