Post Go back to editing

Incremental Encoder (hw simulator)

Category: Hardware


I am designing a new board with MCU and with 2 output signals that simulate an incremental encoder (see schematic of board and characteristics of A and B signals in the figure below).

These 2 signals are set up with a 90° offset, which is required for the detection of the encoder’s rotation. The board is supplied with a voltage from 10Vdc to 30Vdc and also the A and B signals drived by the board have the same voltage. The A and B signals have a max output current of 20mA and are short circuit protected.

My question is: is there a device (or a circuit) suitable to drive my output A and B?

Best regards,


  • Hi AndreaB,

    So are you asking for essentially a level shifter?

    One fairly straightforward way to do this is to use a SPDT analog switch for each signal (one switch each for A and B). Connect the MCU signal to the switch's control input, and connect the two inputs of the SPST switch to ground and the supply voltage. The switch output is then a level-shifted version of the MCU pin's state.

    For example, refer to the ADG5243 datasheet. If you connect the MCU "A" signal to IN1, S1B to ground, and S1A to the supply voltage, D1 is the level-shifted "A" signal.

    You will need to test this circuit, particularly at the maximum operating frequency / simulated encode rate. The ADG5243 specifies a break before make time of 115 nS, during which the D signal will be floating. You will need to examine the transitions on the D output, and make sure that the signal shape is acceptable. Examine all of the other timing parameters and make sure it is acceptable for your application.

    If you do end up investigating this approach and have specific questions about a particular switch, or about product selection, please ask in  Switches/Multiplexers .

    For short-circuit protection, a simple approach is to use a PTC protection device, from Littelfuse or other manufacturer. For reference:


  • Hi Mark,

    a voltage level shifter can be the right solution.

    The A and B signals have a max frequency o 2kHz.

    In first I thought about using, for example, the MAX44246 (an OpAmp). And using an eFuse to protect the output from the short circuit.

    What do you think about an OpAmp? And about an eFuse?


  • Hi Andrea,

    While an op-amp could in theory perform this function, I believe you're trying to produce a logic high level equal to the 10-30V supply voltage? With an op-amp, you'd have to adjust the gain for different supply voltages, and you need to make sure that the op-amp output has sufficient headroom to both the positive supply and negative supply in order to prevent saturation, which takes a long time to recover from. There are lots of other subtleties, some covered here:

    A level shifter made from analog switches seems like a better approach. Note that if you search for "level shifter", you'll mostly end up with lower voltage devices for translating between different CMOS logic standards (1.8V, 3.3V, 5V, etc.)

    For the eFuse - you will have to find one that meets your requirements - protects both the device you're testing, as well as this circuit.