Zumo - change the PWM pins?


This is a replacement for a question I posted yesterday.

Basically I want to know if there is any way of changing the PWM pins the motors use (9 & 10) without dismantling the Robot? As the robot is prebuilt I’m a bit nervous of cracking it open.

The reason for doing this is explained here https://github.com/rwaldron/johnny-five/issues/309.

Thanks for any advice you might be able to give me!

Best regards

Hello, Mark.

In the future, instead of deleting and making another post, please add content to the original post. This makes it easier for others who might have the same issue to discover a method that could help them.

Unfortunately, there are only a few timers available for use on the Uno’s AVR microcontroller. As you already noticed, the Zumo motors and the Arduino Servo library conflict because they both use Timer 1. The pins that use Timer 1 (9 and 10) cannot be changed, but you could remap connections so that the motors are connected to pins used by a different timer. This would involve physically cutting the traces on the Zumo shield, and modifying the Zumo motor library.

Alternatively, you could keep using the PWM pins that are already on the Zumo, and instead use Timer 2 to control your servos. You can find an example sketch that uses Timer 2 to control a single servo inside the “Controlling a servo” section of the Zumo’s user’s guide, which can be found under the “Resources” tab of its product page. It looks like that sketch could be modified to control two servos.


Thanks, I’ll have a look at this.

Here’s a direct link to the servo example in case anyone is interested. https://www.pololu.com/docs/0J57/8.a

Hello again!

If I decide to remap pins 9 & 10, how would I go about cutting the connection? Is it as simple as cutting at these points?

Once the connection is cut, is the remapping part simply adding jumper wires from the relevant available pins to these sockets?

I’ve never done this before, hence the (maybe) dumb question.

EDIT : I’m thinking of remapping 5 and 11 to 9 and 10.

Best Regards

I should have mentioned this in my last post, but I recommend first trying to use Timer 2 to control your servos, since modifying the hardware is more complicated and you would still need to rewrite some code (e.g. to control the motors with different pins). You can use the code examples I mentioned as a starting point.


Hello again!

I’m using Johnny-Five to control the robot, so changing the pin allocation in the code is pretty simple. But I’m unsure of how to use different Timers in the Johnny-Five code.

What is the process of manual modification?

Best Regards

We’re not familiar with Johnny-Five, so we don’t know what code modifications would be involved. Replacing your servo code with our Timer 2 code should be pretty straightforward if you’re writing your own program, but integrating it with the Johnny-Five framework in a good way might be difficult. If you really think that physically remapping the motor pins would be simpler, you can disconnect them by cutting the traces between the innermost two columns of pins on the bottom side of the board. I drew a red line to show where to cut in the image below (make sure to cut on the bottom side even though this picture shows the top):

You can then reconnect the innermost column to a different pin of your choice.


EDIT : I can now see that I can access the other side of the board from underneath the Zumo, without dismantling anything.

So, to clarify - I will cut at the red line here. Ok?


Thanks! Just to clarify, you mean that I should dismantle the Zumo and cut the connections on the side of the shield that is normally facing the chassis.

I just want to be 100% sure before I start cutting :smiley:

Yes, cutting there should be fine. Also, thanks for keeping the original content of your post in your edit!


Hello again!

Just did it, and everything worked! Very happy now - my robot will now be ready for a presentation next week.

Thanks for all your help and patience!

Best Regards
Mark :smiley: