Bits and Droids logo
Mail icon

A320 miniature speed brake lever

3/30/2024 | by Bits and Droids

Let's look at how you can create your personal speed brake lever with a single component and a microcontroller. I usually do some field research before I start a project like this. I was browsing the web, watching videos, and being blown away by the technical capabilities some people possess. That's not what I want to achieve. I want to provide you with a simple guide that teaches you how to create a project like this, code a project like this, and, most importantly, provide you the opportunity to complete this project without using expensive equipment or complicated techniques.

Assembly

Before creating anything, we need to assemble our miniature speed brake. If you own a 3D printer, you can use my 3D files found on Thingiverse. You're also able to create your design with the same code. Theoretically, you only need a Microcontroller/Arduino and a potentiometer (or Hall effect sensor).

What I used in this article (* Amazon affiliate links that help support the channel):

  • Rubber seal rings* (I bought them in a set)

    https://amzn.to/3y2E4tJ

  • Arduino Leonardo*

    https://amzn.to/3y2E4tJ

    or a MEGA/Uno

    https://amzn.to/3pzANyq

  • Dupont cables*

    https://amzn.to/3ImgxJa

  • 10K Potentiometer*

    https://amzn.to/31A99cd

Tools I've used :

  • Ender CR6-SE*

    https://amzn.to/3GfE2Sd

    and Ender 3 Pro

    https://amzn.to/3GiNvbA

  • Hako soldering iron*

    https://amzn.to/32P0tiz

For complete assembly instructions, I'd recommend watching the YouTube video.

https://www.youtube.com/watch?v=5IPCI8xLGZU

The code

The code should look familiar to those who followed this channel. Before we write any line of code, it's essential to formulate what we want to achieve.

In Microsoft Flight Simulator, the A320 has a speed brake lever. Our end goal is to match the position of the physical lever we've just created with its digital counterpart. Most axes have a scale of -16383 to 16383 in MFS2020. Our Arduino reads our analog signal from 0 (fully closed) to 1023 (fully open). We could map the range of our Analog signal to the speed brake axis, but in reality, we don't use the full range of our potentiometer (unless your gadget supports the full range of the potentiometer. To quickly determine the practical range we can work with; we can use Arduino's analogRead function.

cpp
//Where we connected the potentiometer to our board const byte speedBrakePin = A0; void setup() { //To display data and send commands Serial.begin(115200); } void loop() { //We read the data and print the result to our Serial.println(analogRead(speedBrakePin)); delay(100); }

If you move the speed brake from fully open to fully closed, you can read the minimum and maximum values from the serial monitor. In my lever, the fully closed value is 50, while the fully open value is 350. This gives us all the data we need to start mapping our current lever position, so write these down.

If you've already downloaded the connector, your next step will be to install the WASM module. If you've installed the game through the Windows Store, you can open the connector, click on the WASM menu item, and hit install. If you use the Steam version of the game, you could copy and paste the BitsAndDroidsModule folder from the connector to the community folder of MFS2020.

It's time to add your custom minimum and maximum values. Open the events.txt file in the community folder. Search for the following line:

(>K:AXIS_SPOILER_SET)^9#3000-700+930$0//

Replace the values at the - and + signs with your custom values. The - represents the minimum value (fully closed), while the + represents the maximum value (fully open).

cpp
#include <BitsAndDroidsFlightConnector.h> BitsAndDroidsFlightConnector connector = BitsAndDroidsFlightConnector(); const byte speedBrakePin = A0; int oldBrakePosition; void setup() { // put your setup code here, to run once: Serial.begin(115200); } void loop() { // put your main code here, to run repeatedly: int currentBrakePosition = connector.smoothPot(speedBrakePin); if(abs(currentBrakePosition - oldBrakePosition) >= 1){ oldBrakePosition = currentBrakePosition; Serial.println("3000 " + String(oldBrakePosition)); } }