Asked — Edited
Resolved Resolved by Dunning-Kruger!

Sabertooth/Kangaroo With Different Motor/Encoder Combination

Since I know some of you have used the Sabertooth and Kangaroo I figured I would ask opinions.

I have decided on the Parralax Arlo base for my next robot chassis. I will use the caster's from parralax.

I will most likely be using the Sabertooth and kangaroo combination for motor controller/PID but I am not decided on this and open to suggestions.

I also find myself in a heated mental debate between the wheel/motor combination from parralax or the Zagros Rex motors and wheels combined with the Sabertooth/Kangaroo.

Item 1:

One of the key items for me is how well the encoders between the two different motor/wheel sets works with the Sabertooth and kangaroo.

Item 2:

The other item floating in my mind is the ground clearance between the two motor/wheel sets. It seems at least to me that the Zagros wheels would provide more ground clearing but since the base plate of the chassis provides stability to the base platform I am not really sure if using the Zagros motors are feasible.

Item 3:

Since I am going to build a body, arms and head on top of the base the torque and weight carrying ability is important.

Item 4:

I need to be able to control both the position and speed of the motors at the same time. For example example I should be able to have to robot move lets say 1 feet at a certain speed.

I know this is kind of an open ended questions but if anyone have used any of these wheel/motor combinations please provide your 2 cents as it relates to the items listed above.

I appreciate any comments or insights you guys can provide.


Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.


Just a caveat... I bought an Arlo base and although an awesome base, I have to tell the encoder implementation is crap.... For one thing the encoders don't sit tight on the motor output shaft... One of mine got chewed up in the encoder board.... They lasted all of 10 minutes... Maybe you will have better luck... Personally I have my money on DJ's camera based indoor navigation system coming soon....

If you do buy the base get the aluminum wheels, I wish I had of. The plastic ones are a bit fragile....

Probably not your cup of tea, but the iRobot Create has all that implement in one neat little robot chassis... Encoders, bump sensors, wheel drop sensors, wall detector, edge sensors.... I have several and they are a really great self contained robot chassis....


The only things I have on order is the plastic base itself and the casters.

I like that the encoders on the Rex motors are attached to the motor versus the disc based encoder that separately attaches on the parralax motors.

The other aspect that makes me lean towards the Rex motors and wheels is the wheels on the Rex does not need to be inflated.

I saw a number of posts on the parralax forums about the wheels losing air and needs to be inflated with a hand pump every so often.

If I do end up going with the parralax set it will be the aluminum ones.

The other aspect of the Rex motors I like is adjusting the height of them could easily be done using a shim between the mount plate and the chassis base.

Assuming my math is good it seems the parralax motors have more torque though.


@Richard R

How did you find the parralax swivel casters. Do they move freely?


I agree with you the Zagros stuff is actually really good.... Funny enough, I have a few of their bases too... I don't think you will be disappointed with the power output of the Rex motors.....


The parallax casters are great.... High quality for sure.... So are the motors, but as I mentioned the encoder implantation is crap... The Rex encoders are contained in an end cap whereas the Arlo encoders are in the open and like what happened to me, easily damaged...


The Arlo base and casters plus the Rex motors sounds like a great combo to me....:)


I was looking at the encoder assembly again and it seems that it depends on the internal teeth of the encoder ring deforming against the output shaft hence gripping the output shaft tightly.

I have to agree with you that it seems an somewhat iffy design especially with the shaft rotating and potentially vibrating.

If the ring is plastic and depending on the teeth size and plastic type the grip on the shaft may not last.

I am not sure what the distances are between the ring and encoder module sides but it cannot be much.

It seems there is an element of luck involved on how tight that encoder ring assembly would be.:)



@Richard R

Have you used the Rex motors with the EZB and a motor driver to control the motors.

If so what issues did you run into?



I have no experience with the Rex motors. The robot base I have is the Max 99 with the 25rpm basic motors.... However a few guys on here have said positive things about the Rex motors, especially about the high resolution encoders...


I'm using the Rex motor with the high resolution encoder to turn the waist on my B9. The motor is strong, smooth and quiet. The encoder is amazingly precise and the Kangaroo X2 matches with is nicely when it's set to Independent Mode. This is how I'm running it as it's controlling two different motors speeds and position. However Tony (Toymaker) has had trouble using these encoders when Kangaroo is set to Mixed Mode. That's the mode needed when turning two motors at the same time like on a wheeled base like you want to do. Because of the super high resolution of the encoder the Kangaroo would only run the motors at half speed. Tony was working with Dimension Engineering to resolve this issue but I don't know if they did. You could try to contact DE's support or Tony and find out. Other then that I would highly recommend the Rex motor/encoder combo.

EDIT: Also the rex motor comes in two speeds. The slower one has more torque but I got the faster one and it has plenty of power for my needs.

Hope this helps.

User-inserted image

User-inserted image


Thank you for everyone's input. I will contact DE or Tony and go from there.

United Kingdom

@Darathian, The Kangaroo/Sabertooth combo is an excellent PID motor controller, look at my earlier posts on this where I show coding the Kangaroo from EZ-Script it covers pretty much all you need to know about fully controlling motors and analysing feedback from the encoders etc.

The problem I have had with the Kangaroo is that it cannot use the high resolution encoders (of the type I use) in mixed mode (dual motor locomotion), I am having to design a circuit that divides the encoders outputs to get it all to work. With a single motor with high res encoder (independent mode) you should be ok, its just when the Kangaroo has to deal with 2 motors simultaneously it cannot keep up with the counts.

The Kangaroo max pulse input is 80000 for one motor, meaning that its 40000 for two motors and in mixed mode it has to read two encoders simultaneously. So the fix is a divide by two (say 4013 D type flip flop) circuit, this reduces the 63500 pulses (per motor per revolution) down to 31750, the loss in accuracy is negligible. Dave's faster (less torque) motors have lower pulse counts so may well be ok without this mod, but I am driving a 4 foot robot around on these motors so I need the extra torque.

Let me know if you need any more help.


User-inserted image

United Kingdom

Whats this about the "indoor navigation system" that DJ is working on?

Sounds interesting and exciting too :D


@mgodsell1973... You know as much as we do about it... We're all going to have to wait until DJ releases it and/or chooses to tell us more about it...



Do you have any idea what would be a good substitute encoder that should work the best with the Kangaroo?

I ask because I know nothing about them and I, as I'm sure many others here value your opinion.

Herr Ball

United Kingdom

@Herr Ball, In my opinion the encoders on the REX motors (HEDS-5545) are the best and already fitted, its just the problem with the MR300 motors that they have 63500 pulses per revolution and the Kangaroo can only handle 40000 in mixed mode (2 motor drive locomotion). The divide by two circuit on each encoder line fixes this by reducing the pulse count down to 31750 so the motors are now within the Kangaroo specification.




Do you have a circuit diagram/parts list for your devider circuit?

I need to use mixed mode.




I am a bit confused. In doing some research here it appears that the same encoders are used on both the MR200 & MR300. Is that correct? If that is the case then how does the MR300 encoders have 64000 pules and the MR200 only 32000? Does it have something to do with the rpm of the motor? The main reason I ask is because I don't plan on using the motors just adapting the encoders to my own motors.


United Kingdom

@Darathian, I have not yet done the modification but will get around to it soon, I will build the D type flip flop circuit into the header plug (lead) that goes to the REX motors.

Here is how it works.

User-inserted image

@Herr Ball, The encoders are the same for both motors the difference in pulses is because of the gearing which makes the MR200 go twice as fast as the MR300 for this you get reduced torque but higher speed. The motors are identical its just the gearbox that is different between the two motors.




Did you ever get the circuit done for the D type flip flop as discussed above and did it work as expected?



I myself have the Parallax Alro motors. Way too Fast. Im leaning towards the Zagros base and motors since they claim the motors are at walking speed slow, and that is what im in need of right now. The Parallax motors nearly ran over and broke my foot and crashed thru a wall at its normal speed. Yikes.


@RobotHappy... The Zagros bases are awesome.... The 25rpm motors are very strong and a good speed for autonomous robots... I have two of the Max99 bases... I also have the Arlo base and you're right... it's a bit to big and fast for around the house use....



I was wondering if you ever built the D type flip flop and if it worked for you.

I want to make sure it worked before going down this route.




Here is the pin out and circuit that Tony is talking about. Hope this helps. I am sure Tony will chime in soon.

User-inserted image

User-inserted image


United Kingdom

@Darathian, I have not got around to doing this mod yet, as I have been working on the ALTAIR arms and converting everything over to the EZB v4. This simple mod should work as the Kangaroo problem is that it cannot cope with the high number of pulses coming out of the encoders, this cct halves these pulses so the kangaroo can operate within its design parameters. I will be going back to the locomotion unit in a month or so and sorting this problem is on the top of my to do list.

Let us know how it goes if you try the mod before this.



I am going to tackle this over the weekend hopefully. I will post the results of this attempt with photos hopefully of a working solution. Just waiting for the parts to arrive.


I am using a sketch for an arduino to be able to read the encoder for testing. There are a couple of uses for this...

  1. Tell where I or Index is tripped - hook up I to pin 3 on the arduino I would suspect would accomplish this.
  2. Tell the counts on an encoder/motor combo when you don't have the information
  3. Tell if the encoder is working.
  4. Tell if the flip flop circuit is working (should be 1/2 of what is reported without the flip flop circuit in line)

The output is sent to the serial port output of the arduino so it can be used with a computer to monitor. I figured I would need something pretty quick and easy to use for testing and it allows me to do the testing of the circuit on the test bed instead of in the robot.

starting code for arduino from things found on the internet. Because this is just something used for testing, I don't see the point in using much more than this at this point.

I did have to change encoder0Pos to be long instead of int because the encoder/motor combo exceeds ~32K counts per revolution.

/* Read Quadrature Encoder
  * Connect Encoder to Pins encoder0PinA, encoder0PinB, and +5V.
  * Sketch by max wolf /
  * v. 0.1 - very basic functions - mw 20061220

 int val; 
 int encoder0PinA = 3;
 int encoder0PinB = 4;
 long encoder0Pos = 0;
 int encoder0PinALast = LOW;
 int n = LOW;

 void setup() { 
   pinMode (encoder0PinA,INPUT);
   pinMode (encoder0PinB,INPUT);
   Serial.begin (9600);

 void loop() { 
   n = digitalRead(encoder0PinA);
   if ((encoder0PinALast == LOW) && (n == HIGH)) {
     if (digitalRead(encoder0PinB) == LOW) {
     } else {
     Serial.print (encoder0Pos);
     Serial.print ("/");
   encoder0PinALast = n;


I have some doubts that the 4013 will be able to keep up with the encoders on these motors, but wont know until I give it a shot. If this works, it is definitely the cheaper option. The 4013 would run faster if powered with 12 volts, but then the output signal would also have to be reduced from 12v to 5v very quickly.

I also found encoders that are the same as the ones that come on these motors, only with 200 counters per rev instead of 500. The part number is HEDS-5505#E04. The E in this indicates the number of counters per rev. C D E or F will work. The shaft coming out of the back of the motor is 5/32in which is what the 04 fits. 06 is pretty common also, which is 1/4 but I don't know if this would work. The issue that I am finding is that 25 of these would need to be ordered in order for them to be purchased by the distributer.

if the HEDS-5505#F06 will fit, it looks like the best option for the higher torque motors because this would give you 256 counters per rev. The gearing in the higher torque motor is 1:127 so this would give you 32512 clicks per rev of the wheel, which would fall inside the 40K per wheel for the kangaroo. I just don't know if there would be any issue with this larger shaft size.

Fitting the 5/32 rear shaft through the encoder ring was very tight, so it might not be an issue. I figure if the 4013 circuit attempt doesn't work out, I will look at trying to use a HEDS-5505#F06 and see how it fits for the prototype I am working on.


HEDS-5500#C04 looks like the best option for something that could be shipped easily. I cant tell that the through hole option of the 5505 series would matter or not from the documents available. This would give you 12700 counts per rev, which is still really high. a 4 inch diameter wheel would be resolution down to .026mm.


Tough choices yes. I now use the arlo base in Cy since I learned how to slow the motors down some using the hb25s. Zagros base and motors are pretty good too.I'm now using them for a test design for a project I'm in the process of getting a patent for.


They are good motors for sure. I will check out the hb25's. This has been hanging out there for a while and I am finally to the point in my project that I need to do something about it, so, just trying to figure out the best option along with the most cost effective option. These motors are plenty strong for sure, and I like the speed for indoor use.

United Kingdom

David, I am confused why you think a 4013 would not be able to keep up with the encoders? It is just a logic device (D-type flip-flop) and it can be clocked up to a max of around 16MHz (at 5v) which is way more than the requirement here for the /by2 needed to step down the encoder pulses. You are right, at higher voltages this max clock frequency would be even higher at around 30MHz at 12v but the 16MHz is already more than adequate for the application we have here. Be careful about running the 4013 at 12volts as the encoders are 5v and 12v pulses on the Roo would probably seriously damage it.

I agree with you, the best idea would be to change the encoders themselves (to 32512 clicks) if it all fits well with the motors then this additional 4013 circuitry would not be needed at all.

Thanks for giving us your feedback on this, as this is very useful information to folks making bigger robots that use the REX motors/encoders with the Kangaroo.



Hey Tony,

I haven't gotten the 4013's yet, so I don't have any specific version info yet on the version of the 4013 that I purchased. They are only around $0.30 each, so if I got slower ones, it's no big deal to replace.

In looking at the data sheets for these though, at 5v these run at about 5 mhz. At 15v these push the 16mhz range. I have also found some that say they need between 4v and 20v. In any event, I am still going to try this and try to come up with a solution outside of replacing the encoder. The reason for this is that finding the motors without the encoders attached seems to be a difficult thing. They are a specific version of Globe IM-15 motors. I can find them for about $200 each right now without the encoders. The encoders are a little over $40 each. Zagnos sells the motor with encoders for $130.00 each.

From an ease of install situation, it would be far easier to just put a module on the encoder that uses a flip flop.

If I were doing this one time, I think the solution would be to buy the other encoders and replace the ones on the back of the motors. For a larger scale solution, I think the flip flop is better and far easier if these flip flop modules were able to be mass produced. It's much easier to just plug a completed flip flop module into the encoder than to replace the encoders.

United Kingdom

The HEF4013B has a typical max clock frequency of 14MHz at 5v although it should in reality be higher than this.

You got me too looking at changing the encoders themselves, but it seems a minefield (here in the UK) trying to find ones that are available with the right shaft size also they are expensive at over £30 each making it over 60 quid for the two required. You are right, in a one-off robot build that is not a problem, but in volume manufacture the humble 4013 looks like it will save valuable prime-cost. When I get back to working on the ALTAIR locomotion unit I will build the 4013 divider circuits into the actual lead that connects the encoder to the Roo and then heatshrink it all. I am pretty sure that the 4013 should work in this application, and there are also other (high speed) logic families that have D-type flip-flops all pin compatible. Best of luck with this and lets us know how you get on.

BTW Rafiki looks amazing, great job!



One question for you Tony. Would it matter much if the flip flop were at the motor end vs the roo end of the connection? You got me thinking. Is it better to have the flip flop circuit plugged into the roo or into the encoder directly? This is only an issue when using these motors with a differential drive system. I had thought about making a left and right side version that would connect to the encoder with wires going to the roo. Now I am thinking that a single module that plugged into the roo with both of these (left and right) flip flops on a single board would be better. It would reduce the chance of someone plugging the left module into the right encoder for example.


I will be using a breadboard to prove the concept so there would be wires going to both initially I guess. If the breadboard works then short of some interference caused by the motor or roo, I guess that it really wouldn't matter from a functioning perspective.

From a usability perspective (once I build this in a circuit board config), I will try to make the working prototype connect to the roo directly I think.

United Kingdom

I will probably do two separate 4013 leads (left and right), I just think it will be neater. I always colour code all Molex type connections with coloured CD marker pens, so they dont get incorrectly plugged. From a (electrical) noise point of view it would probably be best to have the 4013 board as close to the encoder as possible, also put a decoupling capacitor (100nf) as close to the power in pins (14 and 7) of the 4013 on each of the two IC's.



Thank you sir. Your insight is always very helpful.

Would you see any reason to include a diode?


Here are my thoughts on this. If I am already building the board, I might as well put in pull up resistors for the signals that are recommended with the encoder. All of this in one nice package would be nice. Also, do you think that this circuit could be powered by the 5v feed from the encoder pins on the roo or should I power it from the 5v out on the back of the roo?

United Kingdom

No need for a diode (you would only drop 0.7volts (or 0.3v for a Schottky) from the 5v supply. The 4013 is CMOS so it draws very very little current so can easily be powered from the 5v (feed line from the Roo) to the encoder. Yes the three 2K7 pull-up resistors will need to be added on the encoder side.



Just an update of sorts on this. One of my son's friends is in his last semester of College as an EE student. I contacted him last night and he going to take this on as a project. My ultimate goal would be to have a SMC PCB designed and built. He has the datasheets and information from here. I am going to still breadboard the solution when all of the parts get here. The good news is that I have ordered enough parts to make about 10 of these so I will give him 1/2 of the components above to mess with and come up with a board design. My hope is to produce these in a decent quantity that would allow me to sell these components to those that are interested in buying them. By sell, I simply mean to cover the cost of the parts, shipping and manufacturing costs. I wont be making money on these, but it is something that is needed for more than just these motor/encoder/controller combo.


Nothing wrong with making a little money on the side if you can. It's a shame people are so shy about getting something for work and services they provide.


If I could make some money, I would, but it is a pretty unique thing. I searched to see what is out for this though and there really isnt anything hobbyist grade. There are some specific things for specific products. One module I found looks like a circuit breaker for a house. I am sure it is for a PLU control unit for a factory. The cool thing about it is that it would divide by 2 to 256. Kind of a cool concept. A set of dip switches could allow someone to divide by 2, 4 or more by passing the signal through multiple 4013's based on the dip switch config. This could just as easily be done by passing the signal through multiple of these. If only one single needed to be divided and you wanted it to be divided by 4, I would think that you could jumper from A out to B in and then take the result from B to the controller. You could then take 2 of these to divide by 4, one for each signal. I guess you could also just pass A out to A in and B out to B in on two of them. If I went this route, at some point I would have to put a power connector to provide power instead of powering off of the input from the controller.

I wouldn't feel right about taking a design basically given to me by Tony to make money off of. He has helped me plenty. I would probably just sell to cover the cost to make and ship. The thought has also come to mind to sell this as a printed pcb and a kit of parts, but I have no clue at this point.

I am really surprised that there isnt a divide by two module for arduino's. Maybe I just haven't found it yet.

I could take this to silly levels but first I have to get the breadboard working.

United Kingdom

No problem David, it would be great if you can sell these useful little boards, I will buy a few off you if you do. If the 4013 board used SMT (surface mount) components then it would be so small that you would hardly notice it in the encoder cable loom. I am always happy to help you guys with hardware ideas if I can, just ask. I been designing electronic circuitry for over 45 years!



Thanks Tony. I have the first 2 breadboard wired. Just waiting for the 4013's to come in to test.


Circuit has been built but I wont have time to test until this evening. I will post the results hopefully this evening.


Circuit worked well for a while. Divide by 2 was working for both A and B channel on the encoder perfectly.

I dont know what happened but now I get nothing out of it. I verified that the chip gets 5v and that 5v is carried through the circuit. I also replaced the chip with a new one with the same results. I verified that the encoders are still working when attached to the Arduino. For some reason now when I put this Circuit inline, I get nothing out the other end.

I will mess with it tomorrow some more. The good news is that I saw the divide by 2 circuit performing great.

United Kingdom

David, do these chips completely fail to function after a time (ie destroyed)? This seems very odd, I cannot think of anything in this setup that would cause this.

Have you taken all unused inputs to ground (pins 4,6,8,10), this is important on the 4013.

Also you could try 74LS74 (or 74HC74 high speed logic) but check the pin out with these chips as its probably different from the 4013.



I'm sure it is just some of the cheep wire that I was using to connect to the motor or arduino when testing. I'll hook it all back up again and give it another shot today if work doesn't consume too much time.


Silly question here, but ...

The IC has a notch on one side, a dot on the other and a line on the side with the notch.

In my past experience, the notch indicates the side with pin 1. The dot indicates where pin 1 is. On this chip, these are on opposite ends of the IC. I haven't messed with any that had a line on them like this but I assume that it indicates which end is ground?

So, which takes priority? The dot, or notch to indicate pin 1? If it is the dot, I have this IC plugged in backwards.


Here is a photo of the chip.

User-inserted image

Hard to see in the photo but there is the half moon notch on the side with the line.


That's been my experience also Dave. I think I've seen it the other way also once or twice. I can't do it for you right now but try finding the spec sheet on this chip at Mouser or Digikey. That should have the pin out map and tell you what you need.

Edit, if you instead it backwards then you most likely blew it out and need a new one.


Unfortunately, the datasheet shows a dot by pin 1 and the notch by pin 1. On this chip, they are opposite. Probably a cheap Chinese knockoff.

I have some extras, so I will probably just end up having to flip the chip to see what happens.


On a side note, the student that I have helping ran some simulations on the design yesterday and everything worked out. He is drawing up the schematic and pcb layout so that I can have a few boards made to test out. These will not be surface mount at this time. We will get something working on a printed board and then decide if the surface mount option is what we want to do. The cost of doing surface mount design is much higher.

I have to get this done so that I can continue working on the SLAM module. A non moving robot isn't a very good dev platform for SLAM...


I too agree that the notch and the dot are usually on the same end, as with you guys, in past experiences. I see that the dot is also on the right side and that is not the case that I have seen in the past. On most chips that I have played with (not all that many though), pin 1 is on the left side. Just my take on this.


This is part of my confusion...

If the notch is correct, the top right pin is pin 1. If the dot is correct and the chip were flipped, the top right pin is pin 1. Both ways match the datasheet as far as where pin 1 would be. Its a bit confusing but I can stand to blow up a few of these if I need to. I think they were about 40 cents a piece.

This is who I purchased them from. Unfortunately it could be from any one of 5 different manufacturers, all of which have slightly different variants of the chip.

I may have just found the answer and the issue with my wiring... dang datasheets...


Yep, just found the issue. I will rewire it tonight and go from there.


Check that. I was right the first time. VCC comes into pin 14. Ground is on pin 7. Still the same issue... but this does answer for me which pin is pin 1.

Anyway, back to work.

The notch and line indicate pin 1 and the dot is where ground goes on this chip. Interesting. will keep working on it.



How many CPRs per encoder ? you mention 65K Pulses are the CPRs 65 / 4 or 65K / 2 ?


Each motor is geared 1:127. Each encoder has 500 counts per rev.

This takes you to about ~65K per rev of the wheel.

Both wheels working in diff mode take you to 131K clicks total. The Kangaroo can handle about 80K total per wheel rev. (40K per wheel)

flip flop takes you to about 64.5K total or 32,250 per encoder.

I am using 2 wheel config. If you had a 4 wheel config, you would be using 2 Kangaroos so I dont think it would matter.



PIN 1 :

If you have at least 3 methods to identify the pin 1:

  1. Notch/Half moon on the chip to the left (Pin 1 Bottom Corner)
  2. White Bar to the Left (Pin 1 Bottom Corner)
  3. IF no points 1/2 Horizontal Text Orientation (Pin 1 Bottom Corner)

So the other question what's the blue point over Pin 7 ?

some RCA chips arrive with a Test dot can be blue, yellow or other color (I've only seen those two...)

User-inserted image


Thank you. My assumption was correct from the beginning. Thank you for verifying.

United Kingdom

David, the notch (usually center) is the top of the IC and pin one is on the left and pin 14 is on the right.

There are lots of manufacturers producing the 4013 and some specs not pin-outs are slightly different. Hope you can get it working, do these chips fail completely after they stop working (after a short time) are they destroyed, or do they work again?



I forgot to mention the other method an engraved dot / white dot

Sometimes is not clear when you have pins in all the sides, if there is only one engraved or white dot that is the pin 1.

When you have two engraved dots in opposite corners, the thumb rule is the text orientation or the datasheet.


Hard to tell at this point. I have 4 of them that I am testing with. I really think the issue is garbage wire with poor connections going to the arduino that I am testing with. I get it to work sometimes and not others. I will hook up the oscope this evening and take a look at what I am getting from the board. I will probably solder wire onto the arduino that I know is good and punch it down into the breadboard. It seems like this would eliminate this possibility.


Thank you ptp. I have worked with pc chips in the past, and some when I used to repair arcade equipment (about 25 years ago). I just had not run into this config before and it confused me a bit.


I think the logical thing to do is go back to just one of them to see if I can get it to work reliably. Switching out between 4 of them is an easy way to get confused as to which one is sometimes working and which one is not working at all. Ill put some time into this this evening and see what I can figure out.



Regarding the Kangaroo limits i think is related to the Kangaroo micro controller max frequency, the same issue like Arduino.

So if the limit is a frequency, to calculate the max frequency of one Quadrature Encoder (Hz) is:

Speed (Revs Per second) x Encoder PPR x 2 channels x 2 (rising / failing)

regarding your calculations, where is the speed ?


I took a break for "Lunch" and wired a much better set of wires to the arduino. It looks to be working now. I will have to do some testing this evening to make sure that the counts out of the circuit are indeed half of what the encoder reports without the circuit.

Thanks for all of the help along the way to all.



Another thought as to the limit is the limit to the size of the variable that is used. For example, int in their code (depending on what they are using) has a specific size. If they are taking 2 int's and comparing them, that would be a different size. I assume their controller is a 16 Mhz controller but I dont know. I will have to go see what I can find, but the code could also be limiting the counter.

I suspect that it is an issue with the type of variable that they are using, because even a 2Mhz controller should be able to keep up. I am nowhere near 2 million clock cycles.


I couldn't find anything in their documentation indicating what the speed of the chip is that they are using. It looks like an ATmega8 chip but my eyes aren't good enough to read the markings on it. if it is, it would be either 8 or 16 Mhz


Are you using the code from post #28 ?

If yes, is not good enough, there are two issues: digitalRead (arduino default libraries) are 50% more slow than atmel native implementation arduino loop function is another dead horse:)

Let me know your arduino model, and i'll adapt some of my code, and you can hook the arduino directly to the encoders and try to measure the ticks at different speeds.


That would be awesome. Im using the Arduino mini pro ATMega328 16Mhz 5V. Posting it here to help others who want to do this would be wonderful!


motor control are you controlling the motors via Arduino too ? To measure the encoders, is important to control the PWM, to verify if can keep up with different speeds.


Right, no, it is direct connected to a 12v battery for the test. Full speed run. I haven't hooked up the sabertooth yet again, but I will if needed to limit speed. I would control the sabertooth from a pc that is sending serial commands for this test.


ATMega328 16hmz 5V

Not the 3.3 v ? Is not your idea to interface the arduino with the EZB UART ?


Do you have the FTDI module ?


All of my robot runs off of 12v or 5v by design.

I do have many of them (FTDI module)


Not the ezb, all of my subsystems are usb to the onboard computer.


Ok, I'll check my hardware leftovers to replicate an example.



I've attached the Arduino Project which includes the DigitalWriteFast library.

Explanation: with an arduino uno/mini you have 2 interrupts: Interrupt 0 is attached to Pin 2 (used for the Left Encoder) Interrupt 1 is attached to Pin 3 (used for the Right Encoder)

Left Encoder: Phase A = Pin 2 Phase B = Pin 5

Right Encoder: Phase A = Pin 3 Phase B = Pin 4

#include "Arduino.h"
#include "digitalWriteFast.h"

#define SHOW_INTERVAL 1000

#define LEFT_ENCODER_INT    0 

#define RIGHT_ENCODER_INT   1 

volatile bool leftEncoderBState=0, rightEncoderBState=0;
volatile long leftEncoderTicks=0, rightEncoderTicks=0;
volatile long leftEncoderLastTicks=0, rightEncoderLastTicks=0; 

unsigned long nextShowMillis=0;

void setup()

  //Left Encoder
  digitalWrite(LEFT_ENCODER_PINA, LOW);
  digitalWrite(LEFT_ENCODER_PINB, LOW);
  attachInterrupt(LEFT_ENCODER_INT, LeftEncoderInterrupt, RISING);

  //Right Encoder
  digitalWrite(RIGHT_ENCODER_PINA, LOW);
  digitalWrite(RIGHT_ENCODER_PINB, LOW);
  attachInterrupt(RIGHT_ENCODER_INT, RightEncoderInterrupt, RISING);
void loop()
  if (millis() > nextShowMillis) 
    nextShowMillis += SHOW_INTERVAL;

    Serial.print("Left Encoder: Ticks=");
    Serial.print(" Ticks p/sec=");
    leftEncoderLastTicks = leftEncoderTicks;

    Serial.print("Right Encoder: Ticks=");
    Serial.print(" Ticks p/sec=");
    rightEncoderLastTicks = rightEncoderTicks;
void LeftEncoderInterrupt()
  leftEncoderBState = digitalReadFast(LEFT_ENCODER_PINB);
  leftEncoderTicks += leftEncoderBState ? -1 : +1;

void RightEncoderInterrupt()
  rightEncoderBState = digitalReadFast(RIGHT_ENCODER_PINB);
  rightEncoderTicks += rightEncoderBState ? -1 : +1;


Thank you. I have company coming over it seems so too many distractions right now. I will check it out hopefully after they depart my humble abode.

Thank you for putting this together. I have been doing some research on the topic of using the Fast Digital IO code project. Mainly just reading at this point, but am understanding why you would want to use it.


No problem, try to hook both motors, full power (12V) and check the values, then switch off the left motor, and check if the right encoder ticks per second are more or less the same. This away you will know if you are losing ticks when both motors are up.


I'm not familiar with Kangaroo, but it seems is a popular device.

Is straight forward the connection to EZB ? Why no plugin ? Or there's nothing to control/monitor via EZB ?


Its really easy to hook up. There are many different modes that it runs in. Most of them you just send a serial command. These commands can be quite different depending on the mode it is in.

There is a control for it under H-Bridges, but I think most send serial as needed.


you add the kangaroo into the mix with the Sabertooth and you have a really cool motor controller.


The Sabertooth without the kangaroo has a movement panel. With it, assuming you are using it for limited movemnt, not rotational, you just use servo commands after tuning it. For precise rotational motion, you need to use scripts.



Alan be patient i'm little lost.

Imagine the following example: cmd => drive 1m straight Check obstacle => obstacle found => stop the motors Read the distance from last command keep in a var x$ cmd => turn 45 deg to the left Drive 10 cms cmd => turn 45 deg to the right drive 10 cms cmd turn 45 deg to the left drive 1m - x$ straight

to do this or to know the encoders position only via scripting (something similar to the Tony's tutorial ?)


Yes, currently you will need scripting to read the encoder positions. I would not be at all surprised to see Dave Cochran write a plugin to make it easier now that he is playing with using a Kangaroo, but if you need something now, scripting is the way to go. I can't be much help there since I don't (yet) have a kangaroo or any encoders.



ptp, you could do what you want to do with an arduino.

Here are the advantages to using the sabertooth/kangaroo combo that I see. It is a self contained device that you can use to handle ramping and positioning. You can give it a command to turn right or left a certain distance (based on encoder clicks) You can tell it to go forward or backwards a certain number of clicks.
The roo makes sure that the motors are working with each other at the same speed. Start and stop ramping is calculated based on the load of the device and how the motors act under that load through an autotune function.

All of this can be done with an arduino, like I said, and I have created a sketch to do most of it. It just requires a lot more programming on the controller side. Not a lot of people want to do this and would rather use the autotune option on the roo.

The sabertooth by itself is a great motor controller if you are either going to use an arduino to replace the roo functions, or dont need position control. I use these for arm and neck movement and use an arduino to handle position control through a pot.

The arduino gives you the ability to code specific things like a command to "Move forward 1 meter" which you would then use the encoder to handle. This could be a serial command to the arduino which would then handle moving the motors a certain number of encoder clicks. The Roo/Sabortooth combo would allow someone who doesnt want to program an arduino to say "F.1000" to move the motors forward 1000 clicks, while letting the roo handle all of the fun stuff. A script would have to be used to calculate what 1 meter is equal to in clicks to move forward 1 meter.



i was trying to understand where the kangaroo fits and what you can do without entering the script world.

i understand outside of close loop control there is no solution unless you script like a guru. Also is out of the equation driving around the obstacles without scripting ?

it seems limited when you start combining devices and event based decisions...

I never used the saber neither the kangaroo, i use an arduino, high amps H-Bridge, a custom made circuits to decode the 2 x quadrature encoders and arduino software PID control. I need a granular control to provide information and receive commands from the PC where i run ROS.

but the previous questions it was curiosity how EZB world deals with navigation, and it seems is not an easy task.


You have the same situation in either ROS or ARC IMHO. Either use what others have developed or write something. I am trying to work on a SLAM module that will make these decisions and call scripts that someone has written to move a certain distance based on the condition (distance from an object). If I am successful, someone would be able to drop in this control, write a few scripts for their bot to move a certain distance or turn a certain amount, or back up a certain distance. ROS has the same type things in that there are SLAM modules available to use along with other things to make this happen.

Its one of those things where it could be best to roll your own solution. I wasn't trying to insult by any means, just telling you what I see are the benefits to the sabortooth vs L-bridge or roo vs another type of controller. Either works for sure. It is just about how much control you want, your skill set and what you like more.

Plugins can now be written in ARC as you know. I am sure that there will be some pretty cool ones developed in time. ROS definitely has an advantage in that this is what ROS is. Essentially it is plugins developed by many people that to an extent work with other things developed by many people. If you don't like how it works, the code is available to change it. Plugins are the same thing. I share my code with my plugins and others do also. My hope is that people will take them and run with them to make something really cool. ROS is more mature in this regard for sure.



I like the way you explain the things, i don't feel bad if we are overlapping the same subjects, sometimes even if the subject is well known there is always space to learn.


i know the ROS away, and like you said SLAM and other modules are there once you master the knowledge, it's easy to put a robot to navigate in your office, avoid obstacles, locating and focus only in the proper actions like: Go to the Office X Ask for mail when you got the mail Drive back to me

I cant imagine the frustration if to do that i need to read encoder positions make calculations deal with unexpected obstacles etc.

I think we can agree there is a big gap regarding navigation, localization and other important tasks in EZ world no ?

before assuming that i got curious with kangaroo with control loop.

How other (members) EZ robots deal with navigation, are the robots confined to a controlled area ?


This is a huge topic that comes up often on the boards. Some have tried various things. Some have made roaming robots and such but nobody has yet made one that truly implements slam.

Here is why I think that is. The EZ-B controller uses wifi as its communication path back to the controlling computer. This path can get flooded and you know how much data is involved with SLAM. I suspect that it would flood the communications channel and make everything else real slow if not disconnect the V4. DJ is working on something that changes how much data can go through this path. To overcome this, I use USB from an on-board computer to control subsytems that help with SLAM and many other things. Really, I don't use the V4 much at all other than to allow other sensors to be added to my platform by end users. These other sensors can be accessed through scripts or through controls and gives the end user the ability to modify the bot without making any real changes to the core functions of the bot. I have taught 4th grade students to use ARC, so adding things should be simple enough for most people to handle.

The second reason that I see that this hasn't happened yet is because plugins just recently became available to be added by non-DJ-Personnel. This isn't a slam against DJ at all. I think that everything had to be controlled for a while, and DJ had a ton on his plate trying to do everything. Now that this is opened up to develop plugins for, I hope that people will do this for a few different reasons, but mainly to free DJ up to work on other things.

There are some who have done some things with SLAM type functions. Tony (Toymaker) has built a mapping and navigation module outside of ARC. DJ had done one inside ARC, but I have no clue where this project is. Basically, both build a map in an array, and then use that map for navigation.

The thing to remember is that scripts are not the only way to use ARC. The EZ-B isnt the only thing that you can control from inside ARC. There is a huge benefit to ARC outside of controlling the EZ-B, but most haven't realized it yet.


Here is something to wrap your head around...

ARC could be a subscriber or a publisher to ROS if a plugin were developed.


That's a Pandora Box:)

I read somewhere in the forums, DJ will release some kind of visual slam ... i don't know if is vaporware:) or a different thing.

Sometime ago i commented a post of yours, asking for an EZ roadmap.

I remember you started the raft bot, but in the last weeks, i think you changed the roadmap/direction no ?

Releasing small EZ Plugins, but the question is with free open source plugins how can that help build a raft bot/$$$ (probably this post should be moved to the raft bot thread... )


Not all will be free, only the ones that I used someone else's code in will be free. There are 3 plugins that have been written and not released to the public yet. The LIDAR module was my own but hoped that others would run with it to improve it. I seriously doubt that SLAM will be free, along with the parking sensors, arm and neck movement, facial recognition stuff that I am doing, EZ-AI and the ground height sensors.

Over time, I am sure they would become free to use except EZ-AI. I have costs associated with that that I wont be able to eat on my own.

The EZ-Roadmap should be to come up with better hardware, and let others develop new features as requested. If someone wants to sell it, they can. If they want to give it away they can. The roadmap for Rafiki has changed a bit in that instead of having a custom app outside of ARC that communicates to ARC, it will now all reside inside of ARC. I think this is the better approach from a development standpoint and from a support standpoint. It also lets people work in one environment instead of two or more.

BTW, just tested your code with one motor. ~38K per second reported. I am going to see if the flip flop works and then I will go to two motors.


flip flop works perfectly and smooths the numbers out. 17576 consistently per second with flip flop in. 38030 to 38150 without flip flop.


Okay, two motors.


eh, 2 motors waits until tomorrow. Wife has spoken...:) Taking care of my health and all.


so full power (12V) each motor has 38K ticks per second ?

powerful combination gears encoders


ok talk tomorrow !


I spoke too soon on the flip flop. It ran for a few seconds then stopped reporting. The consistent number was because it quit reading. I was reading total ticks instead of the ticks per second.

Without the flip flop it looks like it was working fine. I will look at it more tomorrow. I suspect that the flip flop is a slower one that can't keep up and gives up. I will hook it back up and check it out tomorrow again. I may have to get some different IC's that run at higher speeds. Tony mentioned some earlier that ran at about 14 Mhz at 5v. I think these are running at about 5 Mhz.


I have decided to order some of these to eliminate the concern about the speed of the chip. I suppose that they will be able to run at 30 Mhz at 5v. This will quit being a concern at that point and I can focus on the circuit. I will do more testing this evening on the current chip to see if running at a slower speed allows the flip flop to work. I will let you know how it turns out.

United Kingdom

David, HC (logic) can go up to 50MHz but as I said in the earlier post watch the pin-out as from memory it is different from the 4013.

Good Luck!



Thanks Tony, I had to stop the student who is helping and send him the new datasheet. He had just completed the schematic but had not done much on the board layout. Basically this chip has the same pins, but in different locations. I will be building another breadboard for this chip to get the pinouts correct.

I also will be interested in seeing if my theory is correct on the 4013 by running the motor much slower. I find it interesting that it picked up values for 2 seconds and then stopped working. I think I flooded it and it stopped taking data. This would make sense to me but I could be totally off. Will know more about the 4013 chip this evening and will update.

Thanks for all of your help.

United Kingdom

Yes, the 74HC74 is an identical D-Type flip-flop just a diff logic family, with a different pin-out.

I am confused about the 4013 partially working, I would have expected it to work, I am sure you will sort it though and find out what is going on!




can you make a simple draw how you hook the encoders, 4013 and the connection to the arduino, every tiny detail (from pin to pin)

Do it by hand to be quick.


I will get this to you. give me a bit of time and I will upload it. Work consuming quite a bit of time right now. Im in meetings from 3 until 5 CST today so will get it out as soon as I can.


User-inserted image

This is what I built to wire off of. The student will come up with a sound design:).

Above the 4013 is a 104 disk cap.

The connection to the arduino is going through the Roo pins right now. A - 5 B - 2

    • vcc on opposite side of board
    • to ground where pin 1 would be

David, just throwing this out there... Knowing you already have your equipment. I don't have specifics with me at work but I do know my roboclaw motor controllers support encoders natively on board, not extra boards. The roboclaw also has a USB port native to it. I mention this due to several of our past conversations. It may be something for you to take a look at. Chris


Thanks you Chris, I will look into it. I am on a mission to solve this issue and the roboclaw might solve it for me, but my head isn't sore enough yet from banging it up against the problem:)



Do you have this PCB already, or are staging the circuit in a breadboard ?


Breadboard. This was the quickest thing I could get you to show how it is wired in the breadboard.


the reason why i asked you to make a draw of what you have, is to help debug the issue, i think something (small detail) is missing or wrong, probably when you finish the draw, it will surface (hopefully:) )


I found the issue. with flip flop, now reporting 19200 - 19225 /s range

Without flip flop reporting 38109 to 38250/s range.

It seems that one of my ground leads wasnt there which was tripping the reset pin on one side of the 4013.

Okay, happy and can proceed. I wasted all of about $7.43 buying the other chips but, I may use those anyway. I like overkill and the difference in the cost of the chips is very negligible. Also, these will function from 2v to 6v instead of 5v to 14v. This will make them more arduino compatible.

So, a 4013 works, with the wiring shown in the post on the previous page, with the capacitor and with the resisters as shown on the previous page. I will slap another one of these together and then have the boards made.

Thank you all for all of your help. I will post after these are back in the robot and I auto tune the Kangaroo.

Also, the issue with the roo is based on clicks per revolution and not clicks per second so I am now convinced it is a software issue and not an issue with the speed of the controller.


good, next !

one quick question where are you sourcing the components, i really miss a brick & mortar store for the emergencies. Every time i go to digikey, i need to make "business plan" to include all the components for stock, and next ideas... is not only money (shipping) you waste but also the opportunity (time) waiting...


I just ordered parts where I could find them for the prototype. I will have to find someone to get all of the parts from. I dont know how many would be ordered and may just go with a company that will manufacture the boards so I am not soldering each one.

I will do some research and let you know. Synergy is local here so I might go through them. Will just have to see.

This is where I bought the parts for this from 4013's from Jameco along with the dip sockets. resistors I used some that I had but ordered some from Mouser Caps I used some that I had but ordered some multi layer ones from Mouser The 74HS chip I ordered through DigiKey

I will find one place to get all of these from if I am going to have to hand solder them.


my has synergy changed since I was last in there LOL... At least what they sell on their website has changed a lot.

Okay, more research


I am seriously thinking about making these boards without the headers attached. This allows the person buying to then solder whatever type of headers they are using to this device. Because these boards could be used for many things, I wouldn't want to put on a header that would just need to be removed to match someones implementation of this board.

Do you see an issue with me not supplying headers?


it also cuts the cost of the board down by about 71%...

The first order will be 9600 of these. The sad thing is that this is the smallest quantity that I could make. 4 60"x 60" boards with these at 1x1.5" in size makes 2400 per board, with a 4 board minimum order... This is from a board manufacturer who has the highest ratings so they should be very high quality.

[edit] I misunderstood what they said. 60 Square inches not 60x60. This changes things up a lot.

The first order will be for 160 of these. That changes the pricing model a lot. [/edit]


I could also sell 2 boards attached together for use in differential type robots, or sell 2 boards together so that a 4x divider would be as simple as connecting a few holes...

Mouser looks like the place to go to get the quantity I would need for all of the components. That would sure leave a huge stock of these for Rafiki.

Those dang anti-static bags sure are not cheap...


No headder sounds like a good option. That’s how I'd like to buy something like this. I seem to always be unsoldering things and redoing them to make my own connection points anyway.


That is what I am thinking. Also, it would allow someone to direct solder wire to the board if they wanted too.

For those in Europe, I chose all RoHS components.


I will have to sell these for about $5.00 each to make it worth my time to put them together to sell to others. The original order will be for 160 board. I will put them up for sale to see what happens.


Given the total cost of a Sabertooth/Roo/Encoder combo, another $5+shipping to make it effective is certainly money well spent. I think you could easily charge double that and sell as many as you are going to sell. I think the challenge may be finding 160 people with this need. It seems to be a fairly small part of our community that needs them, although maybe the Astromech and BB8 builders clubs have a need that we aren't seeing here as well. I am not even sure I am buying a roo to go with my sabertooth, but I will order one when they are available just to be sure I have it if I need it.



Where I see the potential is more in the Arduino world. There are people building these for themselves, but there isn't anything that is available to purchase built and ready to use. Digital (logic) /2 circuits (especially with the 74HC chip) seem to be in demand a bit. I need to sell about 50 of these at this price to break even. I think that is doable and still leaves me with a good stock to start on Rafiki's.

The encoder/sabertooth/roo issue is really just one of the issues that can be resolved with this. I think it could be used for clocks or many other projects that I have seen while researching flip flop circuits.


The other benefit I do see is with this motor specifically. I can find the motors without the encoders for $200 each. I then can find encoders for about $40 each that will work on these motors. The motor+encoder+flip flop runs about $144 if the motors+encoders are bought from Zagros.

This all excludes shipping of course. So, you end up saving about $96.00 with this option if you wanted this motor with a smaller count encoder. 65K per rev is crazy ridiculous.

If you are looking at producing quite a few robots using these motors, a cost savings of $192.00 per robot is huge. This along with the time to put these encoders on the motors as opposed to putting these on the encoders really helps.

Also, the pull up resistors for the encoder are in the circuit so, this is an added benefit for manufacturing.


DIP Socket or solder the chip to the board? It doubles the price to have the DIP socket. Thoughts?


it is safer to do the socket so I think I will go that route. Alan, we are now at that $10.00 mark you mentioned... Ugh

Trying to keep it to where if I sell 50 of these, I break even.

[edit] I will use sockets on the first 10 that I make. From there I will go to soldering the chips on the board.

The first 160 of these I am going to assemble myself. If they sell good, I will start having the board manufacturer handle the build and test process.

I will get a sheet that will need to be cut (40 or so per sheet). I plan on trying a scroll saw to cut these apart. If that doesn't work well or if I am breathing too much fiberglass, I will go to a wet saw.

Doing it this way should allow the cost to be more at the $6.00 range for the first run.

When it goes beyond this 160, I will receive completed boards ready to be sold.


a lot of topics...


if you "re-brand" the pcb as a dual frequency divider, one can use one pcb to 1/2 to frequencies (quad encoder) , or can a single PCB to 1/4 divide a single phase or frequency clock. It's a very specific item/requirement, and is only needed in your build due to the Kangaroo + encoder solution.

If you endup building a few you can try to sell it as a Kit (PCB + components) or assembled ready to use. To check if there's market/need one place you can try:

I would order only 10 piece or something to test the idea, and only then when you have the full idea working (Bot + Slam + Software) and your are happy with the components i would evaluate if moving with a single PCB or multiple components.

off course you can try to sell a small batch online before embracing quantities.


I like the kit and assembled idea. Save you some time and work too. Nothing like the smell of solder in the morning ... lol.


Unfortunately, or fortunately I guess, the board is so small that ordering small quantities is very difficult. I could go through China, but then there are other issues. The place I found that has really good ratings charges a flat rate up to 60 square inches, and is in the US. Pretty much everything I found here in the US says USE THESE GUYS. You can put as many as you can fit on the 60 square inches, and you have to order a minimum of 4 of these 60 square inch sheets. I'm good with it at the price I am getting it at. It will give me about 160 of these to mess with and figure out what I am going to do with them.

I do like the thought of putting 50 up for sale. If that happens, great. If not, they will end up being used in Rafiki's or other things later anyway.

I also like the kit idea and have from the beginning. The only problem is a lot of people will burn up the chips by not knowing how to solder them. If I add a socket (which still can be burnt up) then it doubles the price of the components. The good news is that these chips are pretty cheap so if someone needed to replace theirs, it is cheap for them to do so. I would probably solder the socket on though if I went that route.

IDK, right now finalizing the PCB design. Hopefully it will be complete tomorrow.

I do have a question on that though...

Is it important to you that the pin outs all come out in a single header location or do you mind if they come out from different pads on the board. For example, A,+,B and Gnd would be labeled but would not be in a row. It would be expected that someone would either put pins in these locations or would wire a wiring harness into these points that fits their needs. What are your thoughts?


This is my opinion, very biased and based only in what I've seen so far, and my day job is software development (I'm not a robotics engineer).

I'll use different words to avoid hurting the existent products.

I would never choose SB or K for to build a robot product from zero, the reason is the price.

SB, K are very popular products when you go to the RC world, and when you build solutions using build blocks like E Z R. The way E Z B works forces you to have different operational blocks, and you have an overhead/management/communication layer over each component.

For example Arduino builders, why you need a K when you can build the logic using code or even a open source library (PID control).

Why i would need a SB, when i need only a H-bridge with some heavy amps.... etc.

Regarding the motor (if i got the right one) M R 3 0 0 = $130 only the encoder H E D S 55 40 = $49

It seems very good motor, but if i have one for $40 with encoders justifies the difference ?

If i go with the $40 i don't need a frequency divider.

The value will depend on your choices, but i can't justify if spending more in hardware it will make the difference until the software is ready.

If the software specs requires that particular combination, there is nothing to argue.

Building a product for end users, the price is very important...


Also, thanks for the link to Tindie. I will check that out in depth. looks like a perfect place to market this.


Pins Alignment, a row is the preferred method, at least you can use strip cables and plastic cases with multi pins and everything gets clean.

I know the headers/sockets and other simple materials raise the price, if can provide 3 options, kit, assembled, assembled + headers.

Browse the Tindie community to have an idea of the offers, there a lot makers but there are also a few non makers (listing the 3party products from china).

I would pay attention to the makers.



Regarding the motor (if i got the right one) M R 3 0 0 = $130 only the encoder H E D S 55 40 = $49

Tje MR300 comes with an encoder. It is a 5505. (from Zagros) The MR300 is a Globe IM-15 spur motor geared 127.78:1 with an encoder added. To buy this motor by itself without the encoder runs about $200 on-line. An encoder could be added which would cost about $40. This brings this total to $240 per motor.

Buying from Zagros, you save about $100 but end up with a really high count encoder, that a lot of systems are going to have trouble keeping up with. For say $6 bucks you can fix this issue, or you are going to have to replace the encoder if you want this motor. Replacing the encoder costs $40, so now you have saved $60 over buying the motor without encoder, and the encoder separately. To do this, you have to be comfortable removing the encoder and replacing it with a new encoder, but the only encoder that is readily available is a 100 count encoder. You have taken your resolution down by 5 times. The 6 dollar fix lets you save an additional $34 and allows you to have only 1/2 the resolution decrease.

Now if you take this into a mass production situation... time = money and money = money. Reducing the cost of the robot build by this much is considerable. Even if you didn't use a roo or sabertooth, and drove this from an arduino and an LBridge, you have extreme resolution still, which might be far more than needed and require you to use larger variables/memory and cycles. Maybe cutting it by 5 is a great solution. Maybe cutting it by 4 or 2 is a great solution. Having options is a good thing, and definitely is a good thing when it comes to large production quantities.


I'm using one motor that costs me $40 with an encoder, why going with a $130 ?

I'm not familiar with those motors, did you pick them for a specific reason ?


Globe motors are industrial grade motors, and are really solid.

Rated Voltage(volt DC): 12 Rated Torque(in.oz.): 300 Reduction Ratio: (127.78:1) Motor Length (in): 3.855 Motor Diameter (in.): 2.00 Motor Weight(oz.): 16.00 Max. Continuous Torque (in.oz.): 300.00 Max Intermitant Torque (in.oz.): 300.00 No Load Speed(rpm): 40.73 No Load Current(amps): 0.22 No Load Torque(in.oz.): 0.65 Stall Current(amps): 6.00 Stall Torque(in.oz.): 1462.61 Friction Torque: 125.8959

Needed a 12 volt motor to keep electronics simple size was small enough to fit in area it needed to fit motor diameter was small enough max CONTINUOUS torque in.oz 300. This is perfect for my needs 40 rpm with 4 inch diameter wheels is about walking speed. low amps very quiet.


my specs are not far from those, i don't know the grade type...

Probably when i finish my build, if i start another one i'll try those motors.


Encoder count is also important for SLAM, as you know. Accurate encoders are important, but these have too much of a good thing....

I'll try to take a video of the motors running. I'm really impressed with how quiet they are.

Also, I made a mistake earlier. These are industrial grade, not military grade motors.


Not that it matters but I just did some math on the M300 without the divide by 2 logic circuit and with a divide by 2, 2 divide by 2 and no divide by 2 with a 100 count encoder replacement.

with 4 inch diameter wheels... without the divide by 2 circuit, the smallest measurement is .5 nanometers with the divide by 2 circuit, the smallest measurement is a nanometer With 2 divide by 2 circuits, the smallest measurement is 2 nanometers without any divide by 2 circuits, and replacement of the encoder with the 100 count available encoder, the smallest measurement is about 3.something nanometers.

It is a good advertisement to be able to say that your robot is accurate within a nanometer. This is all theoretical, and really impossible to verify... I mean, how would you measure to see if the robot moved accurately within a nanometer?

Anyway, some interesting numbers. I seriously doubt if the controller would be that accurate. I don't doubt the motors as much as I do the controller.

United Kingdom

Here is a video of the precision attainable with the REX motors/encoders and the Sabertooth Kangaroo combination.



By "That accurate" I was referring to down to the nanometer. It is more than accurate enough for SLAM for sure.

Tony, thank you for the video. I was going to try to replicate it, but have not had time yet. Thank you for posting it.

I see the advantage to using the Roo/Sabertooth combo as being a time savings investment. It could be done cheaper for sure, and I have a arduino solution already, but I do feel that dropping in already built components, that can be tuned for each robot specifically is the way to go. I would hate to have to make slight adjustments to code to account for slight variations in motors, wheels, controllers, circuits, weights, or any other variable. Being able to have the robot built, press a button a couple of times to let the autotune take place for the robot and then test seems like a much better solution even at higher costs.

United Kingdom

David, in my opinion your are spot on correct! Its a nightmare getting involved with PID and trying to tune it, this makes the Roo (with auto tune) a very attractive proposition. Emulating the Roo with an arduino is going to give you a headache!



I have some 74HC74's bread boarded to test out. I plan on testing them tonight and should post the results of the test. It will be interesting to compare the results to the 4013's. The 74HC74's are either easier to bread board or I have gotten better at it. Its probably the latter.


Well, as I posted in my other post, more failures than successes. I get 60/sec out of the 74hc74. I need to make sure the unused pins are high in the data sheet. I have them high right now (testes with voltmeter).


Did you know that you have to supply 5v to the encoder?

Well, i did but didnt.

The 4013 reports around 19300 pulses per second The 74hc74 reports around 19500 pulses per second

I find this interesting because I would have thought that they would have been the same.

Without the flip flop inline I get 38860/s. This could be pushing the digital read limit of the arduino I suppose. The motor is rated to run at 42291/s but my battery may not be fully charged and the simple serial mode that I am running in may not be going truly 100% on the motor.

I tested the battery with a volt meter and got 13.36v, so that should be good. I tested the output from the sabertooth that I am using for testing and got 10.94v to the motor so it should be running a bit slower than 40 RPM (about .911% which this tick count amount is close to at .918% of max speed). I will have to look into the sabertooth that I have to see if something is weird or if this is expected...

so, which is more accurate? hmm 4013 - 193002 = 38600 or 260 less than what the counts reports without the flip flop in place. 74hc74 - 195002 = 39000 or 140 more than the count reports without the flip flop in place.

It is impossible to test accurately to say because the ticks per second does not stay consistent, but I think the 74hc74 wins. I wonder if we are pushing the limit of the 4013 that I have with this encoder. The 74hc74 has 10 times the processing speed of the 4013.


PCB's ordered for the first batch of 74hc74 based Flip Flops. I managed to get the first order down to a quantity of 64. This did hike up the price some per unit, but it will be good for the first test of the PCB design without spending too much money.

I was also doing some searching online for Quad encoder android issues and it seems that there were some articles about people getting too high of counts and needing to use a circuit like this to handle the issues they saw. Who knows, I am sure that I will sell a few here if anyone needs them. If not, no problem, they will be used by the few people that I know who need them (including me). These are going to be sold by me and not CochranRobotics. I will sell CochranRobotics what it needs for Rafiki.

Now that this is complete and I have 4 working prototypes, I will start coding again and wont be on as much. Thanks again to everyone for their help!


Please post when/if you start selling these. I would like a couple myself.


A large majority of the initial order will be up for sale. I am working on the sub-controller circuit board for Rafiki and decided to include these on the sub-controller board. I will build a couple of them to test the design to make sure it all works as expected and then put the rest up for sale.


I should have 12 of these up for sale in a couple of weeks. This will help to offset the cost associated with having boards manufactured. It costs me about $3.36 per unit for parts. Time is the only variable that I don't know yet along with shipping and such. I don't think it will take long to put the parts on the board at all, but you never know until you do a few of these. I will figure up a price that I think is fair after I make the first couple based on the time it takes to assemble them. All of the parts have been ordered and I am now just waiting to receive them.

I just want to set expectations up front if anyone is considering purchasing.

These will be "made in someone's garage", so please expect a working product but if you order 2 of them, I can't promise that these two will be in the exact same form factor. One might be a bit more narrow than another for example. These are being put on an additional order which is the primary focus of the order. I spaced these in a way that I should have no issue scoring the board and breaking each one off, but I didn't pay extra for the boards to be scored. I will probably cut these out with a wet saw. These are prototype boards. They will be about 1 inch by about 1.75 inches in size.

I will solder the 7474 chip, resistors and cap to the board and then alcohol wash the flux off the board before shipping. I will leave the header rows blank so that you can put whatever you want for headers. There is an input and output header row (5 pins each) labeled Roo (output) and Enc for the encoder side (input). All of the pins are labeled (G I A VCC B). I (index) is now connected through the circuit if you need it. You will have to solder in a 2k7 resistor to use Index and enable it to go through the circuit. There is no divide by to happening on Index. There is no branding information on these to keep them as small as possible. Right now I think the cost of an assembled board would be about $10. If you just want the parts and want to build it yourself, I think I will charge about $6.00. I will make a run to the post office weekly to ship out orders.


I updated the information above. There was an issue in making these boards, so I decided to make some changes that I wanted to make anyway. The Index signal is now passed through a pullup resistor slot. If you want to use it, you would just solder a 2k7 resistor in and Index will be passed through the circuit. I also will only have 12 of these for sale. Unfortunately, this issue will push the making of these boards back about a week or so.

I decided to make some of the parts instead of buying them. The main part that I will be making besides the main sub-controller board for Rafiki is a USB type A breakout board. This board costs about $4.00 shipped online and I will need quite a few of them and can make them for about $1.40. Because of this I am making 15 of these, 3 USB signal splitters, 3 74hc74 based logic divide by 2 circuits and 1 2x 74hc74 based logic divide by 2 circuit per board that is manufactured. This will give me 12 74HC74 flip flop circuits and 4 2x flip flop circuits that I will be able to sell. It also gives me 50 usb breakouts and 4 usb signal splitters that I will be able to sell per circuit board order. I will put these up for sale and see what happens. The USB type A breakouts can be ordered online from other companies for what I would sell them for, but if you are buying any of the other two parts, this would be beneficial to include to save on shipping I guess. If you were to buy the USB Type A divider circuit then you might need 3 of these USB Type A Break out boards to go with it for example. I would sell the other 3 Rafiki boards but they are not general enough of a product to sell.

Anyway, waiting for the parts and then I will build some and open a store on my website.


@David, I haven't read the whole post I take it this is for slam if so I'm in for two of them that your building


This is only if you are using encoders on your wheels that have a very high count per revolution amount really. For SLAM to work for me the way I want it to, I had to make some logic divide by 2 circuits so that the count wouldn't be so high.

Unless you are in this same situation, no need to purchase the divide by 2 circuits. If you are, they can help a lot. The other 2 parts could be helpful though.


So I do need encoders but not sure what to use because I am using the same wheels and motor as Richard r and BHouston . Without encoders. Maybe You or RichardR could suggest what I should use?

My wheels are7" and I really can't go below 6" for clearance. Thanks


I will have to look tonight currently at work right now


It looks like there is a shaft on the back of the motor but unless I had one, I don't know what it would take to add an encoder to the back of the motor. The other option is to add it at the wheel end of the motor. Without specs on the motor, I wouldn't be able to tell you if you would probably need a logic divider or not.

Here is what I mean...

If you had a motor that was geared 200:1 and you had an encoder on the back shaft of the motor that was a 500 count encoder, you would get 100,000 counts or ticks per revolution of the wheel.

If the encoder were a 100 count encoder and it were on the wheel end of the motor, you would get 100 counts or ticks per revolution.

The gear box and the placement of the encoder in relation to the gearbox has a lot to do with the level of detail by the number of ticks per revolution.

The issue comes in if the gearbox is say 127:1 and your encoder is before the gearbox, causing the encoder to spin 127 times per revolution of the wheel. This also gives you very accurate movement though.


Here is a photo of a sample of one of the boards. There is a modification to them to allow index to also be used, and will have thicker leads and less space on the sides, but this will give you an idea of what you would get to solve the high encoder count issue for these motors and these kangaroo.

I will start taking orders for these. Just send me an email. My email address in on my profile. They will be $8.00 each. If I already have an email from you then I already have you down for the number that you ordered. It will be about 2 weeks before I can have these made and shipped out.

This is a first come, first served deal. There will only be 20 available in the first order, of which 10 are still available.

Payment will be available through Paypal and the details will be handled through email for any orders.

User-inserted image


i was able to squeeze 2 more of these logic dividers onto my board design. Because of this there will be 8 more of these available and it reduced the cost to $8.00 per board.

The order for the boards will go in tomorrow. It will take about a week for me to receive these boards, and then about a week to make and test them before shipping.

I will update this thread with the current status as I know more.

Shipping inside the US will be done through USPS. Outside of US, I will have to see who has the best rate available. I know some have different shipping methods that they prefer. We can discuss the rates and all through email when the orders are ready to ship.

Payment will be due when these are complete and I have tested them and know that each one is working correctly.

I will provide post headers but wont solder them so that you have the option of using something else in this location. If you want me to go ahead and solder the post headers onto the board, just let me know.

Thanks David


The board order has been placed. I should have them by this time next week. All other components for these flip flop circuits are waiting to be soldered onto the boards.

There are 10 of these logic divide by 2 circuits available still. The cost that is being charged will cover the cost of having the boards made. The cost of the other parts of this process except shipping are being absorbed due to the fact that this order is also helping me with the cost of having the (hopefully) final Rafiki prototype boards made. If it is found that these are wanted by more people after this initial order is fulfilled, I will make a run of just these boards.

Anyway, two weeks from today, I hope to have the orders fulfilled and shipped out.

Thanks David


These boards are in a Shipping status from the board manufacturer. I expect to receive them by the end of this week still and will start fulfilling orders. I have 10 available for purchase at $8.00 each. If this board tests out correctly, I have another order set to go in which will allow 16 more of these to become available. I think I will wait until these sell or are used by me before ordering another set of boards with these flip flop circuits on it. The other future board designs will have more of the USB Breakout boards if anyone is interested in buying any of those. I think I will sell these for about $4.00 each.


The boards should ship to me today. I gave them the wrong city name in the address to ship them to. Stupid mistake, but this will probably delay me building these until next week. I should be able to knock out the ones that people have ordered pretty quickly. Sorry about that to anyone who is in a rush.


It looks like I will receive these boards on Monday. I have to go to Dallas Monday afternoon and won't be back until Wednesday night. This cuts into the time that I was going to use to make these. I may just bring them with me to Dallas and use the DPRG facilities to make these. IDK if it is a good thing to show up to my first meeting and do this or not, but may try. If I can get them cut out of the board before I leave, I will bring them. If they come to late in the day, I will have to wait until Thursday night to start on these. Anyway, just giving a status update to those who wanted these.


There is no reason to hurry for me Dave. These are going into my next project, so whenever.

Thanks for doing this for us.


@David, no worries David go to your meeting come back and finish your chips I'm in no rush I still have to order my motors with encoder anyway . This way you can focus on your meeting and not have to be in a rush to finish the chips thanks for all your work

Sorry for no punctuation's I am talking to cell phone


I didn't get a chance to cut these boards down while in Dallas. I will cut these down this weekend and build them out. My hope is to mail them out early next week.


I had to make another board order for Rafiki, so it looks like there are going to be 22 of the divide by 2 circuits available for purchase by the end of next week. This isnt something that will affect the ones ordered but was an issue on another part of the board. I am still shooting for this weekend to have the first batch completed.


Just finished making these. I will test them out tomorrow to make sure they all work. I'll send those that sent me an email an invoice through paypal this weekend.


Just finished testing every one of these individually. With 12.8 V to the motor I get right around 24K ticks per second. This should put these at about 32K per revolution which is correct. I will send invoices later today and will be shipping these on Tuesday. American holiday prevents me from mailing these out on Monday. I am including your basic pins with these and these pins will not be soldered to the board.

Thanks for your patience. BTW, there are 22 available for sale if anyone needs these in the future.


Invoices have been sent on domestic orders. I will need to go to the UPS store for international orders which I will do tomorrow. I will be sending all of these out tomorrow.

Total cost for domestic with 2 day shipping is $22.80 for 2 of them. I have 4 more built, tested and ready to ship if anyone would like them. The others after this will be built and tested as ordered, but all of the components are here so it wont take much time at all to fulfill an order.

Thanks David


Money sent.

Thanks for doing this for us David.


The funny thing is that a week ago at the Dallas Personal Robotics Group meeting, there was a group of people discussing this same issue but with an Arduino controller and a different motor. They were looking for a way to reliably reduce the counts per rev on a motor due to the encoder being behind the gearing in the motor. I told them some programming solutions like just catching the rise and discarding the drop on each of the encoders and such. They didn't like this solution so I then said that you could use a flip flop type solution. They said that they didn't want to add other IC's to the robot that someone would have to design and build.

They are trying to come up with a basic robot platform that would be expandable and allow a novice to learn about robotics and compete in a competition that they have coming up. This is when I mentioned EZ-Robot to them and described the EZ-B and ARC to them. I don't think that they believed me about ARC and how easy it would be to build what they were designing. Anyway... next time I am down there, I will demonstrate it to them and also bring some built flip flop circuits down to them to use/buy. It always amazes me when I talk to expert robot builders about how simple things can be and they seem to discount it because it is easy. I thought that was the entire point of what they wanted to do, but I was new among them so there is no level of trust built yet for them to believe what I am saying, and I get that.


Cochran Robotics online store is now, well, Online... Anyone needing these in the future can order from I am now finished posting on this thread:)

Thanks David


Zagros is having issues keeping the motors in stock now. This is an issue for me...

I am in discussions with GLOBE to be a distributor for these motors now. I should have a quote in a couple of days for a purchase that will allow you to get these motors/encoders from me. I have asked for 2 different products to be quoted. One will use the Avago 500 count encoder and the other will use the Avago 256 count encoder. The 256 count encoder on these motors is not an existing part number at GLOBE meaning that they would probably cost me more, but we will see. The 500 count encoder on these motors is an existing part number and is what is sold by Zagros when in stock. It is also the one that requires the use of the logic divide by 2 boards for sale on my website to allow it to work with a DE Kangaroo controller. I should have news in the next couple of days and will update here if I will be able to carry these motors or not.


I can sell these motors for about $200 each. This leaves me only about $20 profit. These would have 256 count encoders and would eliminate the need for the divide by 2 circuit. If you would be interested in doing this, please email me. My email is on my profile. This gives 32,512 ticks per rotation. With a 4 inch wheel, this gives you about .01 mm accuracy.