Hello. I am designing a device that will be mounted in one spot and move a frame (plane) that will track the sun's movements (keep the plane normal to the sun's rays. Movement will not be continuous, maybe once every hour.
I am using an UNO R3 and have become familiar with the SolarCalculator library so that I can generate the azimuth and elevation angle at any time. I am also using a DS3231 to keep track of time. There are two DC motors. One controls the movement around Z (azimuth) and another controls the tilting movement of the frame (elevation). The motors are controlled using the Cytron Dual Channel shield. I purchased a QMC5883L magnetometer to become familiar with getting the bearing and from there I realized there are quite a few motion and orientation sensors with 6 and 9 DOFs that may or may not give me the feedback data I need.
I am unfamiliar with these sensors and have read many posts regarding their use and potential problems. My question is am I on the right track in using such a sensor and if so what is the best (simplest?) sensor that could be attached to the frame and give me the azimuth and elevation data that I need? Also, is there an easier way to sense the azimuth and attitude of an object? Thank you.
I would think about a small diameter convex lens focusing the sun. Around the focus point a ring of light detectors could be used. When one or two sensors indicate more light then the others, an adjustment of azimut and elevation is needed. Mount the lens at the focal distance. Use a small diameter lens to avoid collecting too much sun power!
Using the SolarLocator code, the coordinates of the sun are already known. The axes of this project are being moved with two large (existing) DC gearmotors (stepper motors are not an option). My objective is to move the axes to align with the coordinates from the software. What I am looking for is something to tell me the azimuth and elevation of my device at any given time.
Just about any 9DOF IMU, properly calibrated, connected to an Arduino running the Mahony or Madgwick AHRS code, will provide Euler orientation angles relative to magnetic North and the horizon.
I recommend the ICM-20948 IMU. To work at all for your project, you will need to very carefully calibrate the sensor in place.
Thank you very much for your response and recommendation. I will go this route and see how far I can get without asking for assistance. BTW I googled Mahoney AHRS code for arduino to learn more about it and your previous post on this forum came up first.
Thanks for taking the time to help!
I just wanted to update this post with my latest efforts and again say thank you to jremington. I did purchase the ICM-20948 from Sparkfun with the QWiic connectors. I used your ICM_20948_Mahoney program and followed all your printed instructions for calibrating the sensor. (A lot to learn for a newbie, but all your documentation and recommendations were invaluable.)
I also printed a small device to simulate and measure the the movements of my final project. (Make hourly movements to approximately face the sun.) The sensor is affixed to the upper assembly of the printed device and can rotate about the Y axis to simulate the elevation angle (0-90 degrees). The upper assembly is mounted on a base so that the upper assembly can also rotate about the Z axis to simulate azimuth (0-180 degrees). Two protractors are attached, one for each axis, so that orientation of the sensor can accurately be measured. (Accurate enough for what I need.)
I attached the sensor to my device and carefully levelled it and pointed the assembly due south. (Azimuth protractor reads 90 degrees.) I am also using an Arduino Uno to run the program. I was pleasantly surprised to find that as I changed the orientation of the sensor about both axis the readings from the program serial monitor were within one degree of the analog measurements of my device. This is well within the accuracy that I need.