How to track the position of a servo with led lights

New to electronics, Some programming. Just ordered a starter kit and looking for info that would send me in the correct direction to track the position of a servo with led lights. Thanks in advance

Hi and welcome.

Please give more detail! Its hard to see into your head. Can you post some links to similar concepts?


Hi and welcome.

Please give more detail! Its hard to see into your head. Can you post some links to similar concepts?


Like Paul, I'm not sure what you're getting at. You mean have an LED on the end of the servo horn and follow it with some kind of sensor from another spot?

This is a layout I plan to start with when kit arrives. Not sure if I will need a microprocessor to monitor position of the servo then turn on the proper led light

Ah ok, so you want (say) led1 to come on at 20 degrees, and led2 at 40 or whatever....something like that?

First you need to note that a servo doesn't report its position: you give it a myServo.write(40); and it zooms off to 40 degrees but you have no way of knowing that it actually got there.

But apart from that, if my assumption above is correct, that should be doable.

Have a look at the servo sweep example for a start. After the servo.write you couls add an if to test for the position, and if it's (say) 20, make led1's pin high.

Something like that, but I'm not 100% sure I've understood what you're trying to do.

If you want to measure the position or angle of something and display that on the leds, you could use a potentiometer. Most are rotary, so could be used to measure angle. Some are linear and could be used to measure position. want to display the angle of the servo on the LEDs?

Thanks everyone, I look forward to getting kit to get started. What I will be using this for is My Light Sport Aircraft to monitor were my Elevator trim position is.
Sorry trim is hard to see it is painted black also, But it mounts on edge of elevator

That's much better information.
You do not want to control your servo by the Arduino, but you want to use the Arduino to see the control signal to your servo and display that.
The controlling of the servo will be done by some RC, right ?
You'll then be splitting this signal to the servo and to the Arduino, which in turn lights a LED.

I don't know much about aircraft. That looks full-size to me, not a model, but the trim is controlled by servos?

So, what controls the servo? An existing cockpit control? Or is the Arduino to do it?

I'll assume an existing control sends signals to the servo. You want the leds to indicate the servo position. That should be possible. Servos position is controlled by the length of a pulse. The pulse is repeated many times per second. If you can get the servo signal to an Arduino pin, the Arduino could measure the length of the pulse and decide which leds to light. You would need to watch the voltage of that servo signal and use a potential divider to bring it down to just under 5V.


Yes it is full size, the servo is powered by a 9 volt battery with a 2 way switch to change direction. I just want to know were it is rather than adjust both directions until it trims out control stick.

Ok so you do have to sense its actual position, not it's assumed position?

@PaulRB... won't your latter way only reflect the commanded position, on the assumption that it actually got there?

I think the OP needs closed loop control here, and some kind of potentiometer as in your earlier post would accomplish that. But that might be a mechanical challenge.

@theecoop..... might be worthwhile having a close look at the servos, although I know you lsa guys are intimate with your aircraft and probably already know, to see if that servo does have some feedback ability. I believe some servos do have that feedback built in. Not hobby servos, but you have an industrial strength one there I guess, so who knows, perhaps there's a spare wire dangling and it's the feedback?

EDIT...... Adafruit in fact have these hobby servos with feedback so it's entirely possible that professional servos are available with that feature. From their tutorial it's a simple matter (in their case) of reading the extra wire on an analog pin. That tut explains that while normal servos are closed-loop inside, they are open-loop to the outside world. Nice pix!

the servo is powered by a 9 volt battery with a 2 way switch to change direction.

Are you sure its a servo? Sounds like it could be simply be a motor/gearbox and the switch controls the direction of the current feeding it. A servo has a built-in position sensor and adjusts itself continuously to match the position determined by the control pulses fed to it.

@ JimboZA thanks for the info will wait for kit , I believe I will have to go the Hack route since the servos we use are heavy duty and do not have the feedback wire.

@PaulRB yes it is a servo - It is a heavy duty one though.

@ Everyone, Thanks for the info I think I am now off to the right direction I need to go.
Will post as I progress through this process .