We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
How do I decide which ARM board to go for if I am aiming to use it as a micro-controller to run sensors, actuators, motors, and solar panels? And I wish to power up the board via Li-ion battery pack.
The two photo-sensors are powered by two GPIO pins and read by one ADC on the shared pin.
The resulting two ADC values are numbers between 0 and 1023 (10 bit ADC), so basically, if value1 is larger than value2, then I turn the motor clockwise; if value2 is larger than value1, then I turn the motor counter-clockwise.
The data are not stored AKA. "collected", as they're used on the fly.
However, I sample the values for a while, before I decide to change the position of the panels.
(A panel can only go in one direction or the other, as there is only one axis).
An improved version might be to use 3 photo-resistors, so that the one in the center (which is parallel with the solar panel) must always have the highest ADC value.
The distance between your CubeSat and the sun is hopefully around 18 lightminutes.
But I think you mean how to find out how much you need to rotate the CubeSat ?
You could collect a number of ADC samples - say 16 for each of the sensors.
Then averaging these results into one value per sensor.
Now you find the two sensors which have the highest values.
If those two sensors are on each side on the cube, you're having a problem: The moon.
-But if the sensors are adjacent, then let's assume you're using a 10-bit ADC (which will give you values between 0 and 1023):
A simple draft would be something like this:
int32_t position = ((value2 + 1) << 16) / ((value1 + 1) << 16);
That would give you a value between 0 and 67108864.
You could subtract (512 << 16) from that value in order to get a signed integer, where 0 is the middle, negative is towards the sensor which provided value1, positive is towards the sensor which provided value2.
You may also want to get familiar with PID, which you can probably use for more than one thing. Just make sure you get things right, so it won't become completely erratic and out-of-control.