As a part of the learning process, I picked up the light tracking topic using Arduino. Watched few YouTube videos and articles and I started my own project with my own algorism.
Luckily, my Light Tracking Gimbal is able to move smoothly towards the light source and hold its position while light source is not moving.
See the tutorial video:
Gimbal Panel Area:
There are Top Left, Top Right, Bottom Left, and Bottom Right.There is a light sensor in each area.
Programming Logic:
- Get reading from 4 photo sensors — I sample each sensor 10 times and then get the average value to ensure the readings are more stable
- Get average of each side —
- Top side value = (Top left + Top right) / 2
- Bottom side value = (Bottom left + Bottom right) / 2
- Left side value = (Top left + Bottom left ) / 2
- Right side value = (Top right + Bottom right ) / 2
- Compare all four sides to see which side has bigger value
- Move the servo towards the biggest side among four side
- Tolerance variable is in control whether to move or not based on how much differences among four sides. If reading values from four sides were within the range of 100, then keep the Gimbal static(Hold it's position) (default value = 100)
Tolerance variable is the most important variable to ensure the Gimbal holds its position when four light sensors get values within the defined tolerance!
References:
Serveo Example: https://www.instructables.com/id/4-Simple-Servo-Project-with-Arduino/
Light Sensor Example: https://maker.pro/arduino/tutorial/how-to-use-an-ldr-sensor-with-arduino
3D Gimbal base model: https://www.thingiverse.com/thing:2892903
You probably need slight modification to this model to be able to fix the base... I did
Comments