Go Down

Topic: PCB Shield with various sensors and motors (Read 1 time) previous topic - next topic


I have two questions that I was hoping someone knew a definite answer to. Thanks in advance for your help. I am trying to make a shield to drive a little cart around and collect data on it to then send back to my computer.

Is it acceptable to run 2 servos off of 1 PWM pin or am I running the risk of something going wrong?

Is it possible to interfere with an Xbee from signal noise generated by various sensors such as an Ultrasonic sensor, IR diode, compass sensor and their power supplies (9v battery converted to 5v as well as 6v for servos). The same goes for a compass sensor which will most likely be https://www.sparkfun.com/products/9757. Everything will be in close proximity (it fits on a 2.5 x 2.5 in board) I apologize if this is a silly question, I have always been warned about signal noise and wanted to be on the safe side. Thanks!


Is it acceptable to run 2 servos off of 1 PWM pin or am I running the risk of something going wrong?

Are you using the servos as the drive motors for your bot?. If you are then this will make turning very difficult. If not then read the documents for the servo lib.



On boards other than the Mega, use of the library disables analogWrite() (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins.

The servo lib has problems with the standard motor shields.



Is it acceptable to run 2 servos off of 1 PWM pin or am I running the risk of something going wrong?

As long as everything is within specs, Amp draw, voltage, etc. yes. However - you do run the risk of one motor skipping a step and the other not, and no way to correct it other than turning one by hand. But that all depends on how precise your movements are.

This is one potential problem the Printrbot has as it's Z axes is driven by two motors on the same driver. if one skips a step, the Z will no longer be parallel to the print bed. The only way to correct it is to reset the Z manually or re-level the bed. If they were driven by separate drivers, it could be corrected in the Software.


9v battery converted to 5v as well as 6v for servos

I hope that isn't going to be one of those little PP3 smoke alarm batteries. They have tiny charge and current capacities which renders them useless for powering just about anything.
I only provide help via the forum - please do not contact me for private consultancy.


I was only planning to use the 9v battery to run the Atmega328 and sensors. The sensors and Xbee only use 56ma at 3.3V.

Since I cannot use pins 9 and 10, can I then have one servo on the left side controlled by an analog pin and another one on the left side with a PWM pin or will they get out of sync? To clarify can different servos on the same side of the drive train get their signal from a mix of analog and PWM pins?

Any thoughts toward signal noise? Thanks.


Those 9v batteries are a very expensive and inefficient way to power an Arduino, but if the current requirements are low enough then it would be possible, if you insist.

Read the documentation for the Servo library for a clear explanation of what it does, but briefly:

The Servo library can control up to 12 servos (up to 48 on a Mega). The servos can be on any of the output pins (you are not limited to the pwm-capable pins). However, using the Servo library does disable some of the pwm output capabilities (which pwm-capable pins lose their pwm capability depends on how many servos you are using). Unfortunately, on all boards except the Mega using any servos disables the pwm capability of pins 9 and 10 which are the ones typically used to control the speed of a motor drive shield, so using servos and a standard motor drive shield can be problematic. If you used a Mega this wouldn't be a problem, and if you used a motor drive shield that didn't use pins 9 and 10 this wouldn't be a problem, and if you used a separate motor driver board connected by flying leads (rather than a shield) this wouldn't be a problem.
I only provide help via the forum - please do not contact me for private consultancy.


Lets try and split you project up.

1. What are you thinking of as a robot body. post  a link!

How do you intened to make it move. Are you thinking of using standard servos?, motors, or continuous rotation servos. There is a great deal of difference.

2. What else do you think you want to add to the robot?



For the chassis I am using 4x continuous rotation servos that have wheels (not shown in photo). More photos are available at http://builtbyben.net/3d-printing/

I am planning on using rechargeable AAA NiMH batteries to power the servos.

As for the sensors I plan to have 1x Ultrasonic Sensor to measure the distance, an Xbee to communicate with my computer/another Arduino, 1x IR Reciever diode and possibly 1x compass sensor.

I have been working on a schematic in Eagle although I apologize for any errors as I am still learning Eagle and based on your suggestions I need to change some things. The ultimate plan is to make a PCB for the project.

I have made a standalone Atmega328 on a breadboard so since I have all of the parts already, I am making this through hole instead of SMD which I recognize is the better option and the future.

Right now the servos are connected to pins 17,5 and 11 which I plan to change. The plan was to have pins 17 and 5 split so that 5 went to the left 2 servos and 17 to the right 2 but I need to change that.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131