before i make this post in write "Angle" in Search of arduino forum and got 34 page
and every page have 30 results (more than 1100 threads =( and i visit it ) ...i read the thread and didn't find what i want
i want to make device able to measure the angle by using arduino like
the Digital Angle Finder
the problem is there is no video in youtube or any website for someone Teardowns this digital angle finder
to understand how it work and what IC it have inside
i don't think they use accelerometer to make it
because the a accelerometer have z and y and x
x for vertical angle
y for horizontal angle
you can't calculate Oblique angle like digital angle finder
so how to do that is there any idea any sensor to do that
my question it what sensor should i use to make digital angle finder
can i use servo motor and when i rotate it the motor will output signal and read it then calculate the angle
The latter would be able to read 270 degrees in 1023 steps
void setup()
{
Serial.begin(115200);
}
void loop()
{
// average 90 reads to stabilize a lot
long sum = 0;
for (int i=0; i<90; i++) sum += analogRead(A0);
float angle = sum / 90.0 * 270.0 / 1023.0; // or in one formula sum * 0.002932551;
Serial.println(angle, 2);
}
The factor 0.002932551; defines the step size that can be seen in the display.
This is substantially smaller than 0.01. That is why I used two decimal to display.
the analogread reads ~8000 samples per second so at 90 reads one can still do 90 measurements per second. faster than the eye
The posted code is for a potmeter NOT for a servo.
What is the best I cannot tell as I do not have all your requirements. It is simply your turn to buy a few potmeters and get started building a prototype as that is the fastest proven way to learn how things (should) work.