Forum Replies Created

Viewing 1 - 2 of 2 posts
  • LeoOfVenice

    Member
    May 2, 2021 at 4:12 pm

    Hello
    I’m going to make the same connection with the same Rotary Encoder.

    I have already done a test with arduino UNO board where channel A connected is to pin 2 and channel B connected to pin 3, to use interrupts, everything works fine here is the setup for connection on UNO BOARD.

    …..

    void setup() {
    pinMode(2, INPUT_PULLUP); // internal pullup input pin 2
    pinMode(3, INPUT_PULLUP); // internal pullup input pin 3
    //Setting up interrupt
    //A rising pulse from encodenren activated ai0(). AttachInterrupt 0 is DigitalPin nr 2 on moust Arduino.
    attachInterrupt(0, ai0, RISING);
    //B rising pulse from encodenren activated ai1(). AttachInterrupt 1 is DigitalPin nr 3 on moust Arduino.
    attachInterrupt(1, ai1, RISING);
    }

    …..

    Now, with CONTROLLINO I want to make same function and I’m happy to read your post with your suggestions but I am little confused (is possible to have a picture of the connections?):

    i am looking at your schetch:

    unsigned long A = 3; // ( is this interrupt pin ? )
    unsigned long B = 2;


    pinMode (A, INPUT); // not INPUT_PULLUP since we are attaching external Pullup reistors
    pinMode (B, INPUT); // not INPUT_PULLUP since we are attaching external Pullup reistors
    St.

    Are you using pin header or screw terminal?

    I suppose screw terminal, beacuse you connect PULL-UP resistors to 12V ,but If you are using screw terminals, why don’t you initialize them as A3 or A2 in the schetch, and you define input as 3 an 2 as PIN HEADER?

    <div>

    And instead..

    If you are using pin headers why do you use the PULL-UP resistor connected with 12 V and not with 5V ?

    (It would be interesting to be able to insert images in these posts.)

    Thank in advance for your help

    </div>

  • LeoOfVenice

    Member
    May 4, 2021 at 12:55 pm

    Thanks
    @Johnnycatt now it is clear…

    This is my first project with a CONTROLLINO MINI

    I’m following this forum for a long time to see how
    connect this kind of encoder …
    and finally saw your post. !

    It is a test machine to compress a spring and test speed in extension.

    In this project there is a pneumatic actuator, used to compress the spring,
    controlled by one relay port of controllino

    There is a magnetic sensor on actuator to report
    if the spring is compressed and start the measurement

    The encoder is used to calculate the speed of spring in extension

    At the end of spring stroke there is another
    proximity sensor to detect if the spring has ended its movement.

    All data are send on a NEXTION screen where buildng a GRAPH of speed.

Viewing 1 - 2 of 2 posts