Sim racing handbrake

Hi all,

I have bought all the things to make a handbrake for my sim racing setup.

I am trying to create an analog sensor code for use in game and just wondered if anyone could give me a point in the right direction (in regards to how to code this). all i need it to do is once the pressure applied on the handle, its sensed by the sensor it reads in game as me applying the handbrake but i would like it to sense when i have only pulled the handbrake arm a little or a lot?

this is the sensor i have bought!



First thing for you to do is to program and wire on of the myriad of potentiometer examples to the ADC on your selected (but not listed) Arduino. Then report back and we can give you the next step.

P.S. this really only has two steps, but you can't do step 2 until you have completed the potentiometer ADC program in step 1.

Hi its an arduino nano i have. I dont have a large electronics knowledge. So you will have to bare with me! program and wire on Myriad potentiometer?

You'll have to look at the sensors datasheet to see what communication method it uses. I guess from the title the sensor outputs a analog voltage proportional to the sensed pressure? Start your arduino IDE, load up the AnalogInput example and connect your sensor appropriately. Then you can look at the readings from the ADC on the serial monitor.

From there on it should be easier to come up with a concept that allows you to transfer the readings to your game :wink: For the little or large pull on the handbrake you might want to look at the rate of change of the sensor readings.

yeh your right, it does output an analog voltage to the amount of pressure applied to the switch. The handbrake reservoir will have liquid in which is in turn pushed into the sensor when the handbrake is applied. yeh id imagine once i know that it reads correctly i just need to get a game controller such a ppjoy (or similar) then just open the game and calibrate the handbrake like i do for the pedal ,wheels and gearstick?

Yes, that seems about right. You would need to do the detection of a "little handbrake" and "a lot of handbrake" in the arduino code though, I think.

EDIT: Take a look at this thread.

Hi its an arduino nano i have. I dont have a large electronics knowledge. So you will have to bare with me! program and wire on Myriad potentiometer?

I have used these and know exactly how to read them. Which is all irrelevant if one does not know how to program, connect the devices, or use the tools required.

Start simple then move on.

Analog Input Tutorial

Please complete then report back.

Lightuc - thanks for that looks promising his code is for an x an y axis potentiometer and mine has liquid pressure which id guess is one axis haha but ive modified his code for that to use single axis but i dont have the adruino yet ( only just ordered it) so i cant test it yet but this is what it is and its not throwing any error codes.

byte x;

int x_pin = A0;

void setup() {



void loop() {

x = analogRead(x_pin) / 4;

Serial.print(242); // 240 plus the number of channels

Serial.print(0); // button presses




I realize you don't have the Arduino to test. You have a nice short program. But what do you think it will do when you get your Arduino? So in the time before it arrives, please describe here what you think each of the lines of code does. Yes, I see some problems but that doesn't matter. You need to see the problems.

Also, why do you declare the value of x as a byte rather than unsigned integer? You divide the analogRead (0-1023) by 4 which will then fit into the byte (0-255) . That is good, but you have reduced you resolution by a factor of 4.

okay so i have revised my code with resources from the adruino website and think this may work?

int analogPin = A0; // Pressure transduce/sensor (analogue ouput wire) connected to analog pin 0
// outside leads to ground and +5V
int val = 0; // variable to store the value read

void setup() {
Serial.begin(9600); // setup serial

void loop() {
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value