Quadratic encoders - voltage issue

Using encoders with the MCP product line
Post Reply
cgirerd
Posts: 5
Joined: Tue Jul 16, 2019 11:09 pm
Quadratic encoders - voltage issue

Post by cgirerd »

Hello,

I am using a MCP236 Brushed DC Motor Controller, and have issues to read quadratic encoder inputs. The controller is powered by 12VDC on the B- and B+ pins. I am connected to the controller via USB, and have this motor plugged into it: https://www.pololu.com/product/3497 with this encoder attached: https://www.pololu.com/product/3499. The motor is connected to the pins M1A and M1B. The encoder is connected to this extension: https://www.pololu.com/product/3596. It is connected to 5VDC on pin 3, to the ground on pin GND, and the 2 output channels of the encoders are connected to pin 14 and 15.

When I manually rotate the encoder and the 2 output channels are not connected to the encoder, I can measure either 0 or 5V on these. However, when I connect them to the controller, the voltage is either 0 or 1.5V. So the voltage is much lower.

In the Basicmicro Motion Studio, if I set these inputs as analog, I can see the corresponding voltage displayed. However, if set to pulses or quadratic encoder, I am not able to detect any pulses. I guess it is due to the drop in the voltage from 5 to 1.5 when connected to the controller, which is to low to be detected as a pulse by the controller.

Are there some steps that I miss or something I am doing bad? Your help would be greatly appreciated.

Best,

Cedric
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Quadratic encoders - voltage issue

Post by Basicmicro Support »

I've never used these Pololu encoders before, but it sounds like you need a stronger pull-up on each encoder signal line.

Because of voltage and current protection on the MCP pins, there is an effective 3.4Kohm impedance from each pin to ground(eg 3.4k pulldown on each pin). If you encoders pullup is very weak(10k for example) that would explain almost exactly the 5v -> 1.5v drop. You can fix this by adding stronger pullups on the signal lines. A 2k or lower pull-up resistor should fix the problem if I am correct in my guess.

Alternatively, a buffer would fix the problem as well.
cgirerd
Posts: 5
Joined: Tue Jul 16, 2019 11:09 pm
Re: Quadratic encoders - voltage issue

Post by cgirerd »

I've added some 2.2k pullup resistors on the 2 encoder channels and it raises the voltage enough now for the controller to detect it.
Thank you very much for your fast reply and your help, this was very useful!
James
Posts: 21
Joined: Thu Oct 24, 2019 3:38 am
Re: Quadratic encoders - voltage issue

Post by James »

Please include somewhere in that manual (preferably on the wiring section) that there are 3.4k pulldown resistors connected to the DIN pins, I just ended up having to redesign and rebuild an expansion board to include strong pullups (since my encoders have 100k pullups). And that was after spending an entire day checking and rechecking my own work to make sure I hadn't messed up somewhere...
Go tell the Spartans, stranger passing by,
that here, obedient to their laws, we lie.
James
Posts: 21
Joined: Thu Oct 24, 2019 3:38 am
Re: Quadratic encoders - voltage issue

Post by James »

May I suggest that in future production runs, you replace that 2.2k pulldown resistor, with a 220k one?
The voltage divider formed with the 1.2k series resistor would then barely affect the input voltage, and you would still have the input pin referenced to ground (and not left floating) when not used.
Afaik, most I/O pins of the STM32 are 5-V tolerant anyway...
Go tell the Spartans, stranger passing by,
that here, obedient to their laws, we lie.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Quadratic encoders - voltage issue

Post by Basicmicro Support »

We do plan on changing those values on a future revision. Even though many ST pins are 5v tolerant not all are(specifically the A/D capable ones) and we have A/D pins multiplexed to most/all the user accessible pins.
That means all/most user pins need internal voltage dividers, clamping circuits and current limiting added. I cant say what the values will change to but they will be raised at least an order of magnitude(12k/22k). Probably a little more. The limit on the high end is impedance. You cant get good A/D conversion(eg fast) on high impedance inputs(the original reason for the low resistance dividers).
James
Posts: 21
Joined: Thu Oct 24, 2019 3:38 am
Re: Quadratic encoders - voltage issue

Post by James »

Just don't increase both resistors, because the ratio won't change and the signal level issue will persist.
If voltage clamping is an issue, you might want to consider a fast TVS like NXP's PESD3V3, which clamps at 3.3V, so the resistor divider can have a more... relaxed session.
Go tell the Spartans, stranger passing by,
that here, obedient to their laws, we lie.

Post Reply