How to measure the pulse width with of a LM555 Servo Tester

Hello,

I made a servo tester with the LM555 (link below). It works great. Now, I want to read the position of the servo with the arduino. One idea i have is to read the pulse width from the lm555.. ex 1ms = 90deg, 1.5 = 0 deg...etc

How can I do that???

Controlling the servo on the arduino is not an option.

Thank you

Lm555 schematic i used
https://www.google.com/url?sa=t&source=web&rct=j&url=http://www.robotoid.com/appnotes/circuits-servo-control-with-555-timer.html&ved=0CEQQFjAKahUKEwjD1ZuMp9HIAhWKjA0KHfpcDBc&usg=AFQjCNGHsawxB89nyNP7wkuuayYuZ4H5fg

https://www.arduino.cc/en/Reference/PulseIn

jremington:
https://www.arduino.cc/en/Reference/PulseIn

Thank you. So, dhould I connect the LM555 pin#3 (output) to the pwm pin from arduino? Maybe an interrupt pin?

Than you

Any input pin can be used for pulseIn
duration = pulseIn(pin, HIGH); // measure high pulse

duration = pulseIn(pin, LOW); // measure low pulse

The servo uses a fixed frequency, with the High time determining where the servo moves to.
So you could measure the High time, the Low time, and determine the commanded position from there.
High + Low should equal 20mS, with High varying from 0.5mS (500uS) to 2.5mS (2500uS)

CrossRoads:
Any input pin can be used for pulseIn
duration = pulseIn(pin, HIGH); // measure high pulse

duration = pulseIn(pin, LOW); // measure low pulse

The servo uses a fixed frequency, with the High time determining where the servo moves to.
So you could measure the High time, the Low time, and determine the commanded position from there.
High + Low should equal 20mS, with High varying from 0.5mS (500uS) to 2.5mS (2500uS)

Than you. Will this code be more efficient because is using interrupts instead:

External Interrupts
volatile int pwm_value = 0;
volatile int prev_time = 0;

void setup() {
Serial.begin(115200);
// when pin D2 goes high, call the rising function
attachInterrupt(0, rising, RISING);
}

void loop()
{
Serial.println(pwm_value);
}

void rising() {
attachInterrupt(0, falling, FALLING);
prev_time = micros();
}

void falling() {
attachInterrupt(0, rising, RISING);
pwm_value = micros()-prev_time;
}

I doubt it. Where did you get it from? :astonished:

And do please read the instructions, then go back and modify your post to mark up the code as such - and any other code you post - so we can examine it comfortably and reliably.