View Full Version : FS2P and Rotary Encoders
Tom_G_2010
09-29-2011, 01:29 AM
I've been reading a bunch of posts about various I/O cards that can read rotary encoders. I know Phidgets makes a single encoder, but it's a bit pricey and I don't believe it can talk to FS2P. While I did find a few references to encoders, phidgets and FS2P none directly answered if it was possible to use a digital I/O phidget and configure FS2P 4 or 5 to read an encoder properly.
I have a Leo Bodnar card and it can read the encoder but not if I spin it fast and the number or rotations needed to swing the OBS is a bit much. And, of course there aren't any scripting or coding options if I use Leo's card, that I know of.
Has anyone ever built a circuit in FS2P 4 or 5 that can correctly interpret an encoder? If that can be done it will save me some much needed cash for other pieces of the project as I already have phidgets cards either purchased or in the budget to handle other things so inputs are available to use for a couple encoders at no added cost.
AK Mongo
09-29-2011, 11:20 PM
I have a Leo Bodnar card and it can read the encoder but not if I spin it fast and the number or rotations needed to swing the OBS is a bit much. And, of course there aren't any scripting or coding options if I use Leo's card, that I know of.
Tom,
Pete has helped me with a LUA program for FSUIPC that allows for speed differentiation of encoders via Leo's card. I have dropped the ball on beta testing it, because I have had a major career change, but the basics are out there.
Please check out this thread, and maybe you can help to develop the script. Read the whole thing, as the sewcond iteration of the script is probably the best once fully tested. http://forum.simflight.com/topic/68260-rotary-encoder-input-speed/
Reid
Tom_G_2010
09-30-2011, 12:43 AM
Reid, thanks! I've printed out the thread. I know, not very green of me :-( but when I write scratch notes on the monitor my wife gets upset. :D
I've never touched LUA before, but it sounds like you hadn't either. I have a wedding to go to this weekend so I don't know what kind of time I'll have, but I'll be reading up on it as much as I can. I'm between build steps at the moment (actually between cash resources for parts) so I'm using the time to sim retrofit Cessna hardware that I already have and test/configure software. Good time to tackle another coding project. Unless of course I scrape up some cash and then it's off to the supply house to buy parts for my yoke and rudder linkages ;)
Again, Thanks!
Tom_G_2010
10-04-2011, 10:32 PM
Reid,
Have you had a chance to work on this? I have a couple hours into it and a few exchanges with Pete, but I've only been able to ge it partially working. I can get rotation in one direction but not the other.
Tom G.
AK Mongo
10-04-2011, 10:52 PM
Tom,
Sadly I have not. I got a little overwhelmed by the enormity of the programming task, and am "taking a break" from it. Was hoping you would get it figured out, so I could stand on the shoulders of giants! LOL.
Tom_G_2010
10-05-2011, 01:15 AM
No problem. I'm ok at picking up on scripting language, but this one is a bit involved as starter projects go. I'll keep hacking at it, and asking Pete's assistance as long as he is willing to offer it. Hope I don't wear out my welcome with him. In the grand scheme though I can't allow it to let me loose focus on the bigger tasks in my build. So this may take a while, but I'll be glad to keep you posted and share my results.
AK Mongo
10-05-2011, 08:47 PM
Thanks Tom.
I have been following the thread at Pete's forum, but that is about it lately. Between a new job, serving as a den leader for the cub scouts and coaching youth football, my sim time has been nil.
Wish I could help more, but have not had the time to learn the scripting process yet.
Reid
Tom_G_2010
10-11-2011, 09:56 PM
Thanks Tom.
I have been following the thread at Pete's forum, but that is about it lately. Between a new job, serving as a den leader for the cub scouts and coaching youth football, my sim time has been nil.
Wish I could help more, but have not had the time to learn the scripting process yet.
Reid
Reid,
I now have it all working! Pete found one last typo in the posted code and with that correction it's all good. Timing for fast rotation is for sure a season to taste kind of thing, but after dialing it in and testing it all works.
Let me know when you're ready to set it up and I'll be glad to assist if you'd like. That was quite an education.
AK Mongo
10-13-2011, 12:17 AM
Thanks Tom! Could I trouble you to PM me the "completed" Lua text to look at?
Reid
Tom_G_2010
10-13-2011, 07:36 AM
Reid,
PM has been sent.
I rechecked the bodnar site and for the particular model card I have he does state that diodes are needed if more than 3 continuous on switches might be used at the same time. That happens to be the case for mine so I have the diodes installed.
If you have any trouble with the lua script let me know and I'll be glad to help.