Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26
  1. #21
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    763
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    I done a bit of digging on this one and basically haven't really come up with much.
    You've tried everything I would have done and there not much left other than to hack into the library files.
    You could try that idea that Lee dropped in, but I think (code wise) it is the same as what you have been doing ??? (Thanks Lee)

    One silly thing tho ,,, make sure the GND from the Ardruino is connected to the center pin of the rotary encoder and the 2 outside terminals on the encoder are connected to input pins on the Arduino. (Yea yea ,, I know ,,, but it does happen)

    The problem would appear to be with the quarter cycle encoders you have ,, I haven't got any as all mine are half cycle or full cycle per indent so I cant test or fiddle with anything to try it out.

    If no-one else pops up with idea's or hints ,, have a dig thru the other encoder librarys that are out there and look out for any that will do quarter cycle encoders.

    There is my older list on ,,,
    http://www.jimspage.co.nz/encoders2.htm

    and ,,,
    http://arduino.cc/playground/Main/Ro...oders#Example1

    and ,,,
    http://www.pjrc.com/teensy/td_libs_Encoder.html

    Sorry ,, I'm not much help ,,, Jim
    Last edited by Jim NZ; 11-06-2012 at 05:12 AM.
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  2. #22
    10+ Posting Member
    Join Date
    Feb 2011
    Location
    Williamson, GA, USA
    Posts
    23
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Hi Jim of NZ, We appreciate the help you have provided for all. I just visited the "pjrc.com" link and really like the info presented. Seems to me the interrupt pins would be important and I have been wondering about the resistors and capacitors that they use in the pic. I seen a youtube short using this same setup and he was happy with it. Question: are you using resistors/caps with your setup and what encoders are you using if you don't mind sharing this info. Thanks again. Lee
    We were meant to fly, even with a computer.

  3. #23
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    763
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    OK Lee ,, I done a bit of playing with this last night and as I dont have any 1/4 cycle encoders, I just hooked up a couple of buttons ,,, well it appears 1/4 cycle encoders wont work with Keith's library. Half cycle and full cycle encoders work fine.
    I was thinking of doing a hack to his files but I'll never get time. Maybe some-one else might.

    The resistors and caps. appear to be a debounce arrangement but you dont need them with Keith's library, so I dont use them.(The encoder is wired dirrect to the Arduino)
    In effect with all the methods I tried, some still needed external debounce added ,, some didn't. I havent tried Pauls library (pjrc's) as it wasn't around when I done my research but even now I havent tried it because to work properly the encoders need to be hooked to specific pins which can be a real pain in long PDE's.

    I cant remember where I got my first few encoders from but I got a big bundle from ,,,
    http://www.ebay.com/itm/350622238259...=p5197.c0.m619
    Basically it's "Sure Electronics" but they market different items on ebay under different "shop" names.
    They work fine. (Although the price has risen considerable since I got mine. )

    Cheers ,,, Jim
    Last edited by Jim NZ; 11-07-2012 at 05:20 PM.
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  4. Thanks Louie Mendez thanked for this post
  5. #24
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Feb 2015
    Location
    Colombia
    Posts
    8
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    Quote Originally Posted by Jim NZ View Post
    Hi Guys ,, Some Guys were having trouble integrating the rotary encoder thingy into their projects so I've done a wee help file consisting of including a rotary encoder into my "Demo" PDE's.

    It's available here ,,,,
    www.jimspage.co.nz/rotary_encoder_help.zip

    Hopefully it might "unstick" some coders out there.
    Cheers ,,, Jim
    Not Found, up new help code thank you jim nz


  6. #25
    New Member
    Join Date
    Feb 2017
    Location
    Germany
    Posts
    1
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.



    Hi,

    I use a hardware solution for this problem, see attachment. I found itsomewhere in the Internet, there are many similar solutions. If you are a bitexperienced in soldering some parts, this is a fast and simple solution thatneeds only a few rows for the arduino sketch, see below.
    This hardware generates a clock-pulse if the switch is rotating and this pulsewill trigger the interrupt 0 (zero) on pin 2 at the Arduino UNO. A secondsignal called “direction” and connected to pin 3 of the Arduino UNO will showif the switch is rotated clockwise or counterclockwise. Both signal incombination increase or decrease the counter. Because the clock signal triggersthe Arduino only on the rising edge you can count every single pulse!



    But pleaseremember that different Arduino models use different interrupts on differentpins. Please refer to the manuals for this.

    /*

    Rotary switch decoder with really no software effort !!
    No additional library needed!!
    Needs also no CPU time if rotary switch is not in use!!
    Fast and easy!!
    But needs a hardware solution to get an interrupt and direction pulse!
    Works fine on Arduino UNO, please remember that other Arduino models havedifferent
    interrupts on different pins!

    by Andreas Beermann, february 2017

    */

    #define interruptPin 2
    // Pin 2attached to Interupt 0, Clock from Rotaryswitch
    #define DirectionPin 3
    // Pin 3used for direction of Rotaryswitch
    int Rotary = 0;

    void setup()




    {



    Serial.begin(9600);

    attachInterrupt(0, Rotaryswitch, RISING);
    // triggers on rising edge
    pinMode(interruptPin, INPUT_PULLUP);
    pinMode(DirectionPin, INPUT_PULLUP);

    }

    void loop()
    {

    Serial.print("Rotary = ");
    Serial.println(Rotary);
    delay(100);
    // only output will be delayed, not thecounting of pulses

    }

    void Rotaryswitch()
    // If rising edge on Pin 2 is detected andinterrupt triggered




    {
    if (digitalRead(DirectionPin) == HIGH) Rotary++;
    if (digitalRead(DirectionPin) == LOW) Rotary--;
    }




    // end of sketch !!

    At this time I want to thank Jim from New Zealand so much for the Link2FSstuff, I'm just building analog instruments for my FSX using stepper motors tomove the pointers and this was exactly the interface I was looking for !!!Thanks a lot to JIM !!!!


    Hope you'll find this also as useful as I did.
    Attached Files Attached Files

  7. #26
    New Member
    Join Date
    Jan 2006
    Location
    Florida, USA
    Posts
    4
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: ROTARY ENCODERS and the like.

    For a less expensive encoder board, I used the 2090 board from Desktop Aviator
    http://www.desktopaviator.com/Produc...2090/index.htm

    The price is right and it works on both FSX and X-Plane flight simulators

Page 3 of 3 FirstFirst 123