Encoder reading problem

Questions about using encoders with the Roboclaw product line
Post Reply
Ocellatus
Posts: 3
Joined: Tue Jan 05, 2016 11:36 am
Encoder reading problem

Post by Ocellatus »

Hi there,

I am using a V5 RoboClaw 2x15A controller with 4.1.16 firmware for closed-loop velocity control of a 18v 3000 RPM brushed DC motor and I have coupled an Autonics rotary encoder with the motor. The encoder is a 1000 pulse per revolution and got 3 channels A,B and Z. I have ignored the index channel and just connected A and B quadrature channels according to the RoboClaw user manual. An external power supply with common ground with RoboClaw is used to power up the encoder since it requires 12-24v to work.

As for the first experience with this controller, I started with USB mode. I can successfully connect to the device using the IonMC software and speed up the motor with PWM setting. However, there is a problem in encoder measurements as described in the following.

If I manually rotate the motor shaft for 1 revolution, the encoder reads for about 4000 counts which seems correct since the controller is counting both rising and falling edges of both channels so it is 4x1000 counts/rev. And if I give it a small duty cycle like 10%, the readings still seams correct for speeds of lower than about 6000 per second (1-2 rev/s). But as the duty cycle and motor speed increases from that point, the encoder counter and speed strangely start slowing down. For duty cycles more than about 20% the counter barely increases anymore and the speed reading wobbles around 0.

In conclusion, the encoder seams to work correctly only in very slow speeds. in higher speeds it starts reporting wrong counts and finally almost stops counting in mid and high speeds.

I wonder if I have missed something in wiring or software settings, or it could be the encoder itself malfunctioning. Considering the later case, I remember that a few months ago I tested the same hardware assembly (encoder-motor) with an Arduino and L298 driver, the encoder (tested using 1 channel) seamed to have no problem reading high RPMs.

Any advice is appreciated.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Encoder reading problem

Post by Basicmicro Support »

First, which Autonics rotary encoder are you using(model please). They have alot of different ones. Also you should check the datasheet on the encoder and make sure it outputs 5v TTL pulses. Some encoders expect external pullups be added to their signal lines as well so they can work with any number of possible voltage level devices(this is more common on higher end encoders like your but since I dont know the model I cant confirm).

Second you need to look at the pulses being generated while the problem is happening(with an oscilloscope). It will probabyl be obvious if there is a problem with the signal.

It definitely sounds like there is a problem with the signals being read as the speed increases. This could be noise related(I've see motor noise cause problems on a cheap china motor with integrated encoder just this past weekend). I had to use an oscilloscope to see the noise on the signal and 5v power rail caused by an incorrectly snubbed motor.

The Roboclaw has been tested with systems that produce millions of counts per second(100000rpm motor with 2048 count per rev encoder for example) and is theoretically capable of handling up to 19.6 million counts per second(tested with simulated encoder signals) before it would start losing counts so it is unlikely the problem is in the Roboclaw processor. Signal quality issues are most likely.
Ocellatus
Posts: 3
Joined: Tue Jan 05, 2016 11:36 am
Re: Encoder reading problem

Post by Ocellatus »

Thank you very much for your reply. I really needed that kind of comprehensive advice since I am rather new to electronics.

The Rotary Encoder is a Autonics E40S6-1000-3-T-24
The data sheet is provided here:
http://download.autonics.com/upload/dat ... 150805.pdf

From what I understand from the data sheet, the output is not 5v TTL pulses but the voltage level is something about the power supply voltage level which would be 12-24v. Could you please take a look and verify this? If this is the case, a brief description of the solution (pull-up resistors?) would be very helpful.

I also understand from the data sheet that there are several types of outputs and this specific encoder is using totem pole output, is there any action needed in this regard?

I will try an oscilloscope in the next tests as you advised.
Thanks again for your help.
User avatar
Basicmicro Support
Posts: 1594
Joined: Thu Feb 26, 2015 9:45 pm
Re: Encoder reading problem

Post by Basicmicro Support »

This encoder will not work with the Roboclaw without modifying the signals it is outputing,

1, A toten pole driver outputs true high and low signals(eg not open drain highs). According to the data sheet the encoder will output a minimum high of 24v-3v(eg 21v) for its high side pulses.

2. The roboclaw inputs are 5v tolerant only. 24v may damage them. As long as the time the pins were high is short enough you may not have damaged the protection diodes(they are rated for 150mw each) but that could explain your encoder reading problem. The zenor diodes will shunt that 12v/24v into the 5v rail(through the 100ohm current limiting resistors on our boards). That would cause glitches on the 5v rail.

So you have several options.

1. Use a 5v totem pole model enoder and power it directly from the Roboclaws 5v rail(assuming you dont already have 5v available elsewhere.

2. Use an open collector or voltage output model. The open collector model would need a pullup to 5v on each encoder signal line(can use the roboclaws 5v rail for this). I beleive the voltage output model would also work this way but Im not 100% sure of that.

3. Use the 24v totem pole model you have now and add an opto-isolator between the encoder and the roboclaw signal inputs. I would not recommend this unless you really need the isolation, except for testing if you cant get another model of the encoder right now.
Ocellatus
Posts: 3
Joined: Tue Jan 05, 2016 11:36 am
Re: Encoder reading problem

Post by Ocellatus »

Sorry for the late response and thank you very much for your advice.

I successfully tried a 24v Buhler motor (model 1.13.044.023) with an integrated 400 cpr optical encoder (model HEDS 9100). This encoder outputs 5v ttl compatible signals so everything was fine. Using IonMotion software I am reading 1600 counts per revolution in total for two channels. No problem in high speeds (tested up to 80000 c/s for 12v motor supply) and auto tune function works great for closed-loop velocity control.

I am going to use advanced serial packets in order to meet my project requirements. I will come back to you if I had problems with the packets.

I may also try to test the previous 24v Autonics encoder again later. I have already provided an opto-isolator module.

Thanks again for your great product and support.

Post Reply