Problems with pulseIn and servo.h

Hello everybody,

Currently i am reading a pulse train consisting of 7 pulses on the Arduino Uno. This works really good. The problems start as soon as i am using the servo.h library. If i do so and try to write a value to a servo i'm getting a noise on the readings from the train signal. This noise occurs exactly every 5 seconds in between everything is okay. The noise exists only at software side i've checked the train signal with oscilloscope, no issue found.

I'm assuming that there is some issue with the timers utilized by servo.h and pulseIn. Can this be the case?

Thanks Br

Hi,
I don't have access to the Arduino files to check right now, but it is possible they are using the same timer. why don't you switch to using interrupts for the incoming pulses instead ?

Duane B
rcarduino.blogspot.com

Yes, it would be nice to have a hardware based solution. Do you know some good references for me where i can have a look at??

Thanks

Hi,
I have checked the source for pulseIn and as far as I can see, it does not use any of the hardware timers.

The problem could be in your hardware design or code, what are you using for power and are you using current limit resistors on your inputs and outputs ?

For an example of using interrupts to measure and incoming pulse, see a post on my blog here -

Duane B