Double-sided tape. Normal is thin and not very strong, better is mounting tape. Silicon should also be ok.
Where can the program be downloaded no address? Thanks SZZYY for all the help with this project!
I donât understand what you are asking. How to upload software to Leonardo? You need connect board to PC via USB, start Arduino IDE, select âArduino Leonardoâ from top âselect boardâ menu. On bottom right should be text âArduino Leonardo on COMx connectedâ. Next paste code to new sketch and select SketchâUpload. If you have errors that something is not compiling then probably you need install joystick library (sketchâinclude libraryâadd zip library). Looks like install lib from original post is not working because of new IDE UI changes.
Hi sorry about the confusion. In the problems section you write Can be downloaded from here: but there is no address for the program. I want the program because I want to add a flaps trim and a aileron trim wheel. Again sorry I should have been clearer.
Looks like admin removed the link. Here is the drive link:
https://drive.google.com/file/d/1fLOMFunNMqhEuIJFKU-veDS13urU7Phu/view?usp=sharing
But this was designed for MSFS2020, probably will not work in 2024. I donât have 2024 yet, so canât create new version, but I can post source code and maybe somebody can make it working in 2024. If exe is displaying errors with missing dll, this need to be installed:
Usage is: run command prompt to see errors, run âTrimWheel2020.exe COMnumberâ. Check Arduino port number in Device Manager->Ports, default for me was COM7. Then in command prompt you should see logs what is going on. First âConnecting to Flight SimulatorâŠâ, then after sim load âConnected.â, then if everything is fine: on start, flaps and autopilot you should see text âTrim: xxâ. This will send trim data to Arduino to set proper value.
Hello SZZYY: I am still on MSFS 2020 and plan to stay with it. I being a complete noob to programming and fabrication have found this most helpful. Thankyou so much! I will read up on the link you sent. I have another question that is off topic so feel free not to answer. I am building a button box that will house this trim wheel and 10 splsl 12v toggle switches with internal ledâs and be powered and operated with arduino leonardo board. Do the internal LEDâs in these toggle switches need to have a separate 12v power system with resistors and transistors and a separate grounding bar to operate?
Sorry for late reply, but I didnât get email notification. Arduinos operate at 5V (some lower specs at 3.3V), so for 12V you need separate power supply. Probably Arduino should drive only MOSFET and MOSFET will drive LED. I am programmer and my electronics knowledge is at amateur level, so I donât want to give any recommendations, but I am pretty sure that there is a lot of info on the internet on this popular topic.
Hello SZZYY: Thanks again for your help! I have the arduino pro micro clone and plan to solder the 7,8 and ground pin in the next couple of days and then start on the programming. Iâve never programmed anything before so I will follow instructions to the letter and hope for the best! Iâll probably have some questions so stay tunedâŠ
Hello SZZYY: Bad News! When I attached the board to the computer after I soldered the pins I plugged the board in and it showed a green and 2 red lights. I obtained the leonardo editor and pasted the code into it and tried to compile it but it said the joystick location didnât exist. I checked the device manager and it says its operating properly and connected to com4. I know how to reset the board with the pins ground and reset?
Progress: Itâs Alive! Itâs just the y axis correct? Thanks so much for the help!
said the joystick location didnât exist
You need to install joystick library from the link (sketchâinclude libraryâadd zip library).
I checked the device manager and it says its operating properly and connected to com4.
It always will be visible in windows when connected. To check if software was properly compiled/uploaded and if is working you need to do âHow to test the trim:â from first post.
I know how to reset the board with the pins ground and reset?
Easiest reset is to unplug from USB and connect again.
Itâs just the y axis correct?
Idea behind this is that wheel is using analog joystick Y as output (doesnât matter if this is X or Y). This way wheel will work in any Windows/Linux and any flight sim.
Thanks Again SZZYY: The wheel worked in the test. It appeared to take quite a few turns to go top to bottom in the box. Which calibration should I use the sim or windows? I will hold off on using the programl link for the autopilot till Iâm finished construction.
Speed of wheel is as designed. Must be slow to be precise. In sim such speed is the best. I tested slower and faster and this speed was the best for precision and enough speed. Problem with digital rotation is that is has max 30 position per rotation which is not enough. Maybe you bought bad encoder with 24 or less positions? Such encoder would be slower. Try to count how many clicks has one full rotation. Analog rotation would have much better resolution. With big wheel it would be 10x better. But analog position couldnât be reset/set by external program without motor, so wouldât be possible to use external program for start/autopilot/flaps trim. If you really feel that in sim (not in test) speed is bad you can change:
#define ROT_RESOLUTION 255 /* 1 impulse = 100%/255 = 0.4% of max trim */
to smaller value if you want faster wheel but less precise. But this change would also require other change if you want to use autopilot program. After
RotVal = (Serial.read() << 8) | Serial.read();
you need add new line with code:
RotVal = (RotVal * ROT_RESOLUTION) / 255;
Because external program ROT is 255, this line will convert it. Without this line autopilot and flaps will give wrong values to wheel.
I counted the detents and it is 30 and my wheel is 92mm. I never used a trim wheel before so this is probably normal. Another question: If I wanted to add 2 more encoders for flaps and ailerons which pins would I use on the pro micro and I would need a separate code for each one? Thanks Again SZZYY! If you get sick and tired of my noob inquiries let me know and Iâll stop.
I think 92mm wheel is too big. Resistance at encoder will be too small for big and heavy wheel. It will be hard to do a precise rotation. I tested different size wheels and 50-60 was a sweet spot. I recommend to do a second encoder with smaller wheel and test it in the sim during flight.
Easiest way is to double or triple all variables and all code, ROTPIN_A, ROTPIN_B, PrevStateAB, RotVal to RotVal1, RotVal2, RotVal3 etc. You need also double or triple Joystick.setYAxisRange and Joystick.setYAxis with X and Z axis. And change âfalse, true, false, // only Y Axisâ to âtrue, true, falseâ or âtrue, true, trueâ. Clever way is to use some programming skills and to do one function to handle three wheels.
if (Serial.available() > 1)
{
RotVal = (Serial.read() << 8) | Serial.read();
}
this should stay as it is with RotVal1. Proper support of this will require some (or maybe a lot) changes in external program to support more than one.
Regarding pins any other with number should work.
Hi SZZYY: I tried a 50mm wheel and it is more ergonomic. Thanks for the info! I think Iâll mess around with this wheel and get it just right before I add more to the mix. Again Thanks Very Much for all your help and letting me use your code and the step by step instructions and pictures!
Yes, testing during flight different setups is the way to go. Rule of thumb is that high resistance encoder can go with bigger wheel, low resistance will work better with smaller wheel.