{HELP} How To read motorservo on Solar Tracker

i have an assignment about solar tracker(i use arduino uno),i have the sketch to run this program, but i have a problem how to read servo motor on monitor and degree as unit. Please help me

this is the circuit by the way

i have a problem how to read servo motor

You can't read a normal hobby type servo's actual position, if that's what you mean. You can use servo.read() to get the last position you sent it to, but there's no guarantee it ever got there: it could be jammed for example, or still be en route, and you won't know that.

adafruit have these feedback servos with an extra wire, which do let you see where they really are.

imamnursodiq25:
i have an assignment about solar tracker(i use arduino uno),i have the sketch to run this program, but i have a problem how to read servo motor on monitor and degree as unit. Please help me

Your Fritzing diagram is completely unintelligible with all the wires on top of each other. However it is unlikely to be necessary for solving this problem.

There is no need to know the position of the servos beyond knowing the values that you sent to them for the previous move. Just store those values in variables - something like

horizontalPos = 37;
verticalPos = 21;
horizontalServo.write(horizontalPos);
verticalServo.write(verticalPos);

...R

Robin2:
Your Fritzing diagram is completely unintelligible

Nonsense, and typical Arduino forum knee-jerk.

It's not the best, sure, but by no means "completely unintelligible"; it's perfectly clear to me. Each ldr is in a divider read on an analog pin, and each servo is powered from the Uno and controlled from a digital pin. Nothing unintelligible at all.

@OP, you shouldn't be powering those servos from the Uno though; they should have their own power supply like a wall wart or a battery pack.

gwareloth:
Nonsense, and typical Arduino forum knee-jerk.

Let's agree to disagree.

...R

imamnursodiq25:
i have an assignment about solar tracker(i use arduino uno),i have the sketch to run this program, but i have a problem how to read servo motor on monitor and degree as unit. Please help me

If you want to get feedback of the actual current position (not the position you want to set it to) there is a way of doing that IF you are willing to modify the servo themselves.

I can share the instructions if you do...

sherzaad:
If you want to get feedback of the actual current position (not the position you want to set it to) there is a way of doing that IF you are willing to modify the servo themselves.

If can share the instructions if you do...

It is certainly possible to do that but it is not a good idea to overload servos to the point where they can't reach their commanded position. And if they can easily reach their commanded position there is unlikely to be any need for feedback.

...R

sherzaad:
If you want to get feedback of the actual current position (not the position you want to set it to) there is a way of doing that IF you are willing to modify the servo themselves.

I can share the instructions if you do...

i'm sorry to tske long time to reply this post,

ofc i want the instruction

imamnursodiq25:
ofc i want the instruction

Looks like you did not read Reply #6

...R

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
Please post your code and we can advise you.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

If all is well with your mechanical construction.
The position of your servo will be the last servowrite function you sent.

Tom... :slight_smile:

Hi,
Find attached a schematic of your fritzy.
What are the values of R1, R2 and R3m really 220R?
UNO_Solar_Tracker.jpg
You will need to provide a separate supply for your servos, as once they have to drive a load and support a load, they will both be drawing more than the USB 5V what you have it running on now.

Tom… :slight_smile:

TomGeorge:
The position of your servo will be the last servowrite function you sent.

not true strictly speaking...it's the intended position... not the actual position! :slight_smile:

imamnursodiq25:
ofc i want the instruction

Capture.PNG

  1. close the servo back.

The added wire will give you an analog output (probably same as would the servo gwareloth suggested)

just stick that into your analog input of your arduino and analogRead to know the current value based on the position on the servo.

You can then work out / map out position(degC) vs analogRead to calibrate it if you want.

Capture.PNG

sherzaad:
not true strictly speaking...it's the intended position... not the actual position! :slight_smile:

Position +/- deadband, which is where the pot will stop, Yes the pot will give actual position.

I'd like to know why the OP wants the exact angle?

Tom... :slight_smile:

sherzaad:
not true strictly speaking...it's the intended position... not the actual position! :slight_smile:

You can't tell the actual position any more accurately than the commanded position because the same potentiometer error (if there is one) will be in the "read" position. UNLESS the position error arises because the servo is overloaded - and that will quickly break the servo.

...R