Measuring angles with Arduino

Hello! I am working on building rudder and brake pedals for my flight simulator using an Arduino Leonardo as an HID joystick. What would be the best way to measure the angles of the pedals without spending more than $10-20 or so total for four measurements (two brake pedals and two rudder pedals)? I already have the Leonardo.

An angle needs TWO sides to define an angle. Your pedal is one side. What is the other side?

The other side will be the vertical board to which the pedal is attached.

Does the angle have minimum and maximum degrees or radians?

I haven't built the pedals yet, but probably about 10-60 degree range.

Perhaps a potentiometer, either standard or linear would give an analog to the angle. A varying voltage that could be converted to an angle.

A 3D accelerometer can accurately measure two independent tilt angles with respect to vertical, with very simple code.

See How_to_Use_a_Three-Axis_Accelerometer_for_Tilt_Sensing-DFRobot

That's one thing that I've thought about. I have heard some people say they don't recommend potentiometers for things like this because they tend to wear out after some time, but I don't think it would fail too quickly? I have seen Hall effect sensors recommended for this; I guess that would work by having a magnet attached to the pedal and the sensor on the vertical board and vice versa?

Thank you for the suggestion! It looks like good accelerometers cost a bit more than I'm looking to spend, but I will keep that in mind.

In past years we camped several times on the Cheto. Thought about moving to Brookings until a weekend visit in February when the morning temp was 24 degrees. Some pipes in the motel wer frozen. No industry or big businesses. Thought of electronic service, but limited service ares. So stayed in Portland at that time. Good luck on your project!

Back in the 80's/early 90's most joysticks were potentiometer types. I've never worn one out and if you do, pots are cheap enough to replace.

1 Like

Hello OM kj7rrv

Do not buy cheap trash from Asia!

Why not?
I am buying most electronics on Aliexpress and 95% of my purchases are successful.

see this, it is only $11.99 for 5 pcs

https://www.amazon.com/ACEIRMC-CJMCU-103-SV01A103AEA01R00-Trimmer-Potentiometer/dp/B094XT5WMS/ref=sr_1_1?crid=2EPQ6I9ESQ00M&keywords=CJMCU-103&qid=1689751062&refresh=1&sprefix=cjmcu-103%2Caps%2C382&sr=8-1

If you buy cheap, you always buy twice.

...sometimes even triple or five times for the same price ^)

1 Like

I think you can proceed this way:

  1. Arduino Leonardo
  2. 4 x Potentiometers (also known as pots) - linear or rotary, depending on your pedal design
  3. 4 x knobs for the potentiometers (optional but useful for easier control)
  4. Breadboard and jumper wires

Potentiometers will do the job quite well. The main issue is mounting them so they don't break. They have to be mounted in a way so they're not carrying any of the force from the pedal.

Ideally you'd couple them to the pivot of your pedal through a belt (I like heavy duty rubber bands for cheap belts) or a length of tubing. You can buy shaft couplers that handle a few degrees of misalignment, but they may not fit in the whole "under $20" thing.

1 Like

Thank you! Are there any images showing how that would be set up? I understand the concept, but not quite how to actually do it, and I'm not finding anything online.